Exemple #1
0
def parsing_argument(args):
    if not args.client:
        if not utils.connection_check('127.0.0.1', 5000):
            p = Process(target=flask_run)
            p.start()
            # wait for flask API start
            time.sleep(2)
        else:
            utils.print_info("Look like Flask API already ran")

    # parsing agument
    if args.config:
        config_path = args.config
        options = config.parsing_config(config_path, args)

    if options['TARGET_LIST'] != "None":
        # check if target list file exist and loop throught the target
        targetlist = utils.just_read(options.get('TARGET_LIST'))
        if targetlist:
            for target in targetlist.splitlines():
                options['TARGET'] = target
                single_target(options)
                utils.print_target(options.get('TARGET'))
    else:
        single_target(options)
Exemple #2
0
def parsing_report(options):
    global headers
    mode = options.get('REPORT').lower()
    modes = [
        'full', 'raw', 'short', 'raw_html', 'list', 'ls', 'path', 'summary',
        'sum'
    ]

    if mode not in modes:
        report_help()
        return None
    if not utils.connection_check('127.0.0.1', 5000):
        utils.print_info(
            "Look like API not turn on, reading from local log instead.")
    else:
        options['JWT'] = utils.get_jwt(options)
        headers['Authorization'] = options['JWT']

    # mapping mode
    if 'list' in mode or 'ls' in mode:
        workspace_list(options)
    elif 'path' in mode:
        short_report(options)
    elif 'short' in mode:
        short_report(options)
    elif 'full' in mode:
        full_report(options)
    elif 'raw' in mode:
        full_report(options)
    elif 'sum' in mode:
        summary_report(options)