From d7fa0ec6693b9782c0c1f83262c2cb5c7130ffc8 Mon Sep 17 00:00:00 2001 From: James Lee Date: Tue, 17 Mar 2015 17:36:45 -0500 Subject: [PATCH] Let IPAddr#hton do the calculating --- lib/msf/core/exploit/capture.rb | 2 +- modules/auxiliary/spoof/nbns/nbns_response.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/msf/core/exploit/capture.rb b/lib/msf/core/exploit/capture.rb index f080fc2ba2..0d494ec42a 100644 --- a/lib/msf/core/exploit/capture.rb +++ b/lib/msf/core/exploit/capture.rb @@ -251,7 +251,7 @@ module Msf def inject_reply(proto=:udp, pcap=self.capture) # Defaults to ~2 seconds to = (datastore['TIMEOUT'] * 4) / 1000.0 - raise RuntimeError, "Could not access the capture process (remember to open_pcap first!)" if not pcap + raise RuntimeError, "Could not access the capture process (remember to open_pcap first!)" if not pcap begin ::Timeout.timeout(to) do pcap.each do |r| diff --git a/modules/auxiliary/spoof/nbns/nbns_response.rb b/modules/auxiliary/spoof/nbns/nbns_response.rb index 7d9216a443..84a2f1afe6 100644 --- a/modules/auxiliary/spoof/nbns/nbns_response.rb +++ b/modules/auxiliary/spoof/nbns/nbns_response.rb @@ -57,7 +57,7 @@ class Metasploit3 < Msf::Auxiliary def dispatch_request(packet, rhost, src_port) rhost = ::IPAddr.new(rhost) - # `recvfrom` (on Linux at least) will give us an ipv6/ipv4 mapped + # `recvfrom` (on Linux at least) will give us an ipv6/ipv4 mapped # addr like "::ffff:192.168.0.1" when the interface we're listening # on has an IPv6 address. Convert it to just the v4 addr if rhost.ipv4_mapped? @@ -88,7 +88,7 @@ class Metasploit3 < Msf::Auxiliary return unless nbnsq_decodedname =~ /#{datastore['REGEX']}/i - vprint_good("#{rhost.ljust 16} nbns - #{nbnsq_decodedname} matches regex, responding with #{datastore["SPOOFIP"]}") + vprint_good("#{rhost.ljust 16} nbns - #{nbnsq_decodedname} matches regex, responding with #{spoof}") if datastore['DEBUG'] print_status("transid: #{nbnsq_transid.unpack('H4')}") @@ -118,7 +118,7 @@ class Metasploit3 < Msf::Auxiliary "\x00\x04\x93\xe0" + # TTL = a long ass time "\x00\x06" + # Datalength = 6 "\x00\x00" + # Flags B-node, unique = whatever that means - datastore['SPOOFIP'].split('.').collect(&:to_i).pack('C*') + spoof.hton pkt = PacketFu::UDPPacket.new pkt.ip_saddr = Rex::Socket.source_address(rhost)