mirror of
https://github.com/nmap/nmap.git
synced 2025-12-17 13:09:02 +00:00
Proofread and update documentation of match.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
--- Buffered network I/O helper functions.
|
--- Buffered network I/O helper functions.
|
||||||
-- \n\n
|
--
|
||||||
-- The functions in this module can be used for delimiting data received
|
-- The functions in this module can be used for delimiting data received by the
|
||||||
-- by the receive_buf function in the Network I/O API.
|
-- <code>nmap.receive_buf()</code> function in the Network I/O API (which see).
|
||||||
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
|
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
|
||||||
|
|
||||||
module(... or "match", package.seeall)
|
module(... or "match", package.seeall)
|
||||||
@@ -10,19 +10,21 @@ require "pcre"
|
|||||||
--various functions for use with nse's nsock:receive_buf - function
|
--various functions for use with nse's nsock:receive_buf - function
|
||||||
|
|
||||||
-- e.g.
|
-- e.g.
|
||||||
-- sock:receivebuf(regex("myregexpattern")) - does a match using pcre- regular-
|
-- sock:receive_buf(regex("myregexpattern")) - does a match using pcre- regular-
|
||||||
-- - expressions
|
-- - expressions
|
||||||
-- sock:receivebuf(numbytes(80)) - is the buffered version of
|
-- sock:receive_buf(numbytes(80)) - is the buffered version of
|
||||||
-- sock:receive_bytes(80) - i.e. it returns
|
-- sock:receive_bytes(80) - i.e. it returns
|
||||||
-- exactly 80 bytes and no more
|
-- exactly 80 bytes and no more
|
||||||
|
|
||||||
--- Return a function that allows delimiting with a regular expression.
|
--- Return a function that allows delimiting with a regular expression.
|
||||||
-- \n\n
|
--
|
||||||
-- This function is a wrapper around the exec function of the pcre
|
-- This function is a wrapper around <code>pcre.exec</code>. Its purpose is to
|
||||||
-- library. It purpose is to give script developers the ability to use
|
-- give script developers the ability to use regular expressions for delimiting
|
||||||
-- regular expressions for delimiting instead of Lua's string patterns.
|
-- instead of Lua's string patterns.
|
||||||
-- @param The regex.
|
-- @param pattern The regex.
|
||||||
-- @usage sock:receivebuf(regex("myregexpattern"))
|
-- @usage sock:receive_buf(match.regex("myregexpattern"))
|
||||||
|
-- @see nmap.receive_buf
|
||||||
|
-- @see pcre.exec
|
||||||
regex = function(pattern)
|
regex = function(pattern)
|
||||||
local r = pcre.new(pattern, 0,"C")
|
local r = pcre.new(pattern, 0,"C")
|
||||||
|
|
||||||
@@ -33,14 +35,14 @@ regex = function(pattern)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Return a function that allows delimiting at a certain number of bytes.
|
--- Return a function that allows delimiting at a certain number of bytes.
|
||||||
-- \n\n
|
--
|
||||||
-- This function can be used to get a buffered version of
|
-- This function can be used to get a buffered version of
|
||||||
-- sockobj:receive_bytes(n) in case a script requires more than one
|
-- <code>sock:receive_bytes(n)</code> in case a script requires more than one
|
||||||
-- fixed-size chunk, as the unbuffered version may return more bytes
|
-- fixed-size chunk, as the unbuffered version may return more bytes than
|
||||||
-- than requested and thus would require you to do the parsing on your
|
-- requested and thus would require you to do the parsing on your own.
|
||||||
-- own.
|
|
||||||
-- @param num Number of bytes.
|
-- @param num Number of bytes.
|
||||||
-- @usage sock:receivebuf(numbytes(80))
|
-- @usage sock:receive_buf(match.numbytes(80))
|
||||||
|
-- @see nmap.receive_buf
|
||||||
numbytes = function(num)
|
numbytes = function(num)
|
||||||
local n = num
|
local n = num
|
||||||
return function(buf)
|
return function(buf)
|
||||||
|
|||||||
Reference in New Issue
Block a user