Switch capture mixin from scruby to packetfu
git-svn-id: file:///home/svn/framework3/trunk@5729 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
929ba19cc7
commit
6df3d7f54a
|
@ -27,6 +27,8 @@ module Exploit::Capture
|
|||
)
|
||||
|
||||
|
||||
require 'packetfu'
|
||||
|
||||
begin
|
||||
require 'pcaprub'
|
||||
@pcaprub_loaded = true
|
||||
|
@ -34,7 +36,7 @@ module Exploit::Capture
|
|||
@pcaprub_loaded = false
|
||||
@pcaprub_error = e
|
||||
end
|
||||
|
||||
|
||||
begin
|
||||
require 'scruby'
|
||||
@scruby_loaded = true
|
||||
|
@ -94,21 +96,6 @@ module Exploit::Capture
|
|||
self.capture = nil
|
||||
end
|
||||
|
||||
# Extend this to support a wider range of link layer types
|
||||
def capture_find_linklayer(pkt)
|
||||
return if not pkt
|
||||
raw = pkt.raw_data
|
||||
off = 0
|
||||
|
||||
case pkt.datalink
|
||||
when 119
|
||||
off = 144
|
||||
else
|
||||
end
|
||||
|
||||
raw[off, raw.length - off]
|
||||
end
|
||||
|
||||
def capture_extract_ies(raw)
|
||||
set = {}
|
||||
ret = 0
|
||||
|
@ -127,32 +114,12 @@ module Exploit::Capture
|
|||
end
|
||||
|
||||
def each_packet
|
||||
return if not self.capture
|
||||
|
||||
# print_status("Link type is #{capture.datalink}")
|
||||
|
||||
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
|
||||
return if not self.capture
|
||||
self.capture.each do |pkt|
|
||||
yield(PacketFu::Packet.parse(pkt))
|
||||
end
|
||||
end
|
||||
|
||||
def find_layers(pkt, cls)
|
||||
res = []
|
||||
pkt.layers_list.each do |layer|
|
||||
if layer.class == cls
|
||||
res << layer
|
||||
end
|
||||
end
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
attr_accessor :capture
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue