Пример #1
0
def startFaraday():
    """Application startup.

    Starts a MainApplication with the previously parsed arguments, and handles
    a profiler if requested.

    Returns application status.

    """
    from model.application import MainApplication

    logger.info("All done. Opening environment.")
    #TODO: Handle args in CONF and send only necessary ones.
    # Force OSX to run no gui
    if sys.platform == "darwin":
        args.gui = "no-gui"

    main_app = MainApplication(args)

    if not args.disable_excepthook:
            logger.warning("Main application ExceptHook enabled.")
            main_app.enableExceptHook()

    if args.profile:
        logger.info("Starting main application with profiler.")
        start = startProfiler(
                main_app.start,
                args.profile_output,
                args.profile_depth)
    else:
        logger.info("Starting main application.")
        start = main_app.start
    from colorama import Fore, Back, Style
    import string
    couchURL = getInstanceConfiguration().getCouchURI()
    if couchURL:
        url = "%s/reports/_design/reports/index.html" % couchURL
        print(Fore.WHITE + Style.BRIGHT + \
            "\n*" + string.center("faraday ui is ready", 53 - 6) )
        print(Fore.WHITE + Style.BRIGHT + \
                """Make sure you got couchdb up and running.\nIf couchdb is up, point your browser to: \n[%s]""" % url) 
    else:
        print(Fore.WHITE + Style.BRIGHT + \
                """Please config Couchdb for fancy HTML5 Dashboard""") 

    print(Fore.RESET + Back.RESET + Style.RESET_ALL)

    exit_status = start()

    return exit_status
Пример #2
0
def startFaraday():
    """Application startup.

    Starts a MainApplication with the previously parsed arguments, and handles
    a profiler if requested.

    Returns application status.

    """
    from model.application import MainApplication

    logger.info("All done. Opening environment.")
    #TODO: Handle args in CONF and send only necessary ones.
    # Force OSX to run no gui
    if sys.platform == "darwin":
        args.gui = "no-gui"

    main_app = MainApplication(args)

    if not args.disable_excepthook:
            logger.warning("Main application ExceptHook enabled.")
            main_app.enableExceptHook()

    if args.profile:
        logger.info("Starting main application with profiler.")
        start = startProfiler(main_app.start,
                              args.profile_output,
                              args.profile_depth)
    else:
        logger.info("Starting main application.")
        start = main_app.start
    from colorama import Fore, Back, Style
    import string
    couchURL = getInstanceConfiguration().getCouchURI()
    if couchURL:
        url = "%s/reports/_design/reports/index.html" % couchURL
        print(Fore.WHITE + Style.BRIGHT + \
            "\n*" + string.center("faraday ui is ready", 53 - 6) )
        print(Fore.WHITE + Style.BRIGHT + \
                """Make sure you got couchdb up and running.\nIf couchdb is up, point your browser to: \n[%s]""" % url)
    else:
        print(Fore.WHITE + Style.BRIGHT + \
                """Please config Couchdb for fancy HTML5 Dashboard (https://github.com/infobyte/faraday/wiki/Couchdb)""")

    print(Fore.RESET + Back.RESET + Style.RESET_ALL)

    exit_status = start()

    return exit_status
Пример #3
0
def main(args):

    parser = optparse.OptionParser()
    setupOptions(parser)
    options, args = parser.parse_args(args[1:])
                                                                     

    if checkDependencies():

        CONF = getInstanceConfiguration()

        CONF.setDebugStatus(False)
        if options.debug:
            CONF.setDebugStatus(True)
        
        if options.host and options.port:
            CONF.setApiConInfo(options.host, int(options.port))
            print "[+] setting api_conn_info = ", CONF.getApiConInfo()
                                                                     
                                   

                                              
                                                   

                                   
                                         
        main_app = MainApplication()

        if options.disablelogin:
            CONF.setAuth(False)

        if not options.disableexcepthook:
            main_app.enableExceptHook()
            
                                                                                                              
                                                                                            
        if options.profile:
            print "%s will be started with a profiler attached. Performance may be affected." % CONF.getAppname()
            start = profile(main_app.start, filename=options.profile_output, entries=int(options.profile_depth))
        else:
            start = main_app.start

        exit_status = start()
                    
        os._exit(exit_status)
    else:
        print "%s cannot start!\nDependecies are not met." % CONF.getAppname()
