Re: [Plugins-writers] working with nulls :)

From: Renaud Deraison (deraison@private)
Date: Wed Sep 27 2006 - 08:04:28 PDT


On Sep 27, 2006, at 10:59 AM, Douglas Nordwall wrote:

> So, on to my next "make the scans cleaner" project.
>
> How would one deal with snmp coming back with something like:
>
> 9.1.1.13.0 = Hex-STRING: 00 00 00 00 00 00 00 00 00 00 00
>
> It's not a null, from near as I can tell... that is, isnull(var[1])  
> and isnull(string(var[1])) both are not true. doing a string(var 
> [1]) gives:
> ..........
>


> it displays 10 periods which are not the ascii values (an artifact  
> of the terminal perhaps?). I can get the length of the string  
> (yay!) but am leery of just matching on a length (although,  
> honestly, in this case, it's probably not gong to return any false  
> negatives). How might one go about matching that?

The easiest way would be to convert it to an hex string :



str = hexstr(data);
if ( str == "0000000000000000000000" ) do_stuff();


Alternatively, you can also do :

if ( data == raw_string(0,0,0,0,0,0,0,0,0,0,0) ) do_stuff();


I tend to find the former a bit more readable.


				-- Renaud
_______________________________________________
Plugins-writers mailing list
Plugins-writers@private
http://mail.nessus.org/mailman/listinfo/plugins-writers



This archive was generated by hypermail 2.1.3 : Wed Sep 27 2006 - 08:05:46 PDT