Zuletzt aktiv 1 month ago

Pump Prime Server Profile Getter.

Änderung 060b0d612193c5cb2c044d5c0ea1a65be8d15692

geprofile.py Originalformat
1#!/usr/bin/env python
2
3import socket
4import struct
5import time
6import sys
7import os
8import binascii
9from prime import *
10
11import struct
12import pysodium
13
14LAST_NOUNCE = "\x00" * 24
15
16# Just run sudo pip install pysodium
17# And then python getprofile.py profile.bin
18# With the file that you put on the USB drive
19
20# Prime Server Public Key
21pk = "\xB0\xEB\x81\x47\x51\x0A\x2E\x20\x32\xED\x2F\xC0\xF9\xD4\xEB\x88\xB0\xCA\x2D\xBD\xE7\xD6\x4E\xE2\xD0\x83\x4C\x3B\xB6\xFB\x31\x55"
22# Prime Server Private Key
23sk = "\x93\xB2\xF8\xA0\xE0\x95\x49\xDF\xAF\xFE\x36\x56\xE6\xAD\x9C\x9A\x53\x9B\xF6\x63\xD3\x7C\x08\xF0\xA4\xE6\x29\x3C\xBF\xFA\x64\x56"
24
25try:
26 os.mkdir('profiles')
27except:
28 pass
29
30if len(sys.argv) == 2:
31
32 if ".bin" in sys.argv[1]:
33 print "File Access Key Mode"
34 f = open(sys.argv[1], "rb")
35 data = f.read()
36 f.close()
37 ACCESS_KEY = binascii.hexlify(data)
38 if len(ACCESS_KEY) != 32:
39 print "Invalid Access Key!"
40 exit(1)
41 print "Read access key from %s is %s" %(sys.argv[1],ACCESS_KEY)
42 else:
43 ACCESS_KEY = sys.argv[1].lower().replace(" ","")
44 if len(ACCESS_KEY) != 32:
45 print "Invalid Access Key: %s (parsed to: %s)" %(sys.argv[1], ACCESS_KEY)
46 exit(1)
47
48 IP = "115.68.108.183"
49 #IP = "127.0.0.1"
50 PORT = 60000
51
52 accesscode = ACCESS_KEY.lower().replace(" ","")
53
54
55 ProfileID = 0
56 MachineID = 1154
57
58 login = LoginPacket()
59 login.AccessCode = accesscode
60 login.MachineID = MachineID
61 login.PlayerID = 0
62
63 tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
64 dest = (OFICIAL_SERVER_IP, 60000)
65 tcp.connect(dest)
66 data = EncryptPacket(login.ToBinary(), pk, sk)
67 tcp.send (data)
68 time.sleep(0.01)
69
70 gprof = None
71
72 msg = ""
73 profile = ""
74 while True:
75 msg += tcp.recv(4)
76 if len(msg) > 0:
77 size = struct.unpack("<I", msg[:4])[0]
78 msg = msg[4:]
79 msg += tcp.recv(size-4-len(msg))
80 while len(msg) < size-4:
81 msg += tcp.recv((size-4) - len(msg))
82
83 data = DecryptPacket(msg, pk, sk)
84 msg = ""
85 try:
86 packtype = struct.unpack("<I",data[4:8])[0]
87 if packtype == ProfilePacket.PacketType:
88 profile = ProfilePacket()
89 profile.FromBinary(data)
90 f = open ("profiles/%s" %accesscode, "wb")
91 f.write(data)
92 f.close()
93 gprof = profile
94 break
95
96 elif packtype == KeepAlivePacket.PacketType:
97 #print "Received KeepAlive"
98 pass
99
100 elif packtype == ProfileBusyPacket.PacketType:
101 break
102
103 else:
104 #print "PacketType: %s (%x)" %(packtype, packtype)
105 f = open("pack-%s-%x.bin"%(packtype,packtype),"wb")
106 f.write(data)
107 f.close()
108 except Exception,e:
109 print "Error: %s" %e
110 tcp.close()
111 if gprof == None:
112 print '{}'
113 else:
114 print '{"avatar":"%s","name":"%s"}' % (gprof.Avatar, gprof.Nickname)
115else:
116 print "{}"
117