The capture mixin is now working again (with scruby)
git-svn-id: file:///home/svn/framework3/trunk@5352 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
09532a9bd1
commit
9d2abb9287
|
@ -28,7 +28,7 @@ module Exploit::Capture
|
|||
|
||||
|
||||
begin
|
||||
require 'Pcaprub'
|
||||
require 'pcaprub'
|
||||
@pcaprub_loaded = true
|
||||
rescue ::Exception => e
|
||||
@pcaprub_loaded = false
|
||||
|
@ -127,7 +127,17 @@ module Exploit::Capture
|
|||
end
|
||||
|
||||
def each_packet
|
||||
|
||||
return if not self.capture
|
||||
capture.each do |packet|
|
||||
|
||||
dec = Scruby.linklayer_dissector(capture.datalink, packet)
|
||||
|
||||
if(dec)
|
||||
break if not yield(true, dec)
|
||||
else
|
||||
break if not yield(false, packet)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
attr_accessor :capture
|
||||
|
|
|
@ -42,12 +42,22 @@ class Auxiliary::Test::TestPcap < Msf::Auxiliary
|
|||
print_status("Opening the network interface...")
|
||||
open_pcap()
|
||||
print_status("Sniffing HTTP requests...")
|
||||
capture.each do |pkt|
|
||||
next if not pkt.tcp?
|
||||
next if not pkt.tcp_data
|
||||
if (pkt.tcp_data =~ /^GET\s+([^\s]+)\s+HTTP/)
|
||||
each_packet() do |decoded, pkt|
|
||||
data = ''
|
||||
|
||||
if(not decoded)
|
||||
data = pkt.to_s
|
||||
else
|
||||
if(pkt.has_layer(Scruby::TCP))
|
||||
data = pkt.last_layer.to_net
|
||||
end
|
||||
end
|
||||
|
||||
if (data =~ /GET\s+([^\s]+)\s+HTTP/smi)
|
||||
print_status("GET #{$1}")
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue