I have some TCP streams which are only going over my linux box. In theory, it only packet forwards them. Now some new idea happened on which now I think, it would be much better to also alter their content.
My idea is that the forwarded tcp stream should be handled as if it would be an incoming stream, and then processed by my own tools.
peterh's user avatar peterh 9,7881818 gold badges6262 silver badges9292 bronze badges
In my specific case, goal is to transfer the outgoing stream of a tool to the tor network, while the tool does not know it (and it is not even running on my linux box). Note, it is an encrypted tcp stream and not http. I have already setup to transfer any tcp stream to the tor network (tor proxy). Next task is to let the app think, it is communicating with the outer world, while in fact it is communicating with my tor proxy. The question is intentionally formulated to handle the generic case (hijacking forwarded tcp streams), please answerers consider that.
Is it somehow possible? I think, somehow the packet should be handled as if it had been sent to the machine and not for forwarding, in an early phase of the handling of the incoming packets.