Example #1
0
    parser.add_argument( '--static', action='store_true', \
                         help='pwospf not employed, so generate full rtable.conf\'s for all routers')   # TODO split line
    parser.add_argument( '-s', '--switch', action='store_true', \
                         help="turn forth into a simple tree topology with four hosts and a switch")  # TODO split line
    parser.add_argument( '-n', '--nointernet', action='store_true', \
                         help="don't connect to the internet")
    args, unknown = parser.parse_known_args( argv )

    lg.setLogLevel( 'info' )
    tyne = Tyne()
    net = Mininet(topo=tyne)

    # NAT to _the internet_
    if (not args.nointernet):
        info( '*** Connecting to the internet (think dial-up modem sound)\n')
        rootnode = connectToInternet( net, switch='s0' )

    # Start mininet and configure each of the hosts
    # (order in list is alphabetical order)
    info( '*** Starting mininet\n' )
    
    # Do router mode configuration
    r0, h0, h1 = net.hosts[2], net.hosts[0], net.hosts[1] 

    # Configure r0 (let the student's code override the Linux network stack &
    #               set MAC addresses of interfaces)
    info( '*** Configuring router network stacks\n' )
    for i in range(3):
        r0.cmd( 'ip addr flush dev r0-eth%d' % i )
        r0.cmd( 'ip -6 addr flush dev r0-eth%d' % i )
        iface_mac = '00:00:00:00:01:'+str(i+1)
Example #2
0
            r2_rtable.add('0.0.0.0', '10.0.3.1', '0.0.0.0',
                          'r2-eth0')  # default route
            r2_rtable.add('10.0.1.0', '10.0.3.1', '255.255.255.0', 'r2-eth0')
            r2_rtable.add('10.0.2.0', '10.0.3.1', '255.255.255.0', 'r2-eth0')
            r2_rtable.add('10.0.3.0', '10.0.3.1', '255.255.255.0', 'r2-eth0')
            r2_rtable.add('10.0.6.1', '10.0.6.1', '255.255.255.255', 'r2-eth2')
            r2_rtable.add('10.0.4.0', '10.0.6.1', '255.255.255.0', 'r2-eth2')
        else:
            info('*** Adding h1 to rtable for r2\n')
        r2_rtable.add('10.0.5.0', '10.0.5.2', '255.255.255.0', 'r2-eth1')
        r2_rtable.createFile('r2-' + args.rtable)

    # NAT to _the internet_
    if (not args.nointernet):
        info('*** Connecting to the internet (think dial-up modem sound)\n')
        rootnode = connectToInternet(net, switch='s0')

    # Start mininet and configure each of the hosts
    # (order in list is alphabetical order)
    info('*** Starting mininet\n')

    # Do router mode configuration
    if (not args.switch):
        r0, r1, r2, h0, h1 = net.hosts[2], net.hosts[3], \
                             net.hosts[4], net.hosts[0], net.hosts[1]

        # Configure r0 (let the student's code override the Linux network stack &
        #               set MAC addresses of interfaces)
        info('*** Configuring router network stacks\n')
        j = 0
        for r in [r0, r1, r2]:
Example #3
0
            print "Error: invalid technique number"
            sys.exit(1)
        elif prevent > 3:
            print "Error: technique not yet implemented"
            sys.exit(1)
    else:
        usage()
        sys.exit(1)

    # Setup the virtualized attack
    with DHCPTopo() as topo:
        net = Mininet(topo=topo, link=TCLink, switch=LinuxBridge,
                controller=None, autoSetMacs=True)
        h1, dhcp, evil, switch = net.get('h1', 'dhcp', 'evil', 's1')
        setupPrivateFS(h1, topo.client_etc, topo.client_var)
        rootnode = connectToInternet(net, inetIntf, 's1')

        try:
            raw_input("Press return after you've started wireshark on s1")

            if prevent == 2:
                clientBlockingConfig(h1, dhcp.MAC())

            # Set up a good DHCP and DNS server
            startGoodDHCPserver(dhcp, gw=rootnode.IP(), dns=dhcp.IP())
            startGoodDNSserver(dhcp)

            if prevent == 1:
                startSwitchBlocking(switch, dhcp.MAC())
            elif prevent == 4:
                startSwitchCouterattack(switch, dhcp.MAC())