Skip to content

Instantly share code, notes, and snippets.

@rom1504

rom1504/diablo.py Secret

Last active Feb 1, 2020
Embed
What would you like to do?
diablo
from struct import *
s = 'ff 50 65 00 00 00 00 00 fd 75 51 5a 15 04 00 00 00 e4 88 77 e9 2b d2 01 49 58 38 36 76 65 72 31 2e 6d 70 71 00 41 3d 33 38 34 35 35 38 31 36 33 34 20 42 3d 38 38 30 38 32 33 35 38 30 20 43 3d 31 33 36 33 39 33 37 31 30 33 20 34 20 41 3d 41 2d 53 20 42 3d 42 2d 43 20 43 3d 43 2d 41 20 41 3d 41 2d 42 00'
b = bytes.fromhex(s)
print(b)
def read_string(buffer):
s = ''
i = 0
while 1:
c = buffer[i]
if c == 0:
return s, (i+1)
s += chr(c)
i+=1
return '', 0
def read_headers(buffer):
(ff,id,size)=unpack_from('<BBH', buffer)
return (ff,id,size)
def read_sid_auth_info(buffer):
(logon_type, server_token, udp_value, mpq_filetime) = unpack_from('<IIIQ', buffer)
buffer=buffer[calcsize('<IIIQ'):]
(mpq_filename, offset) = read_string(buffer)
(valuestring, offset) = read_string(buffer[offset:])
return logon_type, server_token, udp_value, mpq_filetime, mpq_filename, valuestring
print(read_headers(b))
print(read_sid_auth_info(b[4:]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment