mirror of
https://github.com/nmap/nmap.git
synced 2026-01-18 20:29:02 +00:00
Replace instances of bin.pack('A', x), which is equivalent to tostring(x), and a no-op on strings
This commit is contained in:
@@ -136,7 +136,7 @@ Request = {
|
||||
local header = bin.pack("<IAI", magic, cmd, len)
|
||||
|
||||
-- After 2012-02-20, version messages require checksums
|
||||
header = header .. bin.pack("A", checksum:sub(1,4))
|
||||
header = header .. checksum:sub(1,4)
|
||||
|
||||
return header .. payload
|
||||
end,
|
||||
|
||||
@@ -295,8 +295,7 @@ Packet.GIOP.get = {
|
||||
local pad = 0
|
||||
|
||||
for i=1, #self.sc do
|
||||
local tmp = tostring( self.sc[i])
|
||||
data = data .. bin.pack("A", tmp )
|
||||
data = data .. tostring( self.sc[i])
|
||||
end
|
||||
|
||||
data = data .. bin.pack( ">ICCCCIIIAIA", self.id, self.resp_expected, pad, pad, pad,
|
||||
@@ -347,8 +346,7 @@ Packet.GIOP._is_a =
|
||||
UNKNOWN, #self.key_addr, self.key_addr, #self.op, self.op, UNKNOWN2, #self.sc )
|
||||
|
||||
for i=1, #self.sc do
|
||||
local tmp = tostring( self.sc[i])
|
||||
data = data .. bin.pack("A", tmp )
|
||||
data = data .. tostring( self.sc[i])
|
||||
end
|
||||
|
||||
data = data .. bin.pack(">IA", #TYPE_ID, TYPE_ID)
|
||||
@@ -403,8 +401,7 @@ Packet.GIOP.list =
|
||||
#self.op, self.op, RESERVED, RESERVED, UNKNOWN2, #self.sc )
|
||||
|
||||
for i=1, #self.sc do
|
||||
local tmp = tostring( self.sc[i])
|
||||
data = data .. bin.pack("A", tmp )
|
||||
data = data .. tostring( self.sc[i])
|
||||
end
|
||||
|
||||
data = data .. bin.pack(">II", UNKNOWN3, self.how_many )
|
||||
|
||||
@@ -203,7 +203,7 @@ function encodeLDAPOp( appno, isConstructed, data )
|
||||
local encoded_str = ""
|
||||
local asn1_type = asn1.BERtoInt( asn1.BERCLASS.Application, isConstructed, appno )
|
||||
|
||||
encoded_str = encode( { _ldaptype = bin.pack("A", string.format("%X", asn1_type)), data } )
|
||||
encoded_str = encode( { _ldaptype = string.format("%X", asn1_type), data } )
|
||||
return encoded_str
|
||||
end
|
||||
|
||||
@@ -512,7 +512,7 @@ function createFilter( filter )
|
||||
filter_str = filter_str .. obj .. val
|
||||
|
||||
end
|
||||
return encode( { _ldaptype=bin.pack("A", string.format("%X", asn1_type)), filter_str } )
|
||||
return encode( { _ldaptype=string.format("%X", asn1_type), filter_str } )
|
||||
end
|
||||
|
||||
--- Converts a search result as received from searchRequest to a "result" table
|
||||
|
||||
@@ -448,7 +448,7 @@ PPPoE = {
|
||||
header = PPPoE.Header:new(PPPoE.Code.PADI),
|
||||
tags = tags or {
|
||||
PPPoE.Tag:new(PPPoE.TagType.SERVICE_NAME),
|
||||
PPPoE.Tag:new(PPPoE.TagType.HOST_UNIQUE, bin.pack("A", c))
|
||||
PPPoE.Tag:new(PPPoE.TagType.HOST_UNIQUE, c)
|
||||
}
|
||||
}
|
||||
setmetatable(o, self)
|
||||
@@ -950,7 +950,7 @@ Helper = {
|
||||
local auth_proposed = config_req.options:getById(LCP.ConfigOption.AUTH_PROTO)
|
||||
|
||||
if ( auth_proposed.raw ~= auth_data ) then
|
||||
local options = { LCP.ConfigOption:new(LCP.ConfigOption.AUTH_PROTO, nil, bin.pack("A", auth_data)) }
|
||||
local options = { LCP.ConfigOption:new(LCP.ConfigOption.AUTH_PROTO, nil, auth_data) }
|
||||
local lcp_req = LCP.ConfigNak:new(self.identifier, options)
|
||||
local sess_req = PPPoE.SessionData:new(self.session, tostring(lcp_req))
|
||||
local status, resp = self.comm:exch(sess_req)
|
||||
|
||||
@@ -1945,9 +1945,8 @@ NFS = {
|
||||
return false, "FsStat: No filehandle received"
|
||||
end
|
||||
|
||||
data = bin.pack("A", file_handle)
|
||||
packet = comm:EncodePacket(nil, NFS.Procedure[comm.version].FSSTAT,
|
||||
{type = Portmap.AuthType.UNIX}, data)
|
||||
{type = Portmap.AuthType.UNIX}, file_handle)
|
||||
|
||||
if (not(comm:SendPacket(packet))) then
|
||||
return false, "FsStat: Failed to send data"
|
||||
|
||||
@@ -154,7 +154,7 @@ end
|
||||
-- different hosts
|
||||
local check = function(layer3)
|
||||
local ip = packet.Packet:new(layer3, layer3:len())
|
||||
return bin.pack('A', ip.ip_bin_dst)
|
||||
return ip.ip_bin_dst
|
||||
end
|
||||
|
||||
-- Updates a packet's info and calculates checksum
|
||||
@@ -341,7 +341,7 @@ action = function(host)
|
||||
end
|
||||
end
|
||||
|
||||
local test = bin.pack('A', pkt.ip_bin_src)
|
||||
local test = pkt.ip_bin_src
|
||||
local status, length, _, layer3 = pcap:pcap_receive()
|
||||
while status and test ~= check(layer3) do
|
||||
status, length, _, layer3 = pcap:pcap_receive()
|
||||
|
||||
Reference in New Issue
Block a user