def flags(flag_str): "" res = '' res = res + '%s\n\n' % ntlmutils.str2hex(flag_str) flags = ntlmutils.bytes2int(flag_str[0:2]) res = res + '%s # flags\n' % (ntlmutils.int2hex_str(flags)) res = res + 'Binary:\nlayout 87654321 87654321\n' res = res + ' %s %s\n' % (ntlmutils.byte2bin_str(flag_str[1]), ntlmutils.byte2bin_str(flag_str[0])) flags2 = ntlmutils.bytes2int(flag_str[2:4]) res = res + '%s # more flags ???\n' % (ntlmutils.int2hex_str(flags2)) res = res + 'Binary:\nlayout 87654321 87654321\n' res = res + ' %s %s\n' % (ntlmutils.byte2bin_str(flag_str[3]), ntlmutils.byte2bin_str(flag_str[2])) #res = res + '%s # delimiter ???\n' % m_hex[(cur + 2) * 2: (cur + 4) * 2] return res
def item(item_str): "" item = {} res = '' item['len1'] = ntlmutils.bytes2int(item_str[0:2]) item['len2'] = ntlmutils.bytes2int(item_str[2:4]) item['offset'] = ntlmutils.bytes2int(item_str[4:6]) res = res + '%s\n\nlength (two times), offset, delimiter\n' % (ntlmutils.str2hex(item_str)) res = res + '%s decimal: %3d # length 1\n' % (ntlmutils.int2hex_str(item['len1']), item['len1']) res = res + '%s decimal: %3d # length 2\n' % (ntlmutils.int2hex_str(item['len2']), item['len2']) res = res + '%s decimal: %3d # offset\n' % (ntlmutils.int2hex_str(item['offset']), item['offset']) res = res + '%s # delimiter (two zeros)\n\n' % ntlmutils.str2hex(item_str[-2:]) item['string'] = res return item
def flags(flag_str): "" res = '' res = res + '%s\n\n' % ntlmutils.str2hex(flag_str) flags = ntlmutils.bytes2int(flag_str[0:2]) res = res + '%s # flags\n' % ( ntlmutils.int2hex_str(flags)) res = res + 'Binary:\nlayout 87654321 87654321\n' res = res + ' %s %s\n' % (ntlmutils.byte2bin_str( flag_str[1]), ntlmutils.byte2bin_str(flag_str[0])) flags2 = ntlmutils.bytes2int(flag_str[2:4]) res = res + '%s # more flags ???\n' % ( ntlmutils.int2hex_str(flags2)) res = res + 'Binary:\nlayout 87654321 87654321\n' res = res + ' %s %s\n' % (ntlmutils.byte2bin_str( flag_str[3]), ntlmutils.byte2bin_str(flag_str[2])) #res = res + '%s # delimiter ???\n' % m_hex[(cur + 2) * 2: (cur + 4) * 2] return res
def item(item_str): "" item = {} res = '' item['len1'] = ntlmutils.bytes2int(item_str[0:2]) item['len2'] = ntlmutils.bytes2int(item_str[2:4]) item['offset'] = ntlmutils.bytes2int(item_str[4:6]) res = res + '%s\n\nlength (two times), offset, delimiter\n' % ( ntlmutils.str2hex(item_str)) res = res + '%s decimal: %3d # length 1\n' % (ntlmutils.int2hex_str( item['len1']), item['len1']) res = res + '%s decimal: %3d # length 2\n' % (ntlmutils.int2hex_str( item['len2']), item['len2']) res = res + '%s decimal: %3d # offset\n' % (ntlmutils.int2hex_str( item['offset']), item['offset']) res = res + '%s # delimiter (two zeros)\n\n' % ntlmutils.str2hex( item_str[-2:]) item['string'] = res return item