Library match
Buffered network I/O helper functions.
The functions in this module can be used for delimiting data received by the
nmap.receive_buf function in the Network I/O API (which see).
Copyright© Same as Nmap--See http://nmap.org/book/man-legal.html
Source: http://nmap.org/svn/nselib/match.lua
Functions
| numbytes (num) |
Return a function that allows delimiting at a certain number of bytes. |
| regex (pattern) |
Return a function that allows delimiting with a regular expression. |
Functions
- numbytes (num)
-
Return a function that allows delimiting at a certain number of bytes.
This function can be used to get a buffered version of
sock:receive_bytes(n)in case a script requires more than one fixed-size chunk, as the unbuffered version may return more bytes than requested and thus would require you to do the parsing on your own.Parameters
- num: Number of bytes.
Usage:
sock:receive_buf(match.numbytes(80))
See also:
- regex (pattern)
-
Return a function that allows delimiting with a regular expression.
This function is a wrapper around
pcre.exec. Its purpose is to give script developers the ability to use regular expressions for delimiting instead of Lua's string patterns.Parameters
- pattern: The regex.
Usage:
sock:receive_buf(match.regex("myregexpattern"))See also:


