Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from struct import *
- import random
- import socket
- import sha
- import binascii
- import hashlib
- HOST = 'logonhg.gamefreedom.pl'
- PORT = 3724
- USERNAME = 'krzystar'
- PASSWORD = 'random_password'
- def strtoint(s):
- r = 0L
- for c in s:
- r = (r << 8) + ord(c)
- return r
- def inttostr(i):
- s = ''
- while i > 0:
- s = chr(i & 255) + s
- i = i >> 8
- return s
- def hash(s):
- return sha.new(s).digest()
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.connect((HOST, PORT))
- auth_logon = '\x00\x08' # cmd = auth logon challenge, error = 8
- auth_logon += pack('H', 30+len(USERNAME)) # packet length
- auth_logon += '\x57\x6f\x57\x00' # game = WoW
- auth_logon += '\x02\x04\x03\x9e\x21' # version = 2.4.3, build = 8606
- auth_logon += '\x36\x38\x78\x00\x6e\x69\x57\x00' # platform = x86, OS = Win
- auth_logon += '\x42\x47\x6e\x65\x3c\x00\x00\x00' # country = enGB, timezone bias = 60
- auth_logon += socket.inet_aton(sock.getsockname()[0]) # local IP address
- auth_logon += pack('B', len(USERNAME)) + USERNAME.upper() # username length & username
- sock.send(auth_logon)
- auth_srp = sock.recv(128)
- SRP_B = strtoint(auth_srp[3:35])
- SRP_g = strtoint(auth_srp[36:37])
- SRP_N = strtoint(auth_srp[38:70])
- SRP_salt = auth_srp[70:102]
- SRP_crcsalt = auth_srp[102:118]
- print '\n--------- DATA RECEIVED'
- print 'SRP B: ', binascii.hexlify(inttostr(SRP_B))
- print 'SRP g: ', binascii.hexlify(inttostr(SRP_g))
- print 'SRP N: ', binascii.hexlify(inttostr(SRP_N))
- print 'SRP salt: ', binascii.hexlify(SRP_salt)
- print 'CRC salt: ', binascii.hexlify(SRP_crcsalt)
- print '--------- DATA END\n'
- SRP_a = random.SystemRandom().getrandbits(256)
- SRP_A = pow(SRP_g, SRP_a, SRP_N)
- SRP_u = strtoint(hash(inttostr(SRP_A) + inttostr(SRP_B)))
- SRP_k = strtoint(hash(inttostr(SRP_N) + inttostr(SRP_g).rjust(32,'\x00')))
- SRP_x = strtoint(hash(SRP_salt + hash(USERNAME.upper() + ':' + PASSWORD.upper())))
- SRP_v = inttostr(pow(SRP_g, SRP_x, SRP_N))
- SRP_S = inttostr(pow(SRP_B - SRP_k * pow(SRP_g, SRP_x, SRP_N), SRP_a + SRP_u * SRP_x, SRP_N))
- print 'SRP a: ', binascii.hexlify(inttostr(SRP_a))
- print 'SRP k: ', binascii.hexlify(inttostr(SRP_k))
- print 'SRP v: ', binascii.hexlify(SRP_v)
- print 'SRP S: ', binascii.hexlify(SRP_S)
- sock.close
Add Comment
Please, Sign In to add comment