mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 08:46:45 +00:00
Remove bin.lua from a couple more scripts
This commit is contained in:
parent
1f00f2fa05
commit
3f7f084cd1
2 changed files with 9 additions and 8 deletions
|
|
@ -1,4 +1,3 @@
|
|||
local bin = require "bin"
|
||||
local brute = require "brute"
|
||||
local creds = require "creds"
|
||||
local nmap = require "nmap"
|
||||
|
|
@ -52,7 +51,7 @@ Driver = {
|
|||
local response, magic, size, _
|
||||
local loginstr = cassandra.loginstr (username, password)
|
||||
|
||||
local status, err = self.socket:send(bin.pack(">I",string.len(loginstr)))
|
||||
local status, err = self.socket:send(string.pack(">I4", #loginstr))
|
||||
local combo = username..":"..password
|
||||
if ( not(status) ) then
|
||||
local err = brute.Error:new( "couldn't send length:"..combo )
|
||||
|
|
@ -67,14 +66,14 @@ Driver = {
|
|||
return false, err
|
||||
end
|
||||
|
||||
status, response = self.socket:receive_bytes(22)
|
||||
local status, response = self.socket:receive_bytes(22)
|
||||
if ( not(status) ) then
|
||||
local err = brute.Error:new( "couldn't receive login reply size: "..combo )
|
||||
err:setAbort( true )
|
||||
return false, err
|
||||
end
|
||||
|
||||
_, size = bin.unpack(">I", response, 1)
|
||||
local size = string.unpack(">I4", response, 1)
|
||||
|
||||
magic = string.sub(response,18,22)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
local bin = require "bin"
|
||||
local dns = require "dns"
|
||||
local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
|
|
@ -61,13 +60,16 @@ local function rr_filter(pktRR, label)
|
|||
for _, rec in ipairs(pktRR, label) do
|
||||
if ( rec[label] and 0 < #rec.data ) then
|
||||
if ( dns.types.OPT == rec.dtype ) then
|
||||
local pos, _, len = bin.unpack(">SS", rec.data)
|
||||
if #rec.data < 4 then
|
||||
return false, "Failed to decode NSID"
|
||||
end
|
||||
local _, len, pos = string.unpack(">I2 I2", rec.data)
|
||||
if ( len ~= #rec.data - pos + 1 ) then
|
||||
return false, "Failed to decode NSID"
|
||||
end
|
||||
return true, select(2, bin.unpack("A" .. len, rec.data, pos))
|
||||
return true, string.unpack("c" .. len, rec.data, pos)
|
||||
else
|
||||
return true, select(2, bin.unpack("p", rec.data))
|
||||
return true, string.unpack(">s1", rec.data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue