Movatterモバイル変換


[0]ホーム

URL:


Home page logo
nmap-dev logo

Nmap Developmentmailing list archives

PreviousBy DateNext
PreviousBy ThreadNext

Re: [NSE Script] IRC Server Info


From: doug () hcsw org
Date: Mon, 25 Jun 2007 16:49:04 -0700

Hi Eddie!On Mon, Jun 25, 2007 at 10:12:18AM +0100 or thereabouts, Eddie Bell wrote:
Cool script but have you thought about adding your make_bufferfunction to nselib/stdnse.lua so all scripts have access to it? Ithink they would find it useful.
Good idea. Done. Here are the new docs:-- Generic buffer implementation using lexical closures---- Pass make_buffer a socket and a separator lua pattern [1].---- Returns a function bound to your provided socket with behaviour identical-- to receive_lines() except it will return AT LEAST ONE [2] and AT MOST ONE-- "line" at a time.---- [1] Use the pattern "\r?\n" for regular newlines-- [2] Except where there is trailing "left over" data not terminated by a--     pattern (in which case you get the data anyways)-- [3] The data is returned WITHOUT the pattern/newline on the end.-- [4] Empty "lines" are returned as "". With the pattern in [1] you will--     receive a "" for each newline in the stream.-- [5] Errors/EOFs are delayed until all "lines" have been processed.Here is how it's used:require("stdnse")sd = nmap.new_socket()sd:connect(host.ip, port.number)my_buffer = stdnse.make_buffer(sd, "\r?\n")  while true do    status, line = my_buffer()    ...
I was playing with pcre and couldn't get it to work, nice to know itwas broken and not me :)
Ya, the PCRE interface was broken but thanks to gdb it was easy to trackdown the problems. Probably the biggest problem IS STILL THE DOCUMENTATIONthough! Here is the bare minimum info for using it (and make sure you areusing the soc07 branch with the PCRE fixes):my_regex = pcre.new("my PCRE pattern", 0, "C")my_regex:exec(string_to_match_against, 0, 0)If you want to use any regexp modifiers you must look up the PCRE bitmasksin the C header file, OR them, and use the numeric constant instead of oneof those 0s. Also, changing the locale is completely useless for our regexps(where you want to match OCTETS) and it's easy to forget the "C" parameter soI think it should be removed.Given the current docs, nobody can be blamed for not getting PCRE working. :)Best,Doug

Attachment:signature.asc
Description: Digital signature

_______________________________________________Sent through the nmap-dev mailing listhttp://cgi.insecure.org/mailman/listinfo/nmap-devArchived athttp://SecLists.Org

PreviousBy DateNext
PreviousBy ThreadNext

Current thread:


[8]ページ先頭

©2009-2025 Movatter.jp