Пример #4
0
def main(args):

    parser = argparse.ArgumentParser()
    setupOptions(parser)
    args = parser.parse_args(args[1:])

    # TODO: make all the necessary things to handle each option entered...
    if checkDependencies():

        CONF = getInstanceConfiguration()

        CONF.setDebugStatus(False)
        if args.debug:
            CONF.setDebugStatus(True)

        if args.host and args.port:
            CONF.setApiConInfo(args.host, int(args.port))
            print "[+] setting api_conn_info = ", CONF.getApiConInfo()

        main_app = MainApplication(args)

        if args.disablelogin:
            CONF.setAuth(False)

        if not args.disableexcepthook:
            main_app.enableExceptHook()

        # something interesting to do when profiling is mixing
        # the cProfile output with kcachegrind like this:
        # http://stackoverflow.com/questions/1896032/using-cprofile-results-with-kcachegrind
        if args.profile:
            print "%s will be started with a profiler\
                attached. Performance may be affected." % CONF.getAppname()
            start = profile(main_app.start,
                            filename=args.profile_output,
                            entries=int(args.profile_depth))
        else:
            start = main_app.start

        exit_status = start()

        #os._exit(exit_status)
    else:
        print "%s cannot start!\nDependecies are not met." % CONF.getAppname()
Пример #5
0
def main(args):

    parser = argparse.ArgumentParser()
    setupOptions(parser)
    args = parser.parse_args(args[1:])

    # TODO: make all the necessary things to handle each option entered...
    if checkDependencies():

        CONF = getInstanceConfiguration()

        CONF.setDebugStatus(False)
        if args.debug:
            CONF.setDebugStatus(True)

        if args.host and args.port:
            CONF.setApiConInfo(args.host, int(args.port))
            print "[+] setting api_conn_info = ", CONF.getApiConInfo()

        main_app = MainApplication(args)

        if args.disablelogin:
            CONF.setAuth(False)

        if not args.disableexcepthook:
            main_app.enableExceptHook()

        # something interesting to do when profiling is mixing
        # the cProfile output with kcachegrind like this:
        # http://stackoverflow.com/questions/1896032/using-cprofile-results-with-kcachegrind
        if args.profile:
            print "%s will be started with a profiler\
                attached. Performance may be affected." % CONF.getAppname()
            start = profile(main_app.start,
                            filename=args.profile_output,
                            entries=int(args.profile_depth))
        else:
            start = main_app.start

        exit_status = start()

        #os._exit(exit_status)
    else:
        print "%s cannot start!\nDependecies are not met." % CONF.getAppname()
Пример #6
0
def startFaraday():
    """Application startup.

    Starts a MainApplication with the previously parsed arguments, and handles
    a profiler if requested.

    Returns application status.

    """
    from model.application import MainApplication

    logger.info("All done. Opening environment.")
    # TODO: Handle args in CONF and send only necessary ones.

    main_app = MainApplication(args)

    if not args.disable_excepthook:
        logger.info("Main application ExceptHook enabled.")
        main_app.enableExceptHook()

    logger.info("Starting main application.")
    start = main_app.start

    from colorama import Fore, Back, Style
    serverURL = getInstanceConfiguration().getServerURI()
    if serverURL:
        url = "%s/_ui" % serverURL
        print(Fore.WHITE + Style.BRIGHT + "\n* " + "Faraday UI is ready")
        print(Fore.WHITE + Style.BRIGHT +
              "Point your browser to: \n[%s]" % url)

    print(Fore.RESET + Back.RESET + Style.RESET_ALL)

    exit_status = start()

    return exit_status