From 88d3193020ece8a70d9594407f628be970c97a95 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Fri, 4 May 2007 02:56:35 +0000 Subject: [PATCH] Removed the old pcap mixin, replaced with Capture, updated the test_pcap module git-svn-id: file:///home/svn/framework3/trunk@4860 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/exploit.rb | 1 - lib/msf/core/exploit/pcap.rb | 68 ---------------------------------- modules/auxiliary/test_pcap.rb | 8 ++-- 3 files changed, 4 insertions(+), 73 deletions(-) delete mode 100644 lib/msf/core/exploit/pcap.rb diff --git a/lib/msf/core/exploit.rb b/lib/msf/core/exploit.rb index c0277e402a..b901aa41a4 100644 --- a/lib/msf/core/exploit.rb +++ b/lib/msf/core/exploit.rb @@ -239,7 +239,6 @@ class Exploit < Msf::Module # Networks require 'msf/core/exploit/lorcon' - require 'msf/core/exploit/pcap' require 'msf/core/exploit/capture' # diff --git a/lib/msf/core/exploit/pcap.rb b/lib/msf/core/exploit/pcap.rb deleted file mode 100644 index 677300f940..0000000000 --- a/lib/msf/core/exploit/pcap.rb +++ /dev/null @@ -1,68 +0,0 @@ -module Msf - -### -# -# This module provides methods for receiving packets through the PcapX module -# -### - -module Exploit::Pcap - - # - # Initializes an instance of an exploit module that receives raw packets - # - - def initialize(info = {}) - super - - register_options( - [ - OptString.new('INTERFACE', [true, 'The name of the interface to sniff', 'eth0']) - ], Msf::Exploit::Pcap - ) - - begin - require 'PcapX' - @pcapx_loaded = true - rescue ::Exception => e - @pcapx_loaded = false - @pcapx_error = e - end - - end - - # - # Opens a network device for capture - # - def pcap_open_live(device = 'eth0', snaplen=65535, promisc=true) - - if (not @pcapx_loaded) - print_status("The PcapX module is not available: #{@pcapx_error.to_s}") - raise RuntimeError, "PcapX not available" - return - end - - self.capture = ::PcapX::Capture.open_live(device, snaplen.to_i, promisc) - end - - # - # Sets the pcap filter - # - def pcap_setfilter(filter='') - return if not self.capture - self.capture.setfilter(filter) - end - - # - # Opens a network device based on datastore - # - def pcap_open(filter='') - pcap_open_live(datastore['INTERFACE']) - pcap_setfilter(filter) - end - - - attr_accessor :capture -end - -end diff --git a/modules/auxiliary/test_pcap.rb b/modules/auxiliary/test_pcap.rb index e6e0d5a03e..001b8ecad1 100644 --- a/modules/auxiliary/test_pcap.rb +++ b/modules/auxiliary/test_pcap.rb @@ -1,5 +1,5 @@ ## -# $Id:$ +# $Id$ ## ## @@ -17,7 +17,7 @@ module Msf class Auxiliary::TestPcap < Msf::Auxiliary include Auxiliary::Report - include Msf::Exploit::Pcap + include Msf::Exploit::Capture def initialize super( @@ -40,8 +40,8 @@ class Auxiliary::TestPcap < Msf::Auxiliary def run print_status("Opening the network interface...") - pcap_open() - print_status("Sniffing packets...") + open_pcap() + print_status("Sniffing HTTP requests...") capture.each_packet do |pkt| next if not pkt.tcp? next if not pkt.tcp_data