Package: rocket-client
rocket protocolrocket it's the safer and text-based twin brother of RCON protocol targeted mainly for executing commands on game serversWhat is the Rocket protocol?Rocket protocol works on the same principle as RCON, that is, it allows remote execution of commands on the server. The communication between the client and the server is text-based, using the TCP protocol. Unlike RCON, the Rocket protocol encrypts all communication between the client and the server using an encryption key that is generated when this protocol is configured on the server (the client version must encrypt its packets with the same key as the server version).Supported games serversFurther implementations of the protocol of various games will be available on other branches, such as implementation/minecraftSoon implementation of the Minecraft game will be availableNOTE:main branch contains only client implementation written in python, for other implementation see branches.What does the Rocket packet look like?A Rocket packet has three parts, which are:<request_id>;<p_type>;<body>request_idis a unique identifier for the request, and it can be used to identify the response.packet_typeis the type of the packet.bodyis the actual content of the packet.It is important to note that the server and the client should validate the count of;in payloads, and there should be a maximum of two.Here are the types of packets supported by Rocket Protocol:classRPacketType:SERVER_RESP_SUCCESS:int=0SERVER_RESP_FAILURE:int=2SERVER_AUTH_FAILURE:int=3CLIENT_REQUEST:int=5How to use rocket python clientBelow is a simple example of how to send commands to the server.fromrocketimportRocketfromrocket.packetimportRPacketTypeif__name__=="__main__":rocket:Rocket=Rocket('localhost',5543,"rUc_HJItDCwdkZ0esm8uKUh4yIc8GsYSTNFQleUcmI0=")response:RPacket=rocket.execute_command("say hello")ifresponse.p_type==RPacketType.SERVER_RESP_SUCCESS:print("SERVER SUCCESS RESPONSE")command:str="give @a potion{Potion:\"minecraft:night_vision\"}"response:RPacket=rocket.execute_command(command)print(response)NOTE:The key that encrypts the connection is not a random string, to generate the key you need to use the command::python-c"\n\nimport base64, os\nprint(base64.urlsafe_b64encode(os.urandom(32)).decode('utf-8'))"Advantages of using the Rocket protocolThe Rocket protocol offers several advantages over other remote execution protocols like RCON:Enhanced Security: The Rocket protocol encrypts all communication between the client and the server, making it more secure than RCON, which sends all data in plain text. The encryption key is generated when the protocol is configured on the server, and the client must use the same key to encrypt its packets. This ensures that only authorized clients can communicate with the server.Text-based Communication: Rocket protocol uses text-based communication, which makes it easier to read and debug than binary protocols. Text-based communication also means that the protocol can be used with any programming language that supports TCP sockets.Multiple Language Compatibility: The Rocket protocol is compatible with multiple programming languages, making it easy to use with different types of clients and servers. This means that developers can use their preferred programming language to create clients that can communicate with Rocket-enabled servers, and vice versa.Flexible Packet Structure: The packet structure of the Rocket protocol is simple and flexible. It consists of three parts, and the packet type can be easily extended to support new features. This makes it easy to add new functionality to the protocol without breaking compatibility with existing clients and servers.Overall, the Rocket protocol offers a secure, flexible, and easy-to-use alternative to other remote execution protocols like RCON.