mirror of
https://github.com/nmap/nmap.git
synced 2026-01-06 22:49:02 +00:00
Merge branch 'nse-lua53'
Lua 5.3 adds several awesome features of particular interest to nmap including bitwise operators and integers, a utf8 library, and standard binary pack/unpack functions. In addition to adding Lua 5.3, this branch changes: o Complete removal of the NSE bit library (in C), It has been replaced with a new Lua library wrapping Lua 5.3's bit-wise operators. o Complete removal of the NSE bin library (in C). It has been replaced with a new Lua library wrapping Lua 5.3's string.pack|unpack functions. o The bin.pack "B" format specifier (which has never worked correctly) is unimplemented. All scripts/libraries which use it have been updated. Most usage of this option was to allow string based bit-wise operations which are no longer necessary now that Lua 5.3 provides integers and bit-wise operators. o The base32/base64 libraries have been reimplemented using Lua 5.3's new bitwise operators. (This library was the main user of the bin.pack "B" format specifier.) o A new "bits" library has been added for common bit hacks. Currently only has a reverse function. Thanks to David Fifield, Daniel Miller, Jacek Wielemborek, and Paulino Calderon for testing this branch.
This commit is contained in:
@@ -1102,8 +1102,11 @@ Packet.QueryResponseAck = {
|
||||
if ( len > 0 ) then
|
||||
while( len > 0) do
|
||||
local mask_part
|
||||
pos, mask_part = bin.unpack("B", data, pos)
|
||||
mask = mask .. mask_part:reverse()
|
||||
pos, mask_part = bin.unpack("C", data, pos)
|
||||
mask_part = stdnse.tobinary(bits.reverse(mask_part))
|
||||
assert(#mask_part <= 8)
|
||||
mask_part = ("0"):rep(8-#mask_part)..mask_part
|
||||
mask = mask .. mask_part
|
||||
len = len - 1
|
||||
end
|
||||
pos = pos + 4
|
||||
@@ -1130,8 +1133,11 @@ Packet.QueryResponseAck = {
|
||||
len = cols
|
||||
while( len > 0 ) do
|
||||
local mask_part
|
||||
pos, mask_part = bin.unpack("B", data, pos)
|
||||
mask = mask .. mask_part:reverse()
|
||||
pos, mask_part = bin.unpack("C", data, pos)
|
||||
mask_part = stdnse.tobinary(bits.reverse(mask_part))
|
||||
assert(#mask_part <= 8)
|
||||
mask_part = ("0"):rep(8-#mask_part)..mask_part
|
||||
mask = mask .. mask_part
|
||||
len = len - 8
|
||||
end
|
||||
pos, marker = bin.unpack("C", data, pos)
|
||||
|
||||
Reference in New Issue
Block a user