All IP packet objects now have the following attributes:
- ip_bin_src (binary src address)
- ip_bin_dst (binary dst address)
- ip_src (decimal-dotted string src address)
- ip_dst (decimal-dotted string dst address)
The ip6_src and ip6_dst attributes have therefore been renamed (ip_bin_src and
ip_bin_dst).
This patch also updates the scripts accordingly.
I do this just by passing the uncompressed names through nmap.resolve.
Before:
fe80:0000:0000:0000:0000:0000:0000:0001, 2001:0470:1f05:155e:0000:0000:0000:0003
After:
fe80::1, 2001:470:1f05:155e::3
Used this perl command:
$ # perl -pi -e 's/string\.len\((.*?)\)/#\1/g' *.lua
Also fixed one instance where the above command didn't correctly
translate the intended code (string.len(a .. b .. c)).
Often two (or more) scripts using the same library would
overwrite the globals each was using. This would result
in (at best) an error or (at worst) a deadlock.
The patch changes the global accesses to local.
with the struct (bin) library available:
function hextobin(str) return bin.pack("H", str) end
function bintohex(str) return bin.unpack("H", str) end
Also removed a commented copy that was in the sniffer-detect.nse script.
license" to "Same as Nmap--See http://nmap.org/book/man-legal.html" like
scripts commonly use. I added the field to some modules I know to be under the
Nmap license: bin, datafiles, dns, nmap, unpwdb. I left alone bin, bit, pcre,
and url, which come from outside sources.