Upload files to ''
This commit is contained in:
parent
b08c78e0d9
commit
aee1f26e71
49
main.py
Normal file
49
main.py
Normal file
@ -0,0 +1,49 @@
|
||||
from twisted.internet import reactor
|
||||
from quarry.types.uuid import UUID
|
||||
from quarry.net.proxy import DownstreamFactory, Bridge
|
||||
|
||||
class QuietBridge(Bridge):
|
||||
|
||||
def packet_unhandled(self, buff, direction, name):
|
||||
print(f"[*][{direction}] {name}")
|
||||
if direction == "downstream":
|
||||
self.downstream.send_packet(name, buff.read())
|
||||
elif direction == "upstream":
|
||||
self.upstream.send_packet(name, buff.read())
|
||||
|
||||
def packet_downstream_spawn_player(self, buff):
|
||||
print("GOT PLAYER SPAWN")
|
||||
print(buff.unpack_varint())
|
||||
print(buff.unpack_uuid())
|
||||
print(buff.unpack_varint())
|
||||
print(buff.unpack_varint())
|
||||
print(buff.unpack_varint())
|
||||
self.downstream.send_packet("spawn_player", buff.read())
|
||||
|
||||
class QuietDownstreamFactory(DownstreamFactory):
|
||||
bridge_class = QuietBridge
|
||||
motd = "Sierra Server"
|
||||
|
||||
def main(argv):
|
||||
# Parse options
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-a", "--listen-host", default="", help="address to listen on")
|
||||
parser.add_argument("-p", "--listen-port", default=25565, type=int, help="port to listen on")
|
||||
parser.add_argument("-b", "--connect-host", default="127.0.0.1", help="address to connect to")
|
||||
parser.add_argument("-q", "--connect-port", default=25565, type=int, help="port to connect to")
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
# Create factory
|
||||
factory = QuietDownstreamFactory()
|
||||
factory.connect_host = args.connect_host
|
||||
factory.connect_port = args.connect_port
|
||||
|
||||
# Listen
|
||||
factory.listen(args.listen_host, args.listen_port)
|
||||
reactor.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
main(sys.argv[1:])
|
Loading…
Reference in New Issue
Block a user