Guest User

Untitled

a guest
Dec 24th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. from struct import *
  2. import random
  3. import socket
  4. import sha
  5. import binascii
  6. import hashlib
  7.  
  8. HOST = 'logonhg.gamefreedom.pl'
  9. PORT = 3724
  10. USERNAME = 'krzystar'
  11. PASSWORD = 'random_password'
  12.  
  13. def strtoint(s):
  14. r = 0L
  15. for c in s:
  16. r = (r << 8) + ord(c)
  17. return r
  18.  
  19. def inttostr(i):
  20. s = ''
  21. while i > 0:
  22. s = chr(i & 255) + s
  23. i = i >> 8
  24. return s
  25.  
  26. def hash(s):
  27. return sha.new(s).digest()
  28.  
  29. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  30. sock.connect((HOST, PORT))
  31.  
  32. auth_logon = '\x00\x08' # cmd = auth logon challenge, error = 8
  33. auth_logon += pack('H', 30+len(USERNAME)) # packet length
  34. auth_logon += '\x57\x6f\x57\x00' # game = WoW
  35. auth_logon += '\x02\x04\x03\x9e\x21' # version = 2.4.3, build = 8606
  36. auth_logon += '\x36\x38\x78\x00\x6e\x69\x57\x00' # platform = x86, OS = Win
  37. auth_logon += '\x42\x47\x6e\x65\x3c\x00\x00\x00' # country = enGB, timezone bias = 60
  38. auth_logon += socket.inet_aton(sock.getsockname()[0]) # local IP address
  39. auth_logon += pack('B', len(USERNAME)) + USERNAME.upper() # username length & username
  40.  
  41. sock.send(auth_logon)
  42.  
  43. auth_srp = sock.recv(128)
  44. SRP_B = strtoint(auth_srp[3:35])
  45. SRP_g = strtoint(auth_srp[36:37])
  46. SRP_N = strtoint(auth_srp[38:70])
  47. SRP_salt = auth_srp[70:102]
  48. SRP_crcsalt = auth_srp[102:118]
  49. print '\n--------- DATA RECEIVED'
  50. print 'SRP B: ', binascii.hexlify(inttostr(SRP_B))
  51. print 'SRP g: ', binascii.hexlify(inttostr(SRP_g))
  52. print 'SRP N: ', binascii.hexlify(inttostr(SRP_N))
  53. print 'SRP salt: ', binascii.hexlify(SRP_salt)
  54. print 'CRC salt: ', binascii.hexlify(SRP_crcsalt)
  55. print '--------- DATA END\n'
  56.  
  57. SRP_a = random.SystemRandom().getrandbits(256)
  58. SRP_A = pow(SRP_g, SRP_a, SRP_N)
  59. SRP_u = strtoint(hash(inttostr(SRP_A) + inttostr(SRP_B)))
  60. SRP_k = strtoint(hash(inttostr(SRP_N) + inttostr(SRP_g).rjust(32,'\x00')))
  61. SRP_x = strtoint(hash(SRP_salt + hash(USERNAME.upper() + ':' + PASSWORD.upper())))
  62. SRP_v = inttostr(pow(SRP_g, SRP_x, SRP_N))
  63. SRP_S = inttostr(pow(SRP_B - SRP_k * pow(SRP_g, SRP_x, SRP_N), SRP_a + SRP_u * SRP_x, SRP_N))
  64.  
  65. print 'SRP a: ', binascii.hexlify(inttostr(SRP_a))
  66. print 'SRP k: ', binascii.hexlify(inttostr(SRP_k))
  67. print 'SRP v: ', binascii.hexlify(SRP_v)
  68. print 'SRP S: ', binascii.hexlify(SRP_S)
  69.  
  70. sock.close
Add Comment
Please, Sign In to add comment