Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No name found for packet #178

Open
RaspberryEqualsPi opened this issue Sep 15, 2022 · 6 comments
Open

No name found for packet #178

RaspberryEqualsPi opened this issue Sep 15, 2022 · 6 comments

Comments

@RaspberryEqualsPi
Copy link

RaspberryEqualsPi commented Sep 15, 2022

I keep getting this error:
Traceback (most recent call last): File "C:\Users\****\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\quarry\net\protocol.py", line 241, in data_received name = self.get_packet_name(buff.unpack_varint()) File "C:\Users\****\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\quarry\net\protocol.py", line 207, in get_packet_name raise ProtocolError("No name known for packet: %s" % (key,)) quarry.net.protocol.ProtocolError: No name known for packet: (760, 'init', 'upstream', 79)
I get this every single time I try to use quarry as a proxy, and for some reason quarry never picks up on any of the other packets and doesn't call my callbacks
(this is on 1.18.2 if it's important)

@davidawesome02
Copy link

quarry protocol but 💀 is it a ur code problem, or just when starting, if so role back to previous ver

@RaspberryEqualsPi
Copy link
Author

quarry protocol but 💀 is it a ur code problem, or just when starting, if so role back to previous ver

I tried to use https://github.com/LiveOverflow/minecraft-hacked just to try out quarry, so I didn't make the code myself. I also tried quarry examples but to no avail. I used the latest quarry at first, then downgraded it to the version where they added 1.18.2 but that fixed nothing. The error also randomly occurs repeatedly, so it's not only at the start

@davidawesome02
Copy link

have you tryed uninstalling it and reinstalling, and can I see your code

@RaspberryEqualsPi
Copy link
Author

have you tryed uninstalling it and reinstalling, and can I see your code

The code is literally the same exact code from the repository I linked, and in order to downgrade quarry, I had to uninstall it and install a older version which is literally uninstalling and reinstalling

@RaspberryEqualsPi
Copy link
Author

RaspberryEqualsPi commented Sep 18, 2022

heres the code tho if u dont wanna go to the repo

from twisted.internet import reactor
from quarry.net.proxy import DownstreamFactory, Bridge
import struct
import time
import random
import math

# based on https://github.com/barneygale/quarry/blob/master/examples/client_chat_logger.py

class QuietBridge(Bridge):
    entity_id = None
    prev_pos = None
    prev_look = None

    def packet_upstream_chat_message(self, buff):
        buff.save()
        chat_message = buff.unpack_string()
        print(f" >> {chat_message}")

        if chat_message.startswith("/port"):
            _, distance = chat_message.split(" ")
            flags = 0
            teleport = 0
            dismount = 0
            x, y, z, ground = self.prev_pos
            yaw, pitch, ground = self.prev_look
            # see net.minecraft.entity.Entity:getRotationVEctor()
            f = pitch * 0.017453292
            g = -yaw * 0.017453292
            h = math.cos(g)
            i = math.sin(g)
            j = math.cos(f)
            k = math.sin(f)
            _x = i*j
            _y = -k
            _z = h*j
            x += _x * float(distance)
            y += _y * float(distance)
            z += _z * float(distance)
            buf = struct.pack('>dddffBBB', x, y, z, yaw, pitch, flags, teleport, dismount)
            self.downstream.send_packet('player_position_and_look', buf)

        buff.restore()
        self.upstream.send_packet("chat_message", buff.read())

    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_upstream_player_position(self, buff):
        buff.save()
        x, y, z, ground = struct.unpack('>dddB', buff.read())
        print(f"[*] player_position {x} / {y} / {z} | {ground}")
        self.prev_pos = (x, y, z, ground)
        buf = struct.pack('>dddB', x, y, z, ground)
        self.upstream.send_packet('player_position', buf)

    def packet_upstream_player_look(self, buff):
        buff.save()
        yaw, pitch, ground = struct.unpack('>ffB', buff.read())
        print(f"[*] player_look {yaw} / {pitch} | {ground}")
        self.prev_look = (yaw, pitch, ground)
        buf = struct.pack('>ffB', yaw, pitch, ground)
        self.upstream.send_packet('player_look', buf)


class QuietDownstreamFactory(DownstreamFactory):
    bridge_class = QuietBridge
    motd = "LiveOverflow Proxy"


# python basic_proxy.py -q 12345
def main(argv):
    # Parse options
    import argparse
    parser = argparse.ArgumentParser()
    parser.add_argument("-a", "--listen-host", default="0.0.0.0", 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:])

@PaulGod
Copy link

PaulGod commented Dec 25, 2022

I am having the same issue, I have used the same code but it also happens with the example code for proxy-hide-chat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants