Need Help

P

pycraze

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 .
 
M

Marc 'BlackJack' Rintsch

In the above code what does "
000\000\000\000\000\000\000\000\000 " signify ? Which form of
representation is this ?

\nnn is the octal representation of a byte. The snippet you've shown
contains mostly zero bytes:

In [10]: a = '\000'

In [11]: a
Out[11]: '\x00'

In [12]: ord(a)
Out[12]: 0

Ciao,
Marc 'BlackJack' Rintsch
 
P

Paul McGuire

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top