mirror of
https://github.com/nmap/nmap.git
synced 2026-06-19 23:17:48 +00:00
Added default values for the index and length parameters if no value is supplied in the Packet:raw(index,length) function of the nselib/packet.lua library
This commit is contained in:
parent
5f3b402cf7
commit
c08ca750fa
1 changed files with 7 additions and 3 deletions
|
|
@ -199,11 +199,15 @@ function Packet:u32(index)
|
|||
return u32(self.buf, index)
|
||||
end
|
||||
--- Return part of the packet contents as a byte string.
|
||||
-- @param index The beginning of the part of the packet to extract.
|
||||
-- @param length The length of the part of the packet to extract.
|
||||
-- @param index The beginning of the part of the packet to extract. The index
|
||||
-- is 0-based. If omitted the default value is 0 (begining of the string)
|
||||
-- @param length The length of the part of the packet to extract. If omitted
|
||||
-- the remaining contents from index to the end of the string are returned.
|
||||
-- @return A string.
|
||||
function Packet:raw(index, length)
|
||||
return string.char(string.byte(self.buf, index+1, index+1+length-1))
|
||||
if not index then index = 0 end
|
||||
if not length then length = #self.buf-index
|
||||
return string.char(string.byte(self.buf, index+1, index+1+length-1))
|
||||
end
|
||||
|
||||
--- Set an 8-bit integer at a 0-based byte offset in the packet.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue