From 0e04505232d9d5d4fb53476999953d055993b542 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Thu, 21 Oct 2010 04:43:54 +0000 Subject: [PATCH] Fixes #3027, a set of bugs introduced during the meterpreter posix work. git-svn-id: file:///home/svn/framework3/trunk@10773 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/session.rb | 2 +- lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb | 2 +- .../meterpreter/ui/console/command_dispatcher/sniffer.rb | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/msf/core/session.rb b/lib/msf/core/session.rb index eaeb693010..b8f982e3f4 100644 --- a/lib/msf/core/session.rb +++ b/lib/msf/core/session.rb @@ -116,7 +116,7 @@ module Session # Brief and to the point # def inspect - "#" + "#" # " Fixes highlighting end # diff --git a/lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb b/lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb index 0054212cca..843b68cfe0 100644 --- a/lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb +++ b/lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb @@ -51,7 +51,7 @@ class Sniffer < Extension request = Packet.create_request('sniffer_capture_start') request.add_tlv(TLV_TYPE_SNIFFER_INTERFACE_ID, intf.to_i) request.add_tlv(TLV_TYPE_SNIFFER_PACKET_COUNT, maxp.to_i) - request.add_tlv(TLV_TYPE_SNIFFER_ADDITIONAL_FILTER, filter) if filter.length + request.add_tlv(TLV_TYPE_SNIFFER_ADDITIONAL_FILTER, filter) if filter.length > 0 response = client.send_request(request) end diff --git a/lib/rex/post/meterpreter/ui/console/command_dispatcher/sniffer.rb b/lib/rex/post/meterpreter/ui/console/command_dispatcher/sniffer.rb index b7e5dc6b1f..51ca4aedce 100644 --- a/lib/rex/post/meterpreter/ui/console/command_dispatcher/sniffer.rb +++ b/lib/rex/post/meterpreter/ui/console/command_dispatcher/sniffer.rb @@ -56,16 +56,15 @@ class Console::CommandDispatcher::Sniffer end def cmd_sniffer_start(*args) - intf = args[0].to_i + intf = args.shift.to_i if (intf == 0) print_error("Usage: sniffer_start [interface-id] [packet-buffer (1-200000)] [bpf filter (posix meterpreter only)]") return end - maxp = args[1].to_i - maxp = 50000 if maxp == 0 - filter = args[2..-1].join(" ") + maxp = (args.shift || 50000).to_i + bpf = args.join(" ") - client.sniffer.capture_start(intf, maxp, filter) + client.sniffer.capture_start(intf, maxp, bpf) print_status("Capture started on interface #{intf} (#{maxp} packet buffer)") return true end