Answer the question
In order to leave comments, you need to log in
How to change TCP packet on the fly?
Hello.
There is a program that sets up a tcp socket with a server and sends unencrypted data. You need to change the data before sending it to the server.
I tried to make a proxy in C # but the program notices that the proxy is on the local IP and stops working, so the only way out is packet spoofing. How to do it? Is this some kind of spoofing? Does anyone know open source examples (preferably in C# or Java or C++)? Or which one to look for?
Answer the question
In order to leave comments, you need to log in
but the program notices that the proxy is on the local IP and stops working
Put hooks on socket functions like send/sendto/recv/recvfrom. And they can change anything.
If there is a Linux gateway between the server to which the data is sent and the program itself, then, in theory, you can install nfqsed and, when sending from the gateway to the program server, change the values of interest in real time.
Here is a small article that describes almost a similar case. I personally tried it for a similar situation and everything works like clockwork with unencrypted packets.
https://sysadmin.ru/articles/changeyaem-soderzhimoe...
Tested on linux, namely substitution of a dot at the end of a demen in HTTP:
https://hastebin.com/quloxoxuhe.cpp
Compilation: gcc http_inject.c -o http_inject -lnetfilter_queue;
Set the iptables rule to OUTPUT and run: iptables -A OUTPUT -j NFQUEUE --queue-num 0; ./http_inject
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question