コード例 #1
0
def SilentLogin(self,data_e):

	if self.GAMEOBJ == None:
		self.GAMEOBJ = DataClass.BF3Client()
		self.GAMEOBJ.NetworkInt = self.transport
		Globals.Clients.append(self.GAMEOBJ)

	packedIP = socket.inet_aton(self.transport.getPeer().host)
	self.GAMEOBJ.EXTIP = struct.unpack("!L", packedIP)[0]
	self.GAMEOBJ.IsUp = True
	
	packet = BlazeFuncs.BlazeDecoder(data_e)
	loginKey = packet.getVar("AUTH")
	PID = packet.getVar("PID ")
	
	id = 0
	for c in loginKey:
		id += ord(c)
			
	#path2 = cwd+"\\Stats\\"+str(id)+"\\"
	
	#if not os.path.exists(path2):
	#	os.makedirs(path2)
	
	self.GAMEOBJ.UserID = id
	self.GAMEOBJ.EMail = "*****@*****.**"

	self.GAMEOBJ.PersonaID = id
	self.GAMEOBJ.Name = loginKey

	self.GAMEOBJ.SessionKey = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(42))
	self.GAMEOBJ.LoginKey = loginKey

	#if not os.path.isfile(path2+"userstats.txt"):
	#	shutil.copy2('Stats/default/userstats.txt', path2)
	
	#if not os.path.isfile(path2+"usersettings.txt"):
	#	shutil.copy2('Stats/default/usersettings.txt', path2)
	
	reply = BlazeFuncs.BlazePacket("0001","0032",packet.packetID,"1000")
	reply.writeInt("AGUP", 0)
	reply.writeString("LDHT", "")
	reply.writeBool("NTOS", False)
	reply.writeString("PCTK", "LoginKey_1337")
	reply.writeString("PRIV", "")
		
	#SESS STRUCT START
	reply.writeSStruct("SESS")
	reply.writeInt("BUID", self.GAMEOBJ.PersonaID)
	reply.writeBool("FRST", False)
	reply.writeString("KEY ", self.GAMEOBJ.SessionKey)
	reply.writeInt("LLOG", 0)
	reply.writeString("MAIL", self.GAMEOBJ.Name)
		
	#PDTL STRUCT START
	reply.writeSStruct("PDTL")
	reply.writeString("DSNM", self.GAMEOBJ.Name)
	reply.writeInt("LAST", 0)
	reply.writeInt("PID ",self.GAMEOBJ.PersonaID)
	reply.writeInt("STAS", 0)
	reply.writeInt("XREF", 0)
	reply.writeInt("XTYP", 0)
	reply.writeEUnion()
	#PDTL STRUCT END
		
	reply.writeInt("UID ",self.GAMEOBJ.UserID)
	#------------------
	reply.writeEUnion()
	#SESS STRUCT END---

	reply.writeBool("SPAM", False)
	reply.writeString("THST", "")
	reply.writeString("TSUI", "")
	reply.writeString("TURI", "")
	self.transport.getHandle().sendall(reply.build().decode('Hex'))
	
	reply = BlazeFuncs.BlazePacket("7802","0002","0000","2000")
	reply.writeSStruct("USER")
	reply.writeInt("AID ", self.GAMEOBJ.UserID)
	reply.writeInt("ALOC", 1701729619)
	reply.writeInt("ID  ", self.GAMEOBJ.PersonaID)
	reply.writeString("NAME", self.GAMEOBJ.Name)
	reply.writeEUnion() #END USER
	pack1, pack2 = reply.build()
	self.transport.getHandle().sendall(pack1.decode('Hex'))
	self.transport.getHandle().sendall(pack2.decode('Hex'))

		
	reply = BlazeFuncs.BlazePacket("7802","0005","0000","2000")
	reply.writeInt("FLGS", 3)
	reply.writeInt("ID  ", self.GAMEOBJ.PersonaID)
	pack1, pack2 = reply.build()
	self.transport.getHandle().sendall(pack1.decode('Hex'))
	self.transport.getHandle().sendall(pack2.decode('Hex'))
