Re: [Plugins-writers] converting hex to ascii

From: Renaud Deraison (deraison@private)
Date: Wed Mar 10 2004 - 04:01:10 PST

  • Next message: Crow, Owen: "RE: [Plugins-writers] windows_asn1_vuln_ntlm.nasl false negative on NT4.0"

    On Wed, Mar 10, 2004 at 09:02:35AM +0100, Michel Arboi wrote:
    > dave@private writes:
    > 
    > > I'm working with a string created with hexstr(). I've done some work
    > > on the hex values, now I want to convert back to ASCII.
    > 
    > hex2raw
    
    Yes, it's hex2raw() :
    
    include("misc_func.inc");
    
    x = "4e6573737573";
    s = hex2raw(s:x);
    
    In _theory_ using single quoted strings is acceptable :
    
    x = '\x4e\x65\x73\x73\x75\x73';
    
    But in older versions of NASL (pre 2.0.7 if I recall correctly), the
    parser _hates_ null terminated strings, so the following :
    
    x = '\x4e\x00\x65';
    
    will actually only be equal to '\x4e'. This has been fixed in newest
    releases though.
    
    				-- Renaud
    _______________________________________________
    Plugins-writers mailing list
    Plugins-writers@private
    http://mail.nessus.org/mailman/listinfo/plugins-writers
    



    This archive was generated by hypermail 2b30 : Wed Mar 10 2004 - 04:03:01 PST