use perl to validate domain
This commit is contained in:
parent
134638b021
commit
b336af9376
|
@ -17,6 +17,16 @@ UnixTimeMs() {
|
|||
unix_time_ms="$(($(date -d "$1" +'%s') * 1000))"
|
||||
}
|
||||
|
||||
DomainCheck() {
|
||||
local result=$(perl -pe 's/(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)/pass/g' <<< "$1")
|
||||
if [ "$result" = "pass" ]; then
|
||||
return 0;
|
||||
else
|
||||
echo -e 'Error: Not a valid domain.\n'
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
EchoVersion() {
|
||||
echo $version
|
||||
}
|
||||
|
@ -24,6 +34,7 @@ EchoVersion() {
|
|||
main() {
|
||||
EchoVersion;
|
||||
UserInput;
|
||||
DomainCheck "$domain';
|
||||
UnixTimeMs "$time";
|
||||
ExecutePurge "$domain" "$unix_time_ms" "$token"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue