From 18f34bf954e4e8b8f7aa4d200dd6216a3e2521fd Mon Sep 17 00:00:00 2001 From: WTMike24 Date: Mon, 15 Aug 2022 23:59:19 +0000 Subject: [PATCH] Added rudementary win support - not recommended --- perl/vping | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) mode change 100644 => 100755 perl/vping diff --git a/perl/vping b/perl/vping old mode 100644 new mode 100755 index 3227559..6747e8a --- a/perl/vping +++ b/perl/vping @@ -9,16 +9,21 @@ if ($ARGV[0] !~ /[a-z0-9\.]+/) { $dns=$ARGV[0]; -my $regex=""; - if ($^O == "linux") { $regex=qr/(?[0-9]+ bytes) from (?[a-z\.-]+) \((?[0-9\.]+)\).*seq=(?[0-9]+).*time=(?[0-9\.]+) ms/; $dedjex=qr/no answer yet for icmp_seq=(?[0-9]+)/ + $pingcmd="ping -O" } elsif ($^O == "MSWin32") { - print "win!\n"; + # untested lol + $regex=qr/Reply from (?[0-9\.]+).*bytes time=(?[0-9\.]+)ms.*/; + $dedjex=qr/Request timed out|Destination host unreachable/ + $pingcmd="ping -t" +} else { + print "IDK WHAT OS YOU ARE :("; + exit 1; } -open(my $PING, "ping -O $dns|") or die "Cannot execute $!"; +open(my $PING, "$pingcmd $dns|") or die "Cannot execute $!"; while (my $line = <$PING>) { if ($line =~ $regex) {