add pcap filter option to pcap_log plugin
git-svn-id: file:///home/svn/framework3/trunk@6223 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
cd9ad0f08d
commit
3587f730d1
|
@ -25,7 +25,7 @@ class Plugin::PcapLog < Msf::Plugin
|
||||||
end
|
end
|
||||||
def usage
|
def usage
|
||||||
print_error("No interface given")
|
print_error("No interface given")
|
||||||
print ("usage: load #{self.name} iface=<iface> [path=<logpath>] [prefix=<logprefix>]\n")
|
print ("usage: load #{self.name} iface=<iface> [path=<logpath>] [prefix=<logprefix>] [filter=<filter>]\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(framework, opts)
|
def initialize(framework, opts)
|
||||||
|
@ -33,6 +33,7 @@ class Plugin::PcapLog < Msf::Plugin
|
||||||
log_path = opts['path'] || "/tmp"
|
log_path = opts['path'] || "/tmp"
|
||||||
log_prefix = opts['prefix'] || "msf3-session_"
|
log_prefix = opts['prefix'] || "msf3-session_"
|
||||||
iface = opts['iface'] || nil
|
iface = opts['iface'] || nil
|
||||||
|
filter = opts['filter']
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'pcaprub'
|
require 'pcaprub'
|
||||||
|
@ -53,7 +54,7 @@ class Plugin::PcapLog < Msf::Plugin
|
||||||
@fname += "%04d-%02d-%02d_%02d-%02d-%02d.pcap" % [t.year, t.month, t.mday, t.hour, t.min, t.sec]
|
@fname += "%04d-%02d-%02d_%02d-%02d-%02d.pcap" % [t.year, t.month, t.mday, t.hour, t.min, t.sec]
|
||||||
print_status("Logs in #{@fname}")
|
print_status("Logs in #{@fname}")
|
||||||
|
|
||||||
stream = PacketFu::Capture.new(:iface => iface, :timeout => 0, :start => true)
|
stream = PacketFu::Capture.new(:iface => iface, :timeout => 0, :start => true, :filter => filter)
|
||||||
PacketFu::Write.a2f(:filename => @fname, :arr => [])
|
PacketFu::Write.a2f(:filename => @fname, :arr => [])
|
||||||
@capture_file = File.open(@fname, "ab")
|
@capture_file = File.open(@fname, "ab")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue