Nmap Development mailing list archives
Re: [NSE][PATCH] string_ext library
From: David Fifield <david () bamsoftware com>
Date: Fri, 3 Oct 2008 10:03:11 -0600
On Fri, Oct 03, 2008 at 12:54:06PM +0200, Sven Klemm wrote:
Currently there is already a tohex() function in stdnse.lua which only works for numbers. It's probably best to rename my function to tohex() since this is more in line with the lua function names. Do you think we should put this function into its own module or do you think it should be added to stdnse?I would actually recommend extending the tohex() function to handle strings or numbers. Perhaps the other functions could be extended in the same way as well.I've attached a patch which extends stdnse.tohex() to support strings and numbers and the new formatting options and adjusts the documentation accordingly.
I think this is a great idea. I was surprised at this difference in behavior: stdnse.tohex("abc",{separator=":",group=2}) => "6162:63" stdnse.tohex(123456,{separator=":",group=2}) => "1:e240" When the argument is a string, grouping is done left to right, and when it is a number grouping is done right to left. I expected it to go right to left in both cases, but maybe there's a good reason to do it otherwise? David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Re: [NSE][PATCH] string_ext library Sven Klemm (Oct 01)
- Re: [NSE][PATCH] string_ext library Patrick Donnelly (Oct 02)
- Re: [NSE][PATCH] string_ext library Sven Klemm (Oct 03)
- Re: [NSE][PATCH] string_ext library Sven Klemm (Oct 03)
- Re: [NSE][PATCH] string_ext library David Fifield (Oct 03)
- Re: [NSE][PATCH] string_ext library Sven Klemm (Oct 03)
- Re: [NSE][PATCH] string_ext library Sven Klemm (Oct 03)
- Re: [NSE][PATCH] string_ext library Patrick Donnelly (Oct 02)