Giter Club home page Giter Club logo

cwinspect's Introduction

CWInspect

CWInspect is a Cube World Man-in-the-Middle server implementation written in java for logging and analyzing the cube worlds protocl.

Currently Done

  • Man-in-the-middle server
  • Packet logging
  • Hooks for manipulating data or send other data
  • Analyze packets based off classes in the project (Look at net.kennux.cwinspect.packets.server.SeedPacket)
  • Use hooks which will get activated when the packet id of a received packet matches a hook packet id
  • Helper classes for reading / sending data (ByteUtils)

Hooks

Hooks have to be put into

  • net.kennux.cwinspect.hooks.server -> Hooks that will get activated on packet from server to client with the specified packet id
  • net.kennux.cwinspect.hooks.client -> Hooks that will get activated on packet from client to server with the specified packet id

Hooks have to forward data by itself. Example:

	public void hook(byte[] data, OutputStream clientStream, OutputStream serverStream)
	{
		// A hook HAVE TO forward the data by itself
		try
		{
			serverStream.write(data);
		}
		catch (Exception e)
		{
			
		}
	}

Packets

Packets have to be put into

  • net.kennux.cwinspect.packets.server -> Packets from server
  • net.kennux.cwinspect.packets.client -> Packets from client

Packets have to implement the following Methods:

  • getPacketId() -> Return integer of the packet id
  • loadPacket(byte[] data) -> Loads packet data and adds it with value names into the HashMap this.values, return -1 for packet length unknown or the length of the packet
  • buildPacket() -> Return byte array of the built packet (When using implementation for sending packets, otherwise return null)

Logs

CWInspect can log packets binary and as hexdump. They will get logged as hexdump to console / logfile if you put an 1 into log_data

Binary logs do need the timestamp logfile, because the different packets in the logfiles will get marked there.

Example: "Server -> Client [11.07.2013 22:04:35] [148] 0x9FFA - 0xA104". The [148] are the current milliseconds

CWInspect can also only log unknown packets as hexdump if you put a 1 into log_unknown.

Properties

  • remote_host = your remote cube world host
  • remote_port = your remote cube world port
  • local_port = the local port where the server should start listening (12345)
  • log_to_file = Log console output to file ("" for log to console)
  • log_binary_server = Logfile for binary data from server -> client, "" for no log
  • log_binary_client = Logfile for binary data from client -> server, "" for no log
  • log_timestamps = Logfile for data timestamps, needed for binary log!
  • log_unknown = Log unknown packets as Hex Dump
  • log_data = 1 for log data in console, 0 for not log data
  • log_binary = 1 for log binary data in console or logfile, 0 for only log hex (ex. 0F 14 3A)
  • columns_hex = how much bytes in hexadecimal (ex. 0F 15) per line?

License

Copyright (c) 2013 Kenneth Ellersdorfer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cwinspect's People

Stargazers

 avatar

Watchers

 avatar

cwinspect's Issues

This project is interesting, but I can't pass this error...

Compiling the program is fine, the server starts, but when I try to log into the server, the client freeze and I get this error:

test.unknown.log:

Server -> Client [Jul 13, 2013 4:27:36 PM] [258]
11 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
This packet could not get identified (ID=17)!


From the console:

Starting CWInspect...
Loading Config...
Config loaded!
Starting Server!
Server running!
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at net.cubeserver.networking.SocketProxy$SocketThread.connectCW(SocketPr
oxy.java:335)
at net.cubeserver.networking.SocketProxy$SocketThread.run(SocketProxy.ja
va:268)
at java.lang.Thread.run(Unknown Source)
Client -> Server [Jul 13, 2013 4:31:07 PM] [661]
11 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
This packet could not get identified (ID=17)!
java.lang.NullPointerException
at net.cubeserver.networking.SocketProxy$SocketThread.gotData(SocketProx
y.java:443)
at net.cubeserver.networking.SocketProxy$SocketThread.run(SocketProxy.ja
va:300)
at java.lang.Thread.run(Unknown Source)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.