Compare commits

..

No commits in common. "d46598ae5e922e1627031a4f658786edbf1ebfbd" and "cef43f545c10a83fcfceb9c2bf0f0f42e5db0522" have entirely different histories.

2 changed files with 8 additions and 23 deletions

View File

@ -213,7 +213,7 @@ class Netserver:
return return
def handle_game_packet(self, session, payload): def handle_game_packet(self, session, payload):
#logger.debug("Payload: %s", payload) logger.debug("Payload: %s", payload)
if payload[0] == 0xc1: if payload[0] == 0xc1:
# connect frame? # connect frame?
_ = payload[0:4] _ = payload[0:4]
@ -246,12 +246,11 @@ class Netserver:
payload.putLong(0x41) # unknown - 65 payload.putLong(0x41) # unknown - 65
payload.putLong(0x14) # max players payload.putLong(0x14) # max players
payload.putLong(0x02) # current players payload.putLong(0x02) # current players
payload.putByte(len((name + "\x00").encode("utf-16-le"))) # player name length payload.write(b'\x0e\x01\x00\x00') # unknown - 3585 - or \x16\x01\x00\x00
payload.write(b'\x01\x00\x00') # unknown - 3585 - or \x16\x01\x00\x00
payload.putLong(len((self.server.name + "\x00").encode("utf-16-le"))) # SERVERNAME LENGTH payload.putLong(len((self.server.name + "\x00").encode("utf-16-le"))) # SERVERNAME LENGTH
for _ in range(4): for _ in range(4):
payload.putLong(0) # unknown payload.putLong(0) # unknown
payload.putLong(204+len((name+"\x00").encode("utf-16-le"))) # 204+playerlen that's an offset FUN FACT: setting it to a bad value makes the client crash on connect payload.putLong(0xda) # unknown - 218 - or 0xe2
payload.putLong(0x34) # unknown - 52 payload.putLong(0x34) # unknown - 52
payload.write(self.guid) # instance guid payload.write(self.guid) # instance guid
payload.write( payload.write(
@ -276,12 +275,13 @@ class Netserver:
payload.putLong(0x00) # unknown - 0 payload.putLong(0x00) # unknown - 0
payload.putLong(0x07) # unknown - 7 payload.putLong(0x07) # unknown - 7
payload.putLong(0xcc) # unknown - 204 payload.putLong(0xcc) # unknown - 204
payload.putLong(len((name + "\x00").encode("utf-16-le"))) # player name length payload.putLong(0x0e) # unknown - 6
for _ in range(4): for _ in range(4):
payload.putLong(0) # unknown payload.putLong(0) # unknown
payload.write((name + "\x00").encode("utf-16-le")) payload.write((name + "\x00").encode("utf-16-le"))
payload.write(b'\xff') # map ID payload.write(b'\xff') # map ID
payload.write(b'\x01\x01\x00') payload.write(b'\x01\x01\x00')
#payload.write(b'\x00\x04\x00')
payload.write(b'\xd9\x05') # game version payload.write(b'\xd9\x05') # game version
payload.write(b'\x02\x92') # unknown payload.write(b'\x02\x92') # unknown
payload.write(b'\x05\x00\x01\x00\x00\x00\x00\x00') # Unknown payload.write(b'\x05\x00\x01\x00\x00\x00\x00\x00') # Unknown
@ -296,14 +296,10 @@ class Netserver:
elif payload[0] == 0xc3: elif payload[0] == 0xc3:
player = self.get_player(session) player = self.get_player(session)
if not player: self.server.broadcast_message("%s: you should never have joined... Sorry bro." % player.name)
return
player.session.send_cframe_sack()
self.server.broadcast_message("%s: sorry bro, you're fucked." % player.name)
player.session.send_gamedata(b'\x3c\x56\xab\x31\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') player.session.send_gamedata(b'\x3c\x56\xab\x31\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
player.session.send_gamedata(b'\x01\x02\x57\xab\xa1\x96\x56\xab\x31\x96\x0e\x01\x00\x00\x00') player.session.send_gamedata(b'\x01\x02\x57\xab\xa1\x96\x56\xab\x31\x96\x0e\x01\x00\x00\x00')
"""player.session.send_gamedata(b'\x3d\x00\x5b\x53\x65\x72\x76\x65\x72\x5d') # [SERVER] player.session.send_gamedata(b'\x3d\x00\x5b\x53\x65\x72\x76\x65\x72\x5d') # [SERVER]
player.session.send_gamedata(b'\x3d\x01'+player.name.encode("ascii")+b"\x00") # playername player.session.send_gamedata(b'\x3d\x01'+player.name.encode("ascii")+b"\x00") # playername
player.session.send_gamedata(b'\x0f\x56\xab\x31\x96\x06\x00\x00\x00\x00\x00\x00\x00\x00') # unknown player.session.send_gamedata(b'\x0f\x56\xab\x31\x96\x06\x00\x00\x00\x00\x00\x00\x00\x00') # unknown
player.session.send_gamedata(b'\x10\x02\x56\xab\x31\x96\x00\x00\x00\x00\x00\x00\x00\x00') # unknown player.session.send_gamedata(b'\x10\x02\x56\xab\x31\x96\x00\x00\x00\x00\x00\x00\x00\x00') # unknown
@ -314,17 +310,7 @@ class Netserver:
player.session.send_gamedata(b'\x0a\x12\x00\x00\x00\x00\x28\x10\x03\x10\x12\x00\x00\x00\xc1\xff\x41\xff\x00', acknow=True) # unknown player.session.send_gamedata(b'\x0a\x12\x00\x00\x00\x00\x28\x10\x03\x10\x12\x00\x00\x00\xc1\xff\x41\xff\x00', acknow=True) # unknown
player.session.send_gamedata(b'\x0f\x56\xab\x31\x96\x08\x00\x00\x00\x00\x00\x00\x00\x00', acknow=True) # unknown player.session.send_gamedata(b'\x0f\x56\xab\x31\x96\x08\x00\x00\x00\x00\x00\x00\x00\x00', acknow=True) # unknown
player.session.send_gamedata(b'\x0a\x12\x00\x00\x00\x00\x2c\x10\x03\x10\x12\x00\x00\x00\x08\x00\xb6\x01\x0a\x14\x00\x00\x00\x00\x2d\x10\x03\x01\x12\x00\x00\x00\xd4\xfc\x9b\xfd\x00\x00\x00', acknow=True) # unknown
#\x00
player.session.send_gamedata(b'\x2f\x02\x00\x00\xbe\x00\x00\x00\x00\x00\x00\x00\x00\x00', acknow=True) # unknown
player.session.send_gamedata(b'\x0a\x12\x00\x00\x00\x00\x2e\x10\x03\x10\x12\x00\x00\x00\xa8\xfd\x2d\x03\x0a\x14\x00\x00\x00\x00\x2e\x10\x03\x01\x12\x00\x00\x00\x60\xfd\x14\x03\x00\x00\x00', acknow=True) # unknown
player.session.send_gamedata(b'\x0a\x14\x00\x00\x00\x00\x28\x10\x03\x01\x12\x00\x00\x00\xbf\xff\x3f\xff\x00\x00\x00', acknow=True) # unknown
player.session.send_gamedata(b'\x0a\x12\x00\x00\x00\x00\x2a\x10\x03\x10\x12\x00\x00\x00\x73\x01\x42\x02\x0a\x14\x00\x00\x00\x00\x2a\x10\x03\x01\x12\x00\x00\x00\xbe\x01\x8c\x02\x00\x00\x00', acknow=True) # unknown
player.session.send_gamedata(b'\x2f\x02\x00\x00\xc2\x00\x00\x00\x00\x00\x00\x00\x00\x00',acknow=True) # unknown
player.session.send_gamedata(b'\x0a\x14\x00\x00\x00\x00\x2c\x10\x03\x01\x12\x00\x00\x00\x06\x00\xb5\x01\x00\x00\x00', acknow=True) # unknown
player.session.send_gamedata(b'\x0a\x12\x00\x00\x00\x00\x2e\x10\x03\x10\x12\x00\x00\x00\xa4\xfd\x2c\x03\x00',acknow=True) # unknown
player.session.send_gamedata(b'\x2f\x02\x00\x00\xc2\x00\x00\x00\x00\x00\x00\x00\x00\x00', acknow=True) # unknown
"""
def send_packet(self, addr, packet): def send_packet(self, addr, packet):

View File

@ -18,7 +18,6 @@ class Server:
self.maxplayers = kwargs.get("maxplayers", 20) self.maxplayers = kwargs.get("maxplayers", 20)
self.name = kwargs.get("name", "Default Server Name") self.name = kwargs.get("name", "Default Server Name")
self.accept_new_players = True self.accept_new_players = True
self.register_with_ms = False
# events # events
self._on_new_player = [] self._on_new_player = []