コード例 #2
0
def getUserSessionFromAuth(self, data_e):
    if self.GAMEOBJ == None:
        self.GAMEOBJ = DataClass.BF3Client()
        self.GAMEOBJ.NetworkInt = self.transport

    packedIP = socket.inet_aton(self.transport.getPeer().host)
    self.GAMEOBJ.EXTIP = struct.unpack("!L", packedIP)[0]
    self.GAMEOBJ.IsUp = True

    packet = BlazeFuncs.BlazeDecoder(data_e)

    name = packet.getVar("AUTH")

    port = self.transport.getPeer().port

    print "Client connecting by port = " + str(port)
    for auth in Globals.authClients:
        if auth.Port == port:
            name = auth.Name
            print name + " Authed By Port"

    cwd = os.getcwd()
    path = cwd + "\\Users\\" + name + "\\"

    if name == "":
        print "No account..."
        #self.transport.loseConnection()
        return

    if not os.path.exists(path):
        print "No account folder exists..."
        #self.transport.loseConnection()
        return

    id = 0
    for c in name:
        id += ord(c)

    self.GAMEOBJ.PersonaID = id
    self.GAMEOBJ.UserID = id
    self.GAMEOBJ.Name = name

    Globals.Clients.append(self.GAMEOBJ)

    reply = BlazeFuncs.BlazePacket("0023", "000a", packet.packetID, "1000")
    reply.writeBool("ANON", False)
    reply.writeBool("NTOS", False)
    #SESS STRUCT START
    reply.writeSStruct("SESS")
    reply.writeInt("BUID", self.GAMEOBJ.PersonaID)
    reply.writeBool("FRSC", False)
    reply.writeBool("FRST", False)
    reply.writeString("KEY ", "SessionKey_1337")
    reply.writeInt("LLOG", 1403663841)
    reply.writeString("MAIL", self.GAMEOBJ.EMail)

    #PDTL STRUCT START
    reply.writeSStruct("PDTL")
    reply.writeString("DSNM", self.GAMEOBJ.Name)
    reply.writeInt("PID ", self.GAMEOBJ.PersonaID)
    reply.writeInt("PLAT", 4)
    reply.writeEUnion()  # END PDTL
    reply.writeInt("UID ", self.GAMEOBJ.PersonaID)
    reply.writeEUnion()  #END SESS

    reply.writeBool("SPAM", True)
    reply.writeBool("UNDR", False)
    self.transport.getHandle().sendall(reply.build().decode('Hex'))

    reply = BlazeFuncs.BlazePacket("7802", "0008", "0000", "2000")
    reply.writeInt("ALOC", 1403663841)
    reply.writeInt("BUID", 321422442)
    reply.append("8E7A640982E003029DE68780808080C03F")
    reply.writeString("DSNM", self.GAMEOBJ.Name)
    reply.writeBool("FRSC", False)
    reply.writeBool("FRST", False)
    reply.writeString("KEY ", "SessionKey_1337")
    reply.writeInt("LAST", 1403663841)
    reply.writeInt("LLOG", 1403663841)
    reply.writeString("MAIL", self.GAMEOBJ.EMail)
    reply.writeInt("PID ", self.GAMEOBJ.PersonaID)
    reply.writeInt("PLAT", 4)
    reply.writeInt("UID ", self.GAMEOBJ.PersonaID)
    reply.writeInt("USTP", 0)
    reply.writeInt("XREF", 0)
    pack1, pack2 = reply.build()

    self.transport.getHandle().sendall(pack1.decode('Hex'))
    self.transport.getHandle().sendall(pack2.decode('Hex'))

    reply = BlazeFuncs.BlazePacket("7802", "0002", "0000", "2000")
    reply.writeSStruct("DATA")
    reply.append("864932067f")  #ADDR
    reply.writeString("BPS ", "")
    reply.writeString("CTY ", "")
    reply.append("8f68720700")  #CVAR
    reply.writeInt("HWFG", 0)

    reply.writeSStruct("QDAT")
    reply.writeInt("DBPS", 0)
    reply.writeInt("NATT", 0)
    reply.writeInt("UBPS", 0)
    reply.writeEUnion()  #END QDAT

    #reply.writeInt("UATT", 0)
    reply.append("D61D3400808080D081A409")
    reply.append("D6CCF404090182E003029DE68780808080C03F")
    reply.writeEUnion()  #END DATA

    reply.writeSStruct("USER")
    reply.writeInt("AID ", self.GAMEOBJ.UserID)
    reply.writeInt("ALOC", 1701729619)
    reply.writeInt("ID  ", self.GAMEOBJ.PersonaID)
    reply.writeString("NAME", self.GAMEOBJ.Name)
    reply.writeInt("ORIG", self.GAMEOBJ.PersonaID)
    reply.writeInt("PIDI", self.GAMEOBJ.PersonaID)
    reply.writeEUnion()  #END USER
    pack1, pack2 = reply.build()
    self.transport.getHandle().sendall(pack1.decode('Hex'))
    self.transport.getHandle().sendall(pack2.decode('Hex'))

    reply = BlazeFuncs.BlazePacket("7802", "0005", "0000", "2000")
    reply.writeInt("FLGS", 3)
    reply.writeInt("ID  ", self.GAMEOBJ.PersonaID)
    pack1, pack2 = reply.build()
    self.transport.getHandle().sendall(pack1.decode('Hex'))
    self.transport.getHandle().sendall(pack2.decode('Hex'))
