Ejemplo n.º 1
0
        log.writeLog(str(datetime.datetime.now()) + ' RESET OK')
    elif args.purgelog:
        # Deletes the log file of scutum
        # TODO: delete rotated logs too
        log.purge()
        avalon.info('LOG PURGE OK')
        exit(0)
    elif args.enable or args.disable:
        if args.enable:
            # Enable scutum will write scrips for wicd and network-manager
            # scutum will be started automatically
            log.writeLog(str(datetime.datetime.now()) + " SCUTUM ENABLED")
            if "wicd" in NetworkControllers.split(","):
                installer.installWicdScripts()
            if "NetworkManager" in NetworkControllers.split(","):
                installer.installNMScripts(config["NetworkControllers"]["controllers"].split(","))
            ifaceobjs = []  # a list to store internet controller objects
            os.system('arptables -P INPUT ACCEPT')  # Accept to get Gateway Cached

            for interface in interfaces:
                interface = Adapter(interface, log)
                ifaceobjs.append(interface)

            for interface in ifaceobjs:
                # TODO: pass this operation to background
                # to prevent the halt if scutum is enabled
                # during attempting to connect to a network
                interface.updateArpTables()

            if ufwHandled.lower() == "true":
                # if ufw is handled by scutum, enable it