Understand the Gnirehtet architecture and networking
masterGnirehtet works by registering an Android client as a VPN to intercept device network traffic.
Data Flow:
- The client (on Android) exchanges raw IPv4 packets as
byte[]with the relay server. - The client maintains a TCP connection to the relay server.
- This connection is established via
adbusing reverse port redirection:
This ensures connections toadb reverse localabstract:gnirehtet tcp:31416localhost:31416on the device are redirected to port31416on the host computer.
Relay Server Role:
- The relay server receives IP packets from connected clients.
- It opens standard sockets on the host to relay data in both directions.
- It performs translation between Layer 3 (device side) and Layer 5 (network side) of the OSI model.
- It acts similarly to a port-restricted cone NAT, opening connections on behalf of private peers.
adb reverse localabstract:gnirehtet tcp:31416