2008-07-22 19:37:05 +00:00
|
|
|
##
|
2008-10-23 02:43:21 +00:00
|
|
|
# $Id$
|
2008-07-22 19:37:05 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2008-07-22 19:37:05 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2008-07-22 19:37:05 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
2009-07-17 20:36:40 +00:00
|
|
|
require 'racket'
|
2008-07-22 19:37:05 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2008-07-22 19:37:05 +00:00
|
|
|
|
2010-01-26 06:38:41 +00:00
|
|
|
include Msf::Exploit::Capture
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Auxiliary::Scanner
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2008-07-22 19:37:05 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Simple IP Spoofing Tester',
|
2008-10-23 02:43:21 +00:00
|
|
|
'Version' => '$Revision$',
|
2008-07-22 19:37:05 +00:00
|
|
|
'Description' => 'Simple IP Spoofing Tester',
|
|
|
|
'Author' => 'hdm',
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2010-01-26 21:37:40 +00:00
|
|
|
|
2010-01-27 19:00:21 +00:00
|
|
|
begin
|
|
|
|
require 'pcaprub'
|
|
|
|
@@havepcap = true
|
|
|
|
rescue ::LoadError
|
|
|
|
@@havepcap = false
|
|
|
|
end
|
|
|
|
|
|
|
|
deregister_options('FILTER','PCAPFILE')
|
|
|
|
|
2008-07-22 19:37:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
2010-01-27 19:00:21 +00:00
|
|
|
open_pcap
|
2009-07-17 20:36:40 +00:00
|
|
|
n = Racket::Racket.new
|
|
|
|
|
2009-12-29 23:32:50 +00:00
|
|
|
n.l3 = Racket::L3::IPv4.new
|
2009-07-17 20:36:40 +00:00
|
|
|
n.l3.src_ip = ip
|
|
|
|
n.l3.dst_ip = ip
|
|
|
|
n.l3.protocol = 17
|
|
|
|
n.l3.id = 0xdead
|
|
|
|
n.l3.ttl = 255
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-12-29 23:32:50 +00:00
|
|
|
n.l4 = Racket::L4::UDP.new
|
2009-07-17 20:36:40 +00:00
|
|
|
n.l4.src_port = 53
|
|
|
|
n.l4.dst_port = 53
|
|
|
|
n.l4.payload = "HELLO WORLD"
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
n.l4.fix!(n.l3.src_ip, n.l3.dst_ip)
|
|
|
|
|
2009-07-17 20:36:40 +00:00
|
|
|
buff = n.pack
|
2010-01-26 06:38:41 +00:00
|
|
|
ret = send(ip,buff)
|
|
|
|
if ret == :done
|
|
|
|
print_good("#{ip}: Sent a packet to #{ip} from #{ip}")
|
|
|
|
else
|
|
|
|
print_error("#{ip}: Packet not sent. Check permissions & interface.")
|
|
|
|
end
|
2010-01-27 19:00:21 +00:00
|
|
|
close_pcap
|
2010-01-26 06:38:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def send(ip,buff)
|
|
|
|
begin
|
2010-01-27 19:00:21 +00:00
|
|
|
capture_sendto(buff, ip)
|
2010-01-26 06:38:41 +00:00
|
|
|
rescue RuntimeError => e
|
|
|
|
return :error
|
|
|
|
end
|
|
|
|
return :done
|
2008-07-22 19:37:05 +00:00
|
|
|
end
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-07-17 20:36:40 +00:00
|
|
|
end
|