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