Esempio n. 1
0
File: owtf.py Progetto: wuyasec/owtf
def main(args):
    banner()

    # Get tool path from script path:
    root_dir = os.path.dirname(os.path.abspath(args[0])) or '.'
    owtf_pid = os.getpid()
    if "--update" not in args[1:]:
        try:
            ComponentInitialiser.initialisation_phase_1(root_dir, owtf_pid)
        except DatabaseNotRunningException:
            exit(-1)

        args = process_options(args[1:])
        ServiceLocator.get_component("config").ProcessOptionsPhase1(args)
        ComponentInitialiser.initialisation_phase_2(args)

        # Initialise Framework.
        core = Core()
        logging.warn(
            "OWTF Version: %s, Release: %s " %
            (ServiceLocator.get_component("config").FrameworkConfigGet(
                'VERSION'), ServiceLocator.get_component(
                    "config").FrameworkConfigGet('RELEASE')))
        run_owtf(core, args)
    else:
        # First confirming that --update flag is present in args and then
        # creating a different parser for parsing the args.
        try:
            arg = parse_update_options(args[1:])
        except Exception as e:
            usage("Invalid OWTF option(s) %s" % e)
        # Updater class is imported
        updater = update.Updater(root_dir)
        # If outbound proxy is set, those values are added to updater.
        if arg.OutboundProxy:
            if arg.OutboundProxyAuth:
                updater.set_proxy(arg.OutboundProxy,
                                  proxy_auth=arg.OutboundProxyAuth)
            else:
                updater.set_proxy(arg.OutboundProxy)
        # Update method called to perform update.
        updater.update()
Esempio n. 2
0
        Core.CleanTempStorageDirs(Core.Config.OwtfPid)


if __name__ == "__main__":
    Banner()
    if not "--update" in sys.argv[1:]:
        Core = core.Init(RootDir, OwtfPid)  # Initialise Framework
        print("OWTF Version: %s, Release: %s " %
              (Core.Config.Get('VERSION'), Core.Config.Get('RELEASE')),
              end='\n' * 2)
        args = ProcessOptions(Core, sys.argv[1:])
        run_owtf(Core, args)
    else:
        # First confirming that --update flag is present in args and then
        # creating a different parser for parsing the args.
        try:
            Arg = GetArgsForUpdate(sys.argv[1:])
        except Exception as e:
            Usage("Invalid OWTF option(s) " + e)
        # Updater class is imported
        UpdaterObj = update.Updater(RootDir)
        # If outbound proxy is set, those values are added to Updater Object
        if Arg.OutboundProxy:
            if Arg.OutboundProxyAuth:
                UpdaterObj.set_proxy(Arg.OutboundProxy,
                                     proxy_auth=Arg.OutboundProxyAuth)
            else:
                UpdaterObj.set_proxy(Arg.OutboundProxy)
        # Update method called to perform update
        UpdaterObj.update()
Esempio n. 3
0
    root_dir = os.path.dirname(os.path.abspath(sys.argv[0])) or '.'
    owtf_pid = os.getpid()
    if not "--update" in sys.argv[1:]:
        core = core.Init(root_dir, owtf_pid)  # Initialise Framework.
        logging.warn(
            "OWTF Version: %s, Release: %s " % (
                core.Config.FrameworkConfigGet('VERSION'),
                core.Config.FrameworkConfigGet('RELEASE'))
            )
        args = process_options(core, sys.argv[1:])
        run_owtf(core, args)
    else:
        # First confirming that --update flag is present in args and then
        # creating a different parser for parsing the args.
        try:
            arg = get_args_for_update(sys.argv[1:])
        except Exception as e:
            usage("Invalid OWTF option(s) " + e)
        # Updater class is imported
        updater = update.Updater(root_dir)
        # If outbound proxy is set, those values are added to updater.
        if arg.OutboundProxy:
            if arg.OutboundProxyAuth:
                updater.set_proxy(
                    arg.OutboundProxy,
                    proxy_auth=arg.OutboundProxyAuth)
            else:
                updater.set_proxy(arg.OutboundProxy)
        # Update method called to perform update.
        updater.update()