Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. os.system('sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination ' + local_ip + ':8888')
  2. os.system('sudo iptables -A FORWARD -p tcp --dport 80 -j ACCEPT')
  3.  
  4. PORT = 8888
  5.  
  6. class Proxy(http.server.SimpleHTTPRequestHandler):
  7. def do_GET(self):
  8. full_path = 'http:/' + self.path
  9. print(full_path)
  10. req = urllib.request.urlopen(full_path)
  11. self.copyfile(req, self.wfile)
  12.  
  13. httpd = socketserver.ForkingTCPServer((local_ip, PORT), Proxy)
  14. print("serving at port ", PORT)
  15. httpd.serve_forever()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement