Kotlin implementation of the Valve Source-engine netchannel protocol.
A research project exploring the limits of Source protocol manipulation.
Decodes and encodes game traffic at the bit level — packet structure, fragmentation, compression, checksums, message decoding and encoding. Built to test ideas around message injection, real-time control, and protocol behavior.
Core protocol
- Bit-accurate Source packet parsing (headers, splits, compression, checksums)
- Network message encoding/decoding both directions
Sniffer example
- Capture live game traffic externally
- Can inject chat messages and console commands to the server
Proxy example
- MITM that sits between client and server
- Decodes and rewrites player movement in real-time (mouse look, movement keys)
- Lets you control a player remotely
- More advanced message control without causing a desync
- Source packet header parsing (seq/ack, flags, challenge, checksum)
- Split packet reassembly
- Compression handling (Source flag + Snappy)
- Bit-level reader/writer matching engine wire format
- Full message set: client → server and server → client
- Proxy (
StartProxy.kt): MITM that decodes/encodes live traffic - Sniffer (
StartSniffer.kt): capture and decode packets from the wire
src/main/kotlin/
├── StartProxy.kt # MITM proxy example
├── StartSniffer.kt # Packet sniffer example (experimental)
├── proxy/ # Proxy implementation
├── packetloader/ # pcap4j capture + BPF
├── packetparser/ # Core protocol parsing
│ ├── PacketParser.kt # Main packet processing
│ ├── SplitPacketHandler.kt
│ └── PacketHeaderHandler.kt
├── messages/ # All netchannel message types
├── messagehandler/ # Message dispatch
├── definitions/ # Protocol constants
└── settings/ # Config
- JDK 17+
- libpcap (macOS/Linux) or packet capture permissions
- Local jars in
./lib/(seebuild.gradle.kts)
./gradlew build- Set target server in
StartProxy.kt:CSSserver("ip:port") - Set listen port:
ProxyServer(listenPort = 6767) - Run
main()from your IDE - Connect your game client via the console command
connect localhost:6767
- Set
SnifferSettings.defaultInterfaceIPinAppSettings.kt - Set ports to monitor
- Uncomment sniffer loop in
StartSniffer.ktand run
- Unreliable messages: fully implemented
- Reliable messages: parsed but ignored (WIP)
- SVC_PacketEntities: not yet parsed (WIP)
- Config: hard-coded (next: CLI/config file)
- Packet dumper: stubbed
- Kotlin/JVM
- pcap4j (capture)
- snappy-java (compression)
- JNA (native bridging)
For research use only. Only inspect traffic you own or have permission to analyze. This project is intentionally user-unfriendly.