Fixes #4558. Since the arp spoofer is the only module that actually uses lookupaddrs, don't require every other pcaprub module to check for it.

git-svn-id: file:///home/svn/framework3/trunk@12672 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Tod Beardsley 2011-05-20 14:26:24 +00:00
parent a9d429d09a
commit 520aa7d01c
2 changed files with 12 additions and 5 deletions

View File

@ -376,15 +376,19 @@ module Exploit::Capture
if not @pcaprub_loaded
print_status("The Pcaprub module is not available: #{@pcaprub_error}")
raise RuntimeError, "Pcaprub not available"
#Those methods have been added later
elsif (not Pcap.respond_to? "lookupaddrs")
print_status("The Pcaprub module is not up-to-date")
raise RuntimeError, "The Pcaprub module is missing some functions"
else
true
end
end
# lookupaddr is not available in pcaprub 0.9.2 and prior,
# which is going to be installed in a lot of places. Modules
# which want it should check explicitly for it. TODO: Bug upstream
# to release it for real in 0.9.3
def lookupaddr_implemented?
@pcaprub_loaded and Pcap.respond_to?(:lookupaddrs)
end
def lookupnet
check_pcaprub_loaded
dev = datastore['INTERFACE'] || ::Pcap.lookupdev

View File

@ -109,7 +109,10 @@ class Metasploit3 < Msf::Auxiliary
lsmac = datastore['LOCALSMAC'] || @smac
raise RuntimeError ,'Local Source Mac is not in correct format' unless is_mac?(lsmac)
sip = datastore['LOCALSIP'] || Pcap.lookupaddrs(@interface)[0]
sip = datastore['LOCALSIP']
if lookupaddr_implemented?
sip ||= Pcap.lookupaddrs(@interface)[0]
end
raise "LOCALIP is not an ipv4 address" unless is_ipv4? sip
dhosts_range = Rex::Socket::RangeWalker.new(datastore['DHOSTS'])