1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-01 11:09:07 +00:00

Applied patch to ip-forwarding.nse from Daniel Miller that fixes bug that would

incorrectly detect hosts as having IP forwarding enabled, allthough they did
not. [Daniel Miller]
This commit is contained in:
patrik
2012-05-01 19:09:58 +00:00
parent 7f12d63392
commit 2b2f42200e

View File

@@ -43,12 +43,23 @@ local ipops = require('ipOps')
local tab = require('tab')
local packet = require('packet')
local function format_mac(mac)
local octets
octets = {}
for _, v in ipairs({ string.byte(mac, 1, #mac) }) do
octets[#octets + 1] = string.format("%02x", v)
end
return stdnse.strjoin(":", octets)
end
icmpEchoRequest = function(ifname, host, addr)
local iface = nmap.get_interface_info(ifname)
local dnet, pcap = nmap.new_dnet(), nmap.new_socket()
pcap:set_timeout(5000)
pcap:pcap_open(iface.device, 128, false, ("icmp and ( icmp[0] = 0 or icmp[0] = 5 ) and dst %s"):format(iface.address))
pcap:pcap_open(iface.device, 128, false, ("ether src %s and icmp and ( icmp[0] = 0 or icmp[0] = 5 ) and dst %s"):format(format_mac(host.mac_addr), iface.address))
dnet:ethernet_open(iface.device)
local probe = packet.Frame:new()