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