Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

[FEATURE] Spoof fake packets to the own client #7

Open
lbirkert opened this issue Apr 7, 2023 · 10 comments
Open

[FEATURE] Spoof fake packets to the own client #7

lbirkert opened this issue Apr 7, 2023 · 10 comments
Labels
feature request New feature or request

Comments

@lbirkert
Copy link

lbirkert commented Apr 7, 2023

Would be useful to test features that require server side packets to be sent without a bunch of server reloads/restarts. (Certain packets for NPC actions example)

@lbirkert lbirkert changed the title Spoof fake packets to the own client [FEATURE REUQEST] Spoof fake packets to the own client Apr 7, 2023
@lbirkert lbirkert changed the title [FEATURE REUQEST] Spoof fake packets to the own client [FEATURE] Spoof fake packets to the own client Apr 7, 2023
@Ari24-cb24
Copy link
Member

So you mean kind of like a packet-resender? I actually thought about making this project a bit like burp suite where you have the Repeater option.
To do that, I will have to save every ByteBuf (and packet type) in the client for later uses and if the frontend want's to resend something, I'd need to implement deserializers for each packet.

Sure, I'd be down to 😅

@lbirkert
Copy link
Author

lbirkert commented Apr 7, 2023

More ment to target testing the client specifically:

I can spoof an PlayerJoin packet (probably doesn't exist - doesn't matter) and then a new Player pops up to my screen.

I can see how this would make the entire project a lot more complex tho, also this wouldn't really have to do stuff with logging but rather packet testing in particular.

@lbirkert
Copy link
Author

lbirkert commented Apr 7, 2023

Might be simpler to create a server plugin which does that.

@Ari24-cb24
Copy link
Member

Hm, for your particular use case, a server-side plugin would probably better (there are also already scripts out there doing exactly that). But I think I might still introduce a repeater feature in the future. But for know I still have to implement every client-side packet 😅, I'm still missing out on 40 packets. But definitely a nice idea!

@Ari24-cb24
Copy link
Member

Also, when I might introduce server-side packets as well, this feature could come in handy.

@lbirkert
Copy link
Author

lbirkert commented Apr 7, 2023

I also thought of a way to roll-back to some point in history and inspect the games state at that position - with some kind of freecam. It would probably be good if the packets from a recording could be dumped into a snapshot file containing a snapshot of the games state before the recording was taken and then the packets that have been sent meanwhile recording. This would introduce a more modular system allowing different inspectors/tools to be written separate from this project - not only in java, but really in any language that can somehow read a file.

@Ari24-cb24
Copy link
Member

It is possible except for "rewinding", as most packets are relative or use client-side physics. Tho, we use such a ReplaySystem for moderation tools at thejocraft.net. Interesting idea!

@lbirkert
Copy link
Author

lbirkert commented Apr 7, 2023

It is possible except for "rewinding", as most packets are relative or use client-side physics. Tho, we use such a ReplaySystem for moderation tools at thejocraft.net. Interesting idea!

You mean the client state is relative to the clients physics? Yep this could be problematic.

@Ari24-cb24
Copy link
Member

If you rewind 10 seconds back (only option), the plugin basically re-creates the state at the time 10 seconds before that. So it is possible to do something but it requires a lot of work (I think pianoman took some months to develop it)

@Ari24-cb24
Copy link
Member

Also, when I might introduce server-side packets as well, this feature could come in handy.

I'm now at a point where I can say that I will work on this. Packets are currently being stored on the client and I support all packets, so re-sending a packet is not really difficult.
What I think I might need is probably some kind of serializer. There are two ways of doing this

  1. Just implement another method for every packet to construct a new packet (takes a lot of effort but will work)
  2. Annotate the serialized outputs and give them indecies so that they can be parsed in again later (I don't quite know how I would go on and do this, probably having unique names via some sort of mapping....)

It might hopefully end up in a mix of both of them as some packets are quite complex.

@Ari24-cb24 Ari24-cb24 added the feature request New feature or request label May 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants