2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-05-04 02:56:35 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-02-16 01:32:25 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +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/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
2006-11-06 05:29:56 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2006-11-06 05:29:56 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2007-05-04 02:56:35 +00:00
|
|
|
include Msf::Exploit::Capture
|
2010-02-16 01:32:25 +00:00
|
|
|
|
2006-11-06 05:29:56 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Simple Network Capture Tester',
|
2007-02-18 00:10:39 +00:00
|
|
|
'Version' => '$Revision$',
|
2006-11-06 05:29:56 +00:00
|
|
|
'Description' => 'This module sniffs HTTP GET requests from the network',
|
|
|
|
'Author' => 'hdm',
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Actions' =>
|
|
|
|
[
|
2010-09-20 08:06:27 +00:00
|
|
|
[ 'Sniffer' ]
|
2006-11-06 05:29:56 +00:00
|
|
|
],
|
2010-02-16 01:32:25 +00:00
|
|
|
'PassiveActions' =>
|
2006-11-06 05:29:56 +00:00
|
|
|
[
|
|
|
|
'Sniffer'
|
|
|
|
],
|
|
|
|
'DefaultAction' => 'Sniffer'
|
|
|
|
)
|
2010-04-06 14:23:40 +00:00
|
|
|
|
|
|
|
deregister_options('RHOST')
|
2006-11-06 05:29:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
print_status("Opening the network interface...")
|
2007-05-04 02:56:35 +00:00
|
|
|
open_pcap()
|
2008-10-10 02:26:05 +00:00
|
|
|
|
2007-05-04 02:56:35 +00:00
|
|
|
print_status("Sniffing HTTP requests...")
|
2008-10-10 02:26:05 +00:00
|
|
|
each_packet() do |pkt|
|
2009-07-17 20:36:40 +00:00
|
|
|
|
2009-12-29 23:32:50 +00:00
|
|
|
eth = Racket::L2::Ethernet.new(pkt)
|
2009-07-17 20:36:40 +00:00
|
|
|
next if not eth.ethertype == 0x0800
|
2010-02-16 01:32:25 +00:00
|
|
|
|
2009-12-29 23:32:50 +00:00
|
|
|
ip = Racket::L3::IPv4.new(eth.payload)
|
2009-07-17 20:36:40 +00:00
|
|
|
next if not ip.protocol == 6
|
2010-02-16 01:32:25 +00:00
|
|
|
|
2009-12-29 23:32:50 +00:00
|
|
|
tcp = Racket::L4::TCP.new(ip.payload)
|
2009-10-25 17:18:23 +00:00
|
|
|
next if !(tcp.payload and tcp.payload.length > 0)
|
2010-02-16 01:32:25 +00:00
|
|
|
|
2009-07-17 20:36:40 +00:00
|
|
|
if (tcp.payload =~ /GET\s+([^\s]+)\s+HTTP/smi)
|
2010-02-16 01:32:25 +00:00
|
|
|
url = $1
|
|
|
|
print_status("GET #{url}")
|
|
|
|
break if url =~ /StopCapture/
|
2006-11-06 05:29:56 +00:00
|
|
|
end
|
2010-02-16 01:32:25 +00:00
|
|
|
|
2006-11-06 05:29:56 +00:00
|
|
|
end
|
2009-07-27 14:05:23 +00:00
|
|
|
close_pcap()
|
2008-10-10 02:26:05 +00:00
|
|
|
print_status("Finished sniffing")
|
2006-11-06 05:29:56 +00:00
|
|
|
end
|
2010-02-16 01:32:25 +00:00
|
|
|
|
2009-07-17 20:36:40 +00:00
|
|
|
end
|
2010-02-16 01:32:25 +00:00
|
|
|
|