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
unstable
HD Moore 2007-05-04 02:56:35 +00:00
parent 4b42797768
commit 88d3193020
3 changed files with 4 additions and 73 deletions

View File

@ -239,7 +239,6 @@ class Exploit < Msf::Module
# Networks
require 'msf/core/exploit/lorcon'
require 'msf/core/exploit/pcap'
require 'msf/core/exploit/capture'
#

View File

@ -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

View File

@ -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