コード例 #3
0
ファイル: Accounts.py プロジェクト: whelpton/BF4BlazeEmulator
def getUserSessionFromAuth(self, data_e):
    if self.GAMEOBJ == None:
        self.GAMEOBJ = DataClass.BF3Client()
        self.GAMEOBJ.NetworkInt = self.transport

    packedIP = socket.inet_aton(self.transport.getPeer().host)
    self.GAMEOBJ.EXTIP = struct.unpack("!L", packedIP)[0]
    self.GAMEOBJ.IsUp = True

    packet = BlazeFuncs.BlazeDecoder(data_e)

    name = packet.getVar("AUTH")
    name = ""
    #print name

    cwd = os.getcwd()
    path = cwd + "\\Users\\" + name + "\\"

    ipPlayer = str(self.transport.getPeer()).split('\'')
    ipPlayerJoining = ipPlayer[1]

    matching = [s for s in Https.playersJoining if ipPlayerJoining in s]
    arrayItem = str(matching)
    if (arrayItem == "[]"):
        print(
            "[BETA-JOIN-SYSTEM] Error! Not authorized user, dropping connection..."
        )
        self.transport.loseConnection()
        self.GAMEOBJ.IsUp = False
        print("[BETA-JOIN-SYSTEM] Connection Dropped!")
    else:
        print("[BETA-JOIN-SYSTEM] Authorized user joining...")
        itemRemove = str(
            arrayItem.replace("[", "").replace("]", "").replace("'", ""))
        itemRemoveSplit = itemRemove.split('|')

        playerIp = itemRemoveSplit[0]
        playerUsername = itemRemoveSplit[1]
        playerPassword = itemRemoveSplit[2]

        #print(str(playerUsername))

        name = str(playerUsername)

        Https.playersJoining.remove(itemRemove)

        print("[BETA-JOIN-SYSTEM] User, IP: " + playerIp + " Username: "******" Joined!")

    #print name
    '''
	if name == "":
		print "No account..."
		self.transport.loseConnection()

	if not os.path.exists(path):
		print "No account..."
		self.transport.loseConnection()
	'''
    id = 0
    for c in name:
        id += ord(c)

    self.GAMEOBJ.PersonaID = id
    self.GAMEOBJ.UserID = id
    self.GAMEOBJ.Name = name

    Globals.Clients.append(self.GAMEOBJ)

    reply = BlazeFuncs.BlazePacket("0023", "000a", packet.packetID, "1000")
    reply.writeBool("ANON", False)
    reply.writeBool("NTOS", False)
    #SESS STRUCT START
    reply.writeSStruct("SESS")
    reply.writeInt("BUID", self.GAMEOBJ.PersonaID)
    reply.writeBool("FRSC", False)
    reply.writeBool("FRST", False)
    reply.writeString("KEY ", "SessionKey_1337")
    reply.writeInt("LLOG", 1403663841)
    reply.writeString("MAIL", self.GAMEOBJ.EMail)

    #PDTL STRUCT START
    reply.writeSStruct("PDTL")
    reply.writeString("DSNM", self.GAMEOBJ.Name)
    reply.writeInt("PID ", self.GAMEOBJ.PersonaID)
    reply.writeInt("PLAT", 4)
    reply.writeEUnion()  # END PDTL
    reply.writeInt("UID ", self.GAMEOBJ.PersonaID)
    reply.writeEUnion()  #END SESS

    reply.writeBool("SPAM", True)
    reply.writeBool("UNDR", False)
    self.transport.getHandle().sendall(reply.build().decode('Hex'))

    reply = BlazeFuncs.BlazePacket("7802", "0008", "0000", "2000")
    reply.writeInt("ALOC", 1403663841)
    reply.writeInt("BUID", 321422442)
    reply.append("8E7A640982E003029DE68780808080C03F")
    reply.writeString("DSNM", self.GAMEOBJ.Name)
    reply.writeBool("FRSC", False)
    reply.writeBool("FRST", False)
    reply.writeString("KEY ", "SessionKey_1337")
    reply.writeInt("LAST", 1403663841)
    reply.writeInt("LLOG", 1403663841)
    reply.writeString("MAIL", self.GAMEOBJ.EMail)
    reply.writeInt("PID ", self.GAMEOBJ.PersonaID)
    reply.writeInt("PLAT", 4)
    reply.writeInt("UID ", self.GAMEOBJ.PersonaID)
    reply.writeInt("USTP", 0)
    reply.writeInt("XREF", 0)
    pack1, pack2 = reply.build()

    self.transport.getHandle().sendall(pack1.decode('Hex'))
    self.transport.getHandle().sendall(pack2.decode('Hex'))

    reply = BlazeFuncs.BlazePacket("7802", "0002", "0000", "2000")
    reply.writeSStruct("DATA")
    reply.append("864932067f")  #ADDR
    reply.writeString("BPS ", "")
    reply.writeString("CTY ", "")
    reply.append("8f68720700")  #CVAR
    reply.writeInt("HWFG", 0)

    reply.writeSStruct("QDAT")
    reply.writeInt("DBPS", 0)
    reply.writeInt("NATT", 0)
    reply.writeInt("UBPS", 0)
    reply.writeEUnion()  #END QDAT

    #reply.writeInt("UATT", 0)
    reply.append("D61D3400808080D081A409")
    reply.append("D6CCF404090182E003029DE68780808080C03F")
    reply.writeEUnion()  #END DATA

    reply.writeSStruct("USER")
    reply.writeInt("AID ", self.GAMEOBJ.UserID)
    reply.writeInt("ALOC", 1701729619)
    reply.writeInt("ID  ", self.GAMEOBJ.PersonaID)
    reply.writeString("NAME", self.GAMEOBJ.Name)
    reply.writeInt("ORIG", self.GAMEOBJ.PersonaID)
    reply.writeInt("PIDI", self.GAMEOBJ.PersonaID)
    reply.writeEUnion()  #END USER
    pack1, pack2 = reply.build()
    self.transport.getHandle().sendall(pack1.decode('Hex'))
    self.transport.getHandle().sendall(pack2.decode('Hex'))

    reply = BlazeFuncs.BlazePacket("7802", "0005", "0000", "2000")
    reply.writeInt("FLGS", 3)
    reply.writeInt("ID  ", self.GAMEOBJ.PersonaID)
    pack1, pack2 = reply.build()
    self.transport.getHandle().sendall(pack1.decode('Hex'))
    self.transport.getHandle().sendall(pack2.decode('Hex'))