Exemple #1
0
def startProfiler(app, output, depth):
    """Profiler handler.

    Will start a profiler on the given application in a specified output with
    a custom depth.

    TODO: Check if it's necessary to add a dummy in case o failed import.

    """

    logger.warning("[!] Faraday will be started with a profiler attached."
                   "Performance may be affected.")

    start = profile(app, filename=output, entries=depth)
    return start
Exemple #2
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()
Exemple #3
0
def startProfiler(app, output, depth):
    """Profiler handler.

    Will start a profiler on the given application in a specified output with
    a custom depth.

    TODO: Check if it's necessary to add a dummy in case o failed import.

    """

    logger.warning("[!] Faraday will be started with a profiler attached."
                   "Performance may be affected.")

    start = profile(app,
                    filename=output,
                    entries=depth)
    return start
Exemple #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()
Exemple #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()