Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: [nmap-svn] r27349 - in nmap: . nselib scripts
From: Patrick Donnelly <batrick () batbytes com>
Date: Tue, 6 Dec 2011 19:06:57 -0500

On Tue, Dec 6, 2011 at 6:47 PM, Patrik Karlsson <patrik () cqure net> wrote:


On Wed, Dec 7, 2011 at 12:21 AM, Patrick Donnelly <batrick () batbytes com>
wrote:

Some standard Lua idiom suggestions below for the httpspider.lua library:

On Tue, Dec 6, 2011 at 5:47 PM,  <commit-mailer () insecure org> wrote:
Added: nmap/nselib/httpspider.lua
[...]
+module(... or "httpspider", package.seeall)
+
+require 'http'
+
+local LIBRARY_NAME = "httpspider"

You can also use _PACKAGE which is set by module [1] instead of
LIBRARY_NAME. Also, the '... or "httpspider"' idiom is something silly
I encouraged a long time ago. In the future it will probably be a hard
coded value when we switch to Lua 5.2.  (Feel free to stop doing it.)


so, it would be module('httpspider', package.seeall) instead?
The _PACKAGE alternative doesn't seem to work, maybe I'm doing something
wrong.

Sorry I meant _NAME. In any case, I regret suggesting it because
module is disappearing in 5.2. Just keep LIBRARY_NAME.

+               -- pull links from the queue until we get a valid one
+               local url
+               repeat
+                       url = self.urlqueue:getNext()
+               until( not(url) or not(self.processed[tostring(url)]) )

url remains in scope in the until terminating expression. You can do
instead:

+               -- pull links from the queue until we get a valid one
+               repeat
+                       local url = self.urlqueue:getNext()
+               until( not(url) or not(self.processed[tostring(url)]) )


the url variable is used further down in the code, outside of the repeat
loop.
i'm guessing this won't work then?

Right. I should have checked.

-- 
- Patrick Donnelly
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault