Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.system('sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination ' + local_ip + ':8888')
- os.system('sudo iptables -A FORWARD -p tcp --dport 80 -j ACCEPT')
- PORT = 8888
- class Proxy(http.server.SimpleHTTPRequestHandler):
- def do_GET(self):
- full_path = 'http:/' + self.path
- print(full_path)
- req = urllib.request.urlopen(full_path)
- self.copyfile(req, self.wfile)
- httpd = socketserver.ForkingTCPServer((local_ip, PORT), Proxy)
- print("serving at port ", PORT)
- httpd.serve_forever()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement