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

Minor code clean-up

This commit is contained in:
nnposter
2018-07-16 03:17:24 +00:00
parent ece05c34ee
commit cbb54f79a8

View File

@@ -232,12 +232,11 @@ Connection.methods.fill_buffer = function (self, data)
while true do
-- look for IAC (Interpret As Command)
local newpos = data:find('\255', oldpos)
local newpos = data:find('\255', oldpos, true)
if not newpos then break end
outbuf = outbuf .. data:sub(oldpos, newpos - 1)
local opttype = data:byte(newpos + 1)
local opt = data:byte(newpos + 2)
local opttype, opt = data:byte(newpos + 1, newpos + 2)
if opttype == 251 or opttype == 252 then
-- Telnet Will / Will Not
@@ -251,9 +250,7 @@ Connection.methods.fill_buffer = function (self, data)
opttype = 252
end
optbuf = optbuf .. string.char(255)
.. string.char(opttype)
.. string.char(opt)
optbuf = optbuf .. string.char(255, opttype, opt)
oldpos = newpos + 3
end