Nmap Development mailing list archives

Re: Proposal for a small change in the packet.Packet:raw() function


From: Gorjan Petrovski <mogi57 () gmail com>
Date: Wed, 13 Jul 2011 11:24:17 +0200

The original function worked with 0-based arrays and I think it's
because the maps of network packets are 0-based.
http://nmap.org/book/tcpip-ref.html
Makes it easy to implement packet crafting that way. However, I feel
that we should update the NSEDoc in every function of the packet
library to note that it's 0-based if it isn't noted already.

Thanks,
Gorjan

On Tue, Jul 12, 2011 at 11:12 PM, Patrick Donnelly <batrick () batbytes com> wrote:
On Tue, Jul 12, 2011 at 11:59 AM, Gorjan Petrovski <mogi57 () gmail com> wrote:
Hi,

At a first glance of the packet library, it seems that Packet:raw() is
the main function for getting the contents of the Packet object. And
since not all users look at the code they wouldn't know to look for
Packet.buf to get the entire length of the packet. This is why I
propose that we make the index and length arguments optional. If a
user does not specify the index argument, it is supposed that index =
0. If the user doesn't supply the length argument, the default would
be the entire length of the packet.

Do I have permission to make these changes? Diff file included.

Does the packet library used 0-based indexing throughout? If so, then
please commit. Otherwise, I'd like this to be 1-based indexing as it
is in Lua.

--
- Patrick Donnelly




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


Current thread: