1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-31 20:09:02 +00:00

Improved and changed the make_buffer function.

It now returns the line as its first argument always, otherwise nil, errmsg

I updated scripts that use make_buffer.

When Lua 5.2 comes out, we may be able to use a function I've added
called stdnse.lines (commented for now). It cannot be used yet because
we cannot yield inside generic for loop. The function is built for
generic for loops. It will work as such:
for line in stdnse.lines(socket) do
  ...
end
This commit is contained in:
batrick
2008-06-20 13:50:50 +00:00
parent dffb1d9423
commit 0bc91f9db2
2 changed files with 26 additions and 63 deletions

View File

@@ -69,8 +69,6 @@ end
action = function(host, port)
local status = 0
local line = ""
local sd = nmap.new_socket()
local curr_nick = random_nick()
local sver, shost, susers, sservers, schans, sircops, slusers, slservers, sup, serr
@@ -121,8 +119,8 @@ action = function(host, port)
buf = stdnse.make_buffer(sd, "\r?\n")
while true do
status, line = buf()
if (not status) then break end
local line = buf()
if (not line) then break end
-- This one lets us know we've connected, pre-PONGed, and got a NICK
s, e, t = nmap.registry.ircserverinfo_375:exec(line, 0, 0)