Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove vLAN tags for DHCP discover script #2819

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion scripts/broadcast-dhcp-discover.nse
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,14 @@ local function dhcp_listener(sock, iface, macaddr, options, timeout, xid, result
local now = start_time
while( now - start_time < timeout ) do
sock:set_timeout(timeout - (now - start_time))
local status, _, _, data = sock:pcap_receive()
local status, _, l2_data, data = sock:pcap_receive()

if ( status ) then
-- do we have a vlan tag to be removed?
local f = packet.Frame:new( l2_data )
if ( 0x8100 == f.ether_type and 4 <= #data ) then
data = string.sub( data, 5, -1)
end
local p = packet.Packet:new( data, #data )
if ( p and p.udp_dport ) then
local data = data:sub(p.udp_offset + 9)
Expand Down