Need Help

Paul McGuire ptmcg at austin.rr.com
Tue Jul 10 15:01:56 EDT 2007


On Jul 10, 10:28 am, pycraze <dennis.vargh... at wipro.com> wrote:
> Hi ,
>
>       I need some info about the following snippet  .
>
> -----------------------------------------------------------
>   protocol = 'NTLMSSP\000'    #name
>     type = '\001\000'               #type 1
>     zeros1 = '\000\000'
>
>        zeros2 = '\000\000\000\000\000\000\000\000\000'
>     zeros3 = '\000\000\000\000\000\000\000\000\000\000\000'
>     smthg1 = '0\000\000\000\000\000\000\000'    # something with
> chr(48) length?
>     smthg2 = '0\000\000\000'                    # something with
> chr(48) lenght?
>
>       msg1 = protocol + type + zeros1 + flags + zeros2 + zeros3 +
> smthg1 + smthg2
>     msg1 = base64.encodestring(msg1)
>     msg1 = string.replace(msg1, '\012', '')
> -------------------------------------------------------
>
>        In the above code what does "
> 000\000\000\000\000\000\000\000\000 " signify ?  Which form of
> representation is this ?
>
>      This code is from the NTLM APS python code from sourceforge 0.98
> version .

I think redoing this code using the struct module would make the
behavior and intent clearer, rather than trying to encode binary data
directly into strings.

-- Paul




More information about the Python-list mailing list