1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-25 00:49:01 +00:00

Convert more bin.lua packings

This commit is contained in:
dmiller
2018-09-06 16:00:46 +00:00
parent 201ee75059
commit f62d39f801
7 changed files with 46 additions and 78 deletions

View File

@@ -10,11 +10,11 @@
--
local bin = require "bin"
local match = require "match"
local nmap = require "nmap"
local sasl = require "sasl"
local stdnse = require "stdnse"
local string = require "string"
local table = require "table"
_ENV = stdnse.module("membase", stdnse.seeall)
@@ -66,7 +66,7 @@ TAP = {
-- Converts the header to string
-- @return string containing the Header as string
__tostring = function(self)
return bin.pack(">CCSCCSIIL", self.magic, self.opcode, self.keylen,
return string.pack(">BB I2 BB I2 I4 I4 I8", self.magic, self.opcode, self.keylen,
self.extlen, self.data_type, self.vbucket, self.total_body,
self.opaque, self.CAS)
end,
@@ -172,9 +172,9 @@ TAP = {
return false, "Packet to short"
end
local pos
pos, self.magic, self.opcode, self.keylen, self.extlen,
self.magic, self.opcode, self.keylen, self.extlen,
self.data_type, self.status, self.total_body, self.opaque,
self.CAS = bin.unpack(">CCSCCSIIL", self.data)
self.BAI2 , pos = string.unpack(">BB I2 BB I2 I4 I4 I8", self.data)
return true
end