daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top