mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Remove unused and newly unrequired arguments to the pcap check functions (which
replace the old callbacks) in scripts
This commit is contained in:
@@ -269,7 +269,7 @@ end
|
|||||||
|
|
||||||
--- pcap check function
|
--- pcap check function
|
||||||
-- @return destination ip address, the ip protocol and icmp type
|
-- @return destination ip address, the ip protocol and icmp type
|
||||||
local function check (size, layer2, layer3)
|
local function check (layer3)
|
||||||
local ip = packet.Packet:new(layer3, layer3:len())
|
local ip = packet.Packet:new(layer3, layer3:len())
|
||||||
return bin.pack('ACC', ip.ip_bin_dst, ip.ip_p, ip.icmp_type)
|
return bin.pack('ACC', ip.ip_bin_dst, ip.ip_p, ip.icmp_type)
|
||||||
end
|
end
|
||||||
@@ -309,10 +309,10 @@ action = function(host)
|
|||||||
while retry < MAX_RETRIES do
|
while retry < MAX_RETRIES do
|
||||||
try(sock:ip_send(pkt.buf))
|
try(sock:ip_send(pkt.buf))
|
||||||
|
|
||||||
local status, length, layer2, layer3 = pcap:pcap_receive();
|
local status, length, _, layer3 = pcap:pcap_receive();
|
||||||
local test = bin.pack('ACC', pkt.ip_bin_src, packet.IPPROTO_ICMP, ICMP_TIME_EXCEEDED);
|
local test = bin.pack('ACC', pkt.ip_bin_src, packet.IPPROTO_ICMP, ICMP_TIME_EXCEEDED);
|
||||||
while status and test ~= check(length, layer2, layer3) do
|
while status and test ~= check(layer3) do
|
||||||
status, length, layer2, layer3 = pcap:pcap_receive();
|
status, length, _, layer3 = pcap:pcap_receive();
|
||||||
end
|
end
|
||||||
|
|
||||||
if status then
|
if status then
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ local NUMPROBES = 6
|
|||||||
|
|
||||||
--- Pcap check function
|
--- Pcap check function
|
||||||
-- @return Destination and source IP addresses and TCP ports
|
-- @return Destination and source IP addresses and TCP ports
|
||||||
local function check (size, layer2, layer3)
|
local check = function(layer3)
|
||||||
local ip = packet.Packet:new(layer3, layer3:len())
|
local ip = packet.Packet:new(layer3, layer3:len())
|
||||||
return bin.pack('AA=S=S', ip.ip_bin_dst, ip.ip_bin_src, ip.tcp_dport, ip.tcp_sport)
|
return bin.pack('AA=S=S', ip.ip_bin_dst, ip.ip_bin_src, ip.tcp_dport, ip.tcp_sport)
|
||||||
end
|
end
|
||||||
@@ -231,10 +231,10 @@ action = function(host)
|
|||||||
while i <= NUMPROBES do
|
while i <= NUMPROBES do
|
||||||
try(sock:ip_send(tcp.buf))
|
try(sock:ip_send(tcp.buf))
|
||||||
|
|
||||||
local status, len, layer2, layer3 = pcap:pcap_receive()
|
local status, len, _, layer3 = pcap:pcap_receive()
|
||||||
local test = bin.pack('AA=S=S', tcp.ip_bin_src, tcp.ip_bin_dst, tcp.tcp_sport, tcp.tcp_dport)
|
local test = bin.pack('AA=S=S', tcp.ip_bin_src, tcp.ip_bin_dst, tcp.tcp_sport, tcp.tcp_dport)
|
||||||
while status and test ~= check(len, layer2, layer3) do
|
while status and test ~= check(layer3) do
|
||||||
status, len, layer2, layer3 = pcap:pcap_receive()
|
status, len, _, layer3 = pcap:pcap_receive()
|
||||||
end
|
end
|
||||||
|
|
||||||
if status then
|
if status then
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ end
|
|||||||
|
|
||||||
-- This is all we can use since we can get various protocols back from
|
-- This is all we can use since we can get various protocols back from
|
||||||
-- different hosts
|
-- different hosts
|
||||||
local function check (size, layer2, layer3)
|
local check = function(layer3)
|
||||||
local ip = packet.Packet:new(layer3, layer3:len())
|
local ip = packet.Packet:new(layer3, layer3:len())
|
||||||
return bin.pack('A', ip.ip_bin_dst)
|
return bin.pack('A', ip.ip_bin_dst)
|
||||||
end
|
end
|
||||||
@@ -338,9 +338,9 @@ action = function(host)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local test = bin.pack('A', pkt.ip_bin_src)
|
local test = bin.pack('A', pkt.ip_bin_src)
|
||||||
local status, length, layer2, layer3 = pcap:pcap_receive()
|
local status, length, _, layer3 = pcap:pcap_receive()
|
||||||
while status and test ~= check(length, layer2, layer3) do
|
while status and test ~= check(layer3) do
|
||||||
status, length, layer2, layer3 = pcap:pcap_receive()
|
status, length, _, layer3 = pcap:pcap_receive()
|
||||||
end
|
end
|
||||||
|
|
||||||
if status then
|
if status then
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ end
|
|||||||
|
|
||||||
--- Pcap check
|
--- Pcap check
|
||||||
-- @return Destination and source IP addresses and TCP ports
|
-- @return Destination and source IP addresses and TCP ports
|
||||||
local function check (size, layer2, layer3)
|
local check = function(layer3)
|
||||||
local ip = packet.Packet:new(layer3, layer3:len())
|
local ip = packet.Packet:new(layer3, layer3:len())
|
||||||
return bin.pack('AA=S=S', ip.ip_bin_dst, ip.ip_bin_src, ip.tcp_dport, ip.tcp_sport)
|
return bin.pack('AA=S=S', ip.ip_bin_dst, ip.ip_bin_src, ip.tcp_dport, ip.tcp_sport)
|
||||||
end
|
end
|
||||||
@@ -459,9 +459,9 @@ action = function(host)
|
|||||||
stats[j].sent = stats[j].sent + 1
|
stats[j].sent = stats[j].sent + 1
|
||||||
|
|
||||||
local test = bin.pack('AA=S=S', tcp.ip_bin_src, tcp.ip_bin_dst, tcp.tcp_sport, tcp.tcp_dport)
|
local test = bin.pack('AA=S=S', tcp.ip_bin_src, tcp.ip_bin_dst, tcp.tcp_sport, tcp.tcp_dport)
|
||||||
local status, length, layer2, layer3, stop = pcap:pcap_receive()
|
local status, length, _, layer3, stop = pcap:pcap_receive()
|
||||||
while status and test ~= check(length, layer2, layer3) do
|
while status and test ~= check(layer3) do
|
||||||
status, length, layer2, layer3, stop = pcap:pcap_receive()
|
status, length, _, layer3, stop = pcap:pcap_receive()
|
||||||
end
|
end
|
||||||
|
|
||||||
if not stop then
|
if not stop then
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ hostrule = function(host)
|
|||||||
nmap.get_interface_link(host.interface) == 'ethernet'
|
nmap.get_interface_link(host.interface) == 'ethernet'
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check (packetsz, layer2, layer3)
|
local function check (layer2)
|
||||||
return string.sub(layer2, 0, 12)
|
return string.sub(layer2, 0, 12)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ do_test = function(dnet, pcap, host, test)
|
|||||||
pcap:set_timeout(100)
|
pcap:set_timeout(100)
|
||||||
local test = host.mac_addr_src .. host.mac_addr
|
local test = host.mac_addr_src .. host.mac_addr
|
||||||
status, length, layer2, layer3 = pcap:pcap_receive()
|
status, length, layer2, layer3 = pcap:pcap_receive()
|
||||||
while status and test ~= check(length, layer2, layer3) do
|
while status and test ~= check(layer2) do
|
||||||
status, length, layer2, layer3 = pcap:pcap_receive()
|
status, length, layer2, layer3 = pcap:pcap_receive()
|
||||||
end
|
end
|
||||||
until status ~= true
|
until status ~= true
|
||||||
@@ -52,7 +52,7 @@ do_test = function(dnet, pcap, host, test)
|
|||||||
|
|
||||||
local test = host.mac_addr_src .. host.mac_addr
|
local test = host.mac_addr_src .. host.mac_addr
|
||||||
status, length, layer2, layer3 = pcap:pcap_receive()
|
status, length, layer2, layer3 = pcap:pcap_receive()
|
||||||
while status and test ~= check(length, layer2, layer3) do
|
while status and test ~= check(layer2) do
|
||||||
status, length, layer2, layer3 = pcap:pcap_receive()
|
status, length, layer2, layer3 = pcap:pcap_receive()
|
||||||
end
|
end
|
||||||
if status == true then
|
if status == true then
|
||||||
|
|||||||
Reference in New Issue
Block a user