From fa858e041bf4d2386fd5a953f2373a2b2034c95f Mon Sep 17 00:00:00 2001 From: kris Date: Sun, 19 Sep 2010 02:15:19 +0000 Subject: [PATCH] Remove unused and newly unrequired arguments to the pcap check functions (which replace the old callbacks) in scripts --- scripts/firewalk.nse | 8 ++++---- scripts/ipidseq.nse | 8 ++++---- scripts/path-mtu.nse | 8 ++++---- scripts/qscan.nse | 8 ++++---- scripts/sniffer-detect.nse | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/scripts/firewalk.nse b/scripts/firewalk.nse index 7874d18e2..fac6f0180 100644 --- a/scripts/firewalk.nse +++ b/scripts/firewalk.nse @@ -269,7 +269,7 @@ end --- pcap check function -- @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()) return bin.pack('ACC', ip.ip_bin_dst, ip.ip_p, ip.icmp_type) end @@ -309,10 +309,10 @@ action = function(host) while retry < MAX_RETRIES do 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); - while status and test ~= check(length, layer2, layer3) do - status, length, layer2, layer3 = pcap:pcap_receive(); + while status and test ~= check(layer3) do + status, length, _, layer3 = pcap:pcap_receive(); end if status then diff --git a/scripts/ipidseq.nse b/scripts/ipidseq.nse index b8dba5cf4..47a5b0cac 100644 --- a/scripts/ipidseq.nse +++ b/scripts/ipidseq.nse @@ -35,7 +35,7 @@ local NUMPROBES = 6 --- Pcap check function -- @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()) return bin.pack('AA=S=S', ip.ip_bin_dst, ip.ip_bin_src, ip.tcp_dport, ip.tcp_sport) end @@ -231,10 +231,10 @@ action = function(host) while i <= NUMPROBES do 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) - while status and test ~= check(len, layer2, layer3) do - status, len, layer2, layer3 = pcap:pcap_receive() + while status and test ~= check(layer3) do + status, len, _, layer3 = pcap:pcap_receive() end if status then diff --git a/scripts/path-mtu.nse b/scripts/path-mtu.nse index d8b713710..d3b3938b2 100644 --- a/scripts/path-mtu.nse +++ b/scripts/path-mtu.nse @@ -145,7 +145,7 @@ end -- This is all we can use since we can get various protocols back from -- different hosts -local function check (size, layer2, layer3) +local check = function(layer3) local ip = packet.Packet:new(layer3, layer3:len()) return bin.pack('A', ip.ip_bin_dst) end @@ -338,9 +338,9 @@ action = function(host) end local test = bin.pack('A', pkt.ip_bin_src) - local status, length, layer2, layer3 = pcap:pcap_receive() - while status and test ~= check(length, layer2, layer3) do - status, length, layer2, layer3 = pcap:pcap_receive() + local status, length, _, layer3 = pcap:pcap_receive() + while status and test ~= check(layer3) do + status, length, _, layer3 = pcap:pcap_receive() end if status then diff --git a/scripts/qscan.nse b/scripts/qscan.nse index f0d06f7ba..0596e775c 100644 --- a/scripts/qscan.nse +++ b/scripts/qscan.nse @@ -159,7 +159,7 @@ end --- Pcap check -- @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()) return bin.pack('AA=S=S', ip.ip_bin_dst, ip.ip_bin_src, ip.tcp_dport, ip.tcp_sport) end @@ -459,9 +459,9 @@ action = function(host) 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 status, length, layer2, layer3, stop = pcap:pcap_receive() - while status and test ~= check(length, layer2, layer3) do - status, length, layer2, layer3, stop = pcap:pcap_receive() + local status, length, _, layer3, stop = pcap:pcap_receive() + while status and test ~= check(layer3) do + status, length, _, layer3, stop = pcap:pcap_receive() end if not stop then diff --git a/scripts/sniffer-detect.nse b/scripts/sniffer-detect.nse index 94ed82944..c97ac3d88 100644 --- a/scripts/sniffer-detect.nse +++ b/scripts/sniffer-detect.nse @@ -24,7 +24,7 @@ hostrule = function(host) nmap.get_interface_link(host.interface) == 'ethernet' end -local function check (packetsz, layer2, layer3) +local function check (layer2) return string.sub(layer2, 0, 12) end @@ -42,7 +42,7 @@ do_test = function(dnet, pcap, host, test) pcap:set_timeout(100) local test = host.mac_addr_src .. host.mac_addr 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() end until status ~= true @@ -52,7 +52,7 @@ do_test = function(dnet, pcap, host, test) local test = host.mac_addr_src .. host.mac_addr 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() end if status == true then