import sys
import os
from .util import bcolors, clear, RepresentsInt
from ..attack.mitm import start
from ..attack.wifi import normalMode, monitorMode, startWifi
from ..attack.rat import listen

import atexit

@atexit.register
def restore():
    interface = os.popen('ship -i').read()

    # Array of interfaces
    interArr = os.popen('ship -A').read().split(' ')

    if 'Local' in interface:
        interface = interArr[1]

    # Retore wifi
    if 'mon' in interface:
        normalMode(interface)
        print(bcolors.OKGREEN + "\nRestoring system settings." + bcolors.ENDC)


def run():

    clear()

    # Print loaded modules
    printModule()

    # Take user input as int
    choice = input("\n" + bcolors.BOLD +
                   "Please choose an option\n> " + bcolors.ENDC)

    if (RepresentsInt(choice)):
        # Convert in int
        choice = int(choice)

        # Run list
        if choice == 1:
            clear()
            # print(bcolors.FAIL + "WIP" + bcolors.ENDC)
            startWifi()
            run()
        elif choice == 2:

            clear()
            # run mitm
            start()

            # Recursion
            run()
        elif choice == 3:
            clear()

            # Run RAT Listener
            listen()

            run()

        elif choice == 4:
            clear()
            print(bcolors.OKGREEN + "Goodbye!" + bcolors.ENDC)
            sys.exit(0)
        else:
            clear()
            print(bcolors.FAIL + "Please input a valid option." + bcolors.ENDC)
            run()

    else:
        clear()
        print(bcolors.FAIL + "Please input a valid option." + bcolors.ENDC)

        # Recusive loop
        run()


def printModule():
    print(str(bcolors.HEADER + "Loaded Modules: " + bcolors.ENDC))
    print("1) WiFi Module")
    print("2) MITM Module")
    print("3) RAT Module")
    print("4) Exit boa")



193a8e967fc4c9a8421f53f9f9a9023c29fe24ca
<mask token>


def printModule():
    print(str(bcolors.HEADER + 'Loaded Modules: ' + bcolors.ENDC))
    print('1) WiFi Module')
    print('2) MITM Module')
    print('3) RAT Module')
    print('4) Exit boa')

<mask token>


def run():
    clear()
    printModule()
    choice = input('\n' + bcolors.BOLD + 'Please choose an option\n> ' +
        bcolors.ENDC)
    if RepresentsInt(choice):
        choice = int(choice)
        if choice == 1:
            clear()
            startWifi()
            run()
        elif choice == 2:
            clear()
            start()
            run()
        elif choice == 3:
            clear()
            listen()
            run()
        elif choice == 4:
            clear()
            print(bcolors.OKGREEN + 'Goodbye!' + bcolors.ENDC)
            sys.exit(0)
        else:
            clear()
            print(bcolors.FAIL + 'Please input a valid option.' + bcolors.ENDC)
            run()
    else:
        clear()
        print(bcolors.FAIL + 'Please input a valid option.' + bcolors.ENDC)
        run()


def printModule():
    print(str(bcolors.HEADER + 'Loaded Modules: ' + bcolors.ENDC))
    print('1) WiFi Module')
    print('2) MITM Module')
    print('3) RAT Module')
    print('4) Exit boa')

<mask token>


@atexit.register
def restore():
    interface = os.popen('ship -i').read()
    interArr = os.popen('ship -A').read().split(' ')
    if 'Local' in interface:
        interface = interArr[1]
    if 'mon' in interface:
        normalMode(interface)
        print(bcolors.OKGREEN + '\nRestoring system settings.' + bcolors.ENDC)


def run():
    clear()
    printModule()
    choice = input('\n' + bcolors.BOLD + 'Please choose an option\n> ' +
        bcolors.ENDC)
    if RepresentsInt(choice):
        choice = int(choice)
        if choice == 1:
            clear()
            startWifi()
            run()
        elif choice == 2:
            clear()
            start()
            run()
        elif choice == 3:
            clear()
            listen()
            run()
        elif choice == 4:
            clear()
            print(bcolors.OKGREEN + 'Goodbye!' + bcolors.ENDC)
            sys.exit(0)
        else:
            clear()
            print(bcolors.FAIL + 'Please input a valid option.' + bcolors.ENDC)
            run()
    else:
        clear()
        print(bcolors.FAIL + 'Please input a valid option.' + bcolors.ENDC)
        run()


def printModule():
    print(str(bcolors.HEADER + 'Loaded Modules: ' + bcolors.ENDC))
    print('1) WiFi Module')
    print('2) MITM Module')
    print('3) RAT Module')
    print('4) Exit boa')

import sys
import os
from .util import bcolors, clear, RepresentsInt
from ..attack.mitm import start
from ..attack.wifi import normalMode, monitorMode, startWifi
from ..attack.rat import listen
import atexit


@atexit.register
def restore():
    interface = os.popen('ship -i').read()
    interArr = os.popen('ship -A').read().split(' ')
    if 'Local' in interface:
        interface = interArr[1]
    if 'mon' in interface:
        normalMode(interface)
        print(bcolors.OKGREEN + '\nRestoring system settings.' + bcolors.ENDC)


def run():
    clear()
    printModule()
    choice = input('\n' + bcolors.BOLD + 'Please choose an option\n> ' +
        bcolors.ENDC)
    if RepresentsInt(choice):
        choice = int(choice)
        if choice == 1:
            clear()
            startWifi()
            run()
        elif choice == 2:
            clear()
            start()
            run()
        elif choice == 3:
            clear()
            listen()
            run()
        elif choice == 4:
            clear()
            print(bcolors.OKGREEN + 'Goodbye!' + bcolors.ENDC)
            sys.exit(0)
        else:
            clear()
            print(bcolors.FAIL + 'Please input a valid option.' + bcolors.ENDC)
            run()
    else:
        clear()
        print(bcolors.FAIL + 'Please input a valid option.' + bcolors.ENDC)
        run()


def printModule():
    print(str(bcolors.HEADER + 'Loaded Modules: ' + bcolors.ENDC))
    print('1) WiFi Module')
    print('2) MITM Module')
    print('3) RAT Module')
    print('4) Exit boa')

import sys
import os
from .util import bcolors, clear, RepresentsInt
from ..attack.mitm import start
from ..attack.wifi import normalMode, monitorMode, startWifi
from ..attack.rat import listen

import atexit

@atexit.register
def restore():
    interface = os.popen('ship -i').read()

    # Array of interfaces
    interArr = os.popen('ship -A').read().split(' ')

    if 'Local' in interface:
        interface = interArr[1]

    # Retore wifi
    if 'mon' in interface:
        normalMode(interface)
        print(bcolors.OKGREEN + "\nRestoring system settings." + bcolors.ENDC)


def run():

    clear()

    # Print loaded modules
    printModule()

    # Take user input as int
    choice = input("\n" + bcolors.BOLD +
                   "Please choose an option\n> " + bcolors.ENDC)

    if (RepresentsInt(choice)):
        # Convert in int
        choice = int(choice)

        # Run list
        if choice == 1:
            clear()
            # print(bcolors.FAIL + "WIP" + bcolors.ENDC)
            startWifi()
            run()
        elif choice == 2:

            clear()
            # run mitm
            start()

            # Recursion
            run()
        elif choice == 3:
            clear()

            # Run RAT Listener
            listen()

            run()

        elif choice == 4:
            clear()
            print(bcolors.OKGREEN + "Goodbye!" + bcolors.ENDC)
            sys.exit(0)
        else:
            clear()
            print(bcolors.FAIL + "Please input a valid option." + bcolors.ENDC)
            run()

    else:
        clear()
        print(bcolors.FAIL + "Please input a valid option." + bcolors.ENDC)

        # Recusive loop
        run()


def printModule():
    print(str(bcolors.HEADER + "Loaded Modules: " + bcolors.ENDC))
    print("1) WiFi Module")
    print("2) MITM Module")
    print("3) RAT Module")
    print("4) Exit boa")


