Add an example of how to break out of the capture loop

git-svn-id: file:///home/svn/framework3/trunk@8513 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
HD Moore 2010-02-16 01:32:25 +00:00
parent 48b7aec12d
commit 185ff610eb
1 changed files with 12 additions and 10 deletions

View File

@ -3,7 +3,7 @@
## ##
## ##
# This file is part of the Metasploit Framework and may be subject to # This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit # redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use. # Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/ # http://metasploit.com/framework/
@ -17,7 +17,7 @@ class Metasploit3 < Msf::Auxiliary
include Msf::Auxiliary::Report include Msf::Auxiliary::Report
include Msf::Exploit::Capture include Msf::Exploit::Capture
def initialize def initialize
super( super(
'Name' => 'Simple Network Capture Tester', 'Name' => 'Simple Network Capture Tester',
@ -29,7 +29,7 @@ class Metasploit3 < Msf::Auxiliary
[ [
[ 'Sniffer' ] [ 'Sniffer' ]
], ],
'PassiveActions' => 'PassiveActions' =>
[ [
'Sniffer' 'Sniffer'
], ],
@ -46,21 +46,23 @@ class Metasploit3 < Msf::Auxiliary
eth = Racket::L2::Ethernet.new(pkt) eth = Racket::L2::Ethernet.new(pkt)
next if not eth.ethertype == 0x0800 next if not eth.ethertype == 0x0800
ip = Racket::L3::IPv4.new(eth.payload) ip = Racket::L3::IPv4.new(eth.payload)
next if not ip.protocol == 6 next if not ip.protocol == 6
tcp = Racket::L4::TCP.new(ip.payload) tcp = Racket::L4::TCP.new(ip.payload)
next if !(tcp.payload and tcp.payload.length > 0) next if !(tcp.payload and tcp.payload.length > 0)
if (tcp.payload =~ /GET\s+([^\s]+)\s+HTTP/smi) if (tcp.payload =~ /GET\s+([^\s]+)\s+HTTP/smi)
print_status("GET #{$1}") url = $1
print_status("GET #{url}")
break if url =~ /StopCapture/
end end
true
end end
close_pcap() close_pcap()
print_status("Finished sniffing") print_status("Finished sniffing")
end end
end end