1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 20:51:30 +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 while true do
-- look for IAC (Interpret As Command) -- 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 if not newpos then break end
outbuf = outbuf .. data:sub(oldpos, newpos - 1) outbuf = outbuf .. data:sub(oldpos, newpos - 1)
local opttype = data:byte(newpos + 1) local opttype, opt = data:byte(newpos + 1, newpos + 2)
local opt = data:byte(newpos + 2)
if opttype == 251 or opttype == 252 then if opttype == 251 or opttype == 252 then
-- Telnet Will / Will Not -- Telnet Will / Will Not
@@ -251,9 +250,7 @@ Connection.methods.fill_buffer = function (self, data)
opttype = 252 opttype = 252
end end
optbuf = optbuf .. string.char(255) optbuf = optbuf .. string.char(255, opttype, opt)
.. string.char(opttype)
.. string.char(opt)
oldpos = newpos + 3 oldpos = newpos + 3
end end