Example #1
0
    def do_EOF(self, line):  # control-D
        print "Exiting..."
        self.aircommunicator.stop_air_communications(True, True, True)
        self.spawnmanager.restore_all()
        os.system('service networking restart')
        os.system('service network-manager restart')
        return True

    # Just overwriting this method so it doesn't execute the last non-empty line
    def emptyline(self):
        pass


if __name__ == '__main__':
    print etfbanners.get_banner()

    if os.geteuid() != 0:
        print "You can't handle this yet."
        sys.exit(1)

    console = ETFConsole()
    console.update_prompt()

    try:
        console.cmdloop()
    except Exception as e:
        print "[-] Exception in command line loop:\n", e
        traceback.print_exc()
        console.aircommunicator.stop_air_communications(True, True, True)
        console.spawnmanager.restore_all()
        print "Closing Session..."
        SessionManager().close_session()
        print "Exiting..."
        os._exit(0)

    # Just overwriting this method so it doesn't execute the last non-empty line
    def emptyline(self):
        pass

    def postcmd(self, stop, line):
        complete_line = readline.get_history_item(readline.get_current_history_length())
        if complete_line.strip() != "":
            SessionManager().log_command(complete_line)

if __name__ == '__main__':
    print etfbanners.get_banner()

    if os.geteuid() != 0:
        print "[-] You can't handle this yet."
        sys.exit(1)

    # Load or Start new Session
    session_manager = SessionManager()
    session_manager.session_prompt()

    # Load console interface (loads info according to session)
    console = ETFConsole(session_manager.get_command_history())
    console.update_prompt()

    try:
        console.cmdloop()