1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Fix bitcoin-info displaying incorrect last block; add user agent output

This commit is contained in:
dmiller
2018-03-09 06:26:48 +00:00
parent dacb82f242
commit d0536a3bad
2 changed files with 7 additions and 2 deletions

View File

@@ -299,12 +299,14 @@ Response = {
-- Parses the raw data and builds the Version instance
parse = function(self)
local ra, sa, cmd, nodeid
local ra, sa, cmd, nodeid, pos
-- After 2012-02-20, version messages contain checksums
self.magic, cmd, self.len, self.checksum, self.ver_raw, self.service,
self.timestamp, ra, sa, nodeid,
self.subver, self.lastblock = string.unpack("<I4 c12 I4 I4 I4 I8 I8 c26 c26 c8 B I4", self.data)
pos = string.unpack("<I4 c12 I4 I4 I4 I8 I8 c26 c26 c8", self.data)
pos, self.user_agent = Util.decodeVarString(self.data, pos)
self.lastblock, pos = string.unpack("<I4", self.data, pos)
self.nodeid = stdnse.tohex(nodeid)
self.cmd = string.unpack("z", cmd)

View File

@@ -67,6 +67,9 @@ action = function(host, port)
result["Version"] = ver.ver
result["Node Id"] = ver.nodeid
result["Lastblock"] = ver.lastblock
if ver.user_agent ~= "" then
result["User Agent"] = ver.user_agent
end
return result
end