Nmap Development mailing list archives

Re: Some hints for nmap scripts


From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Mon, 8 Dec 2008 18:46:56 -0700

Hi Jah,

On Tue, Dec 2, 2008 at 11:51 AM, jah <jah () zadkiel plus com> wrote:
On 02/12/2008 17:44, Patrick Donnelly wrote:
This is correct. I misread your earlier post taking to mean that --[[
]] commenting should be --[[ --]]. The --[[ ]]-- works because the
final two hyphens are interpreted as a single line comment (which of
course is empty as there is nothing between the hyphens and the
newline).
I expected that improperly closing a multiline comment in this way would
mean that the comment would extend to the end of the file, but it
clearly doesn't.

The multi-line comment was properly closed. The next item parsed is a
single line comment. Remember whitespace carry no significance in Lua
except to separate some tokens during lexical analysis.

]] is all that's required to close such a comment.

Correct.

It all starts to get rather messy if a commented block happens to
contain a multiline string  foo=[[  ]]  which results in a script
compilation error: nesting of [[...]] is deprecated near '['

You can use an n level long string to resolve this [1]. A comment can
use multi-lines strings like so:

--[==[
]==]

[1] http://www.lua.org/manual/5.1/manual.html#2.1
See the paragraph beginning with: "Literal strings can also be defined
using a long format enclosed by long brackets."

Cheers,

-- 
-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant

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


Current thread: