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
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# 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
|
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
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
2010-01-26 06:38:41 +00:00
|
|
|
print_status("#{ip}: Sending a packet to #{ip} from #{ip}")
|
2008-07-22 19:37:05 +00:00
|
|
|
|
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
|
|
|
|
|
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"
|
|
|
|
|
|
|
|
n.l4.fix!(n.l3.src_ip, n.l3.dst_ip)
|
|
|
|
|
|
|
|
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
|
|
|
|
end
|
|
|
|
|
|
|
|
def send(ip,buff)
|
|
|
|
begin
|
|
|
|
open_pcap
|
|
|
|
dst_mac,src_mac = lookup_eth
|
|
|
|
inject_eth(:payload => buff,
|
|
|
|
:eth_daddr => dst_mac,
|
|
|
|
:eth_saddr => src_mac
|
|
|
|
)
|
|
|
|
close_pcap
|
|
|
|
rescue RuntimeError => e
|
|
|
|
return :error
|
|
|
|
end
|
|
|
|
return :done
|
2008-07-22 19:37:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2009-07-17 20:36:40 +00:00
|
|
|
end
|