0: ###########################
1: ##Ping Stress Test
2: ##desertfoxps@earthlink.net
3: ##
4: ## This is my first script, so it isn't as good as it could be,
5: ## but its still pretty solid.
6: ##
7: ## The purpose is simply to ping a host with larger and larger
8: ## pings until it fails. It can be used to stress test any device
9: ## that accepts ICMP, for fragment DOS. Relevant information is
10: ## dumped into a log file named after the host.
11: ##
12: ## An unmodified PING.EXE is required for Windows users (as Microsoft
13: ## modified PING.EXE so that it cannot send large buffers), I don't know
14: ## if *nix's PING.EXE will work /shrug.
15:
16: use strict;
17: my ($size,$RAW,@INFO,$TIME,$host,$fails);
18:
19: $fails = 0; #Zero the var
20: $size = 0; #Zero the var, of change to resume tests
21: $host = '10.10.10.1'; #IP address of test subject
22:
23:
24: while ($size = $size + 1) { #Increment buffer size
25: open (DATA,"ssping -n 1 -l $size -w 1000 $host |"); #Call ping (I use SSPING.EXE
26: @INFO = <DATA>;
27: $RAW = join "", @INFO;
28: $RAW =~ /time[<|=](.....)/gm; #Grab latency
29: $TIME = $1;
30: if ($RAW =~ /Request/gs) { #Search for Request (as in Request timed out)
31:
32: open (DATA,"ssping -n 1 -l $size -w 2000 $host |"); #Double check the host
33: @INFO = <DATA>;
34: $RAW = join "", @INFO;
35: if ($RAW =~ /Request/gs) { #Yup, it bit off to much
36: print "$host Failed at $size\n";
37: open LOG, ">>$host.log" or die $!;
38: print LOG "$host Failed at $size\n";
39: close LOG;
40: $fails = $fails + 1; #Increment fails
41:
42: if ($fails>=20) { #If to many consecutive fails...
43: print "Encountered Maximum amount of consecutive fails.\n";
44: exit;
45: }
46: goto END;
47:
48: }
49: $fails = 0; #Zero the fails, as this was only a hiccup in traffic
50: print "$size $TIME *Hiccup*\n"; #Host responded to second attempt
51: goto END;
52:
53: }
54: print "$size $TIME\n"; #Print good reply to screen
55: END:
56: } In reply to Ping Stress Test by foxops
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |