1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Avoid hard-coded ethertypes

This commit is contained in:
nnposter
2025-06-06 19:06:09 +00:00
parent 7c4e1bf58d
commit c58eb84340
2 changed files with 3 additions and 2 deletions

View File

@@ -140,6 +140,7 @@ ETHER_TYPE_IPV6 = 0x86dd
ETHER_TYPE_PPPOE_DISCOVERY = 0x8863
ETHER_TYPE_PPPOE_SESSION = 0x8864
ETHER_TYPE_EAPOL = 0x888e
ETHER_TYPE_PROFINET = 0x8892
ETHER_TYPE_ATAOE = 0x88a2
----------------------------------------------------------------------------------------------------------------

View File

@@ -74,7 +74,7 @@ build_eth_frame= function(iface)
eth_packet.mac_dst = packet.mactobin(pn_dcp_multicast)
eth_packet.ether_type = 0x8892
eth_packet.ether_type = packet.ETHER_TYPE_PROFINET
-- pn-dcp request frame : [FrameID | ServiceID | ServiceType | Xid | ResponseDelay | DCPDataLength | Option | Suboption ]
eth_packet.buf = string.pack(">I2BBI4I2I2BBI2",
@@ -240,7 +240,7 @@ discoverThread = function(iface, to_ms, pn_dcp, devices)
local pcap_s = nmap.new_socket()
pcap_s:set_timeout(100)
dnet:ethernet_open(iface.device)
pcap_s:pcap_open(iface.device, 256, false, "ether proto 0x8892")
pcap_s:pcap_open(iface.device, 256, false, ("ether proto 0x%04x"):format(packet.ETHER_TYPE_PROFINET))
dnet:ethernet_send(pn_dcp) -- send the frame
dnet:ethernet_close(); -- close the sender