def prepare_patchset(project, patchset, binaries, ips, urls):
    """ Create black/white lists and default / project waivers
        and iterates over patchset file """
    # Get Various Lists / Project Waivers
    lists = get_lists.GetLists()

    # Get file name black list and project waivers
    file_audit_list, file_audit_project_list = lists.file_audit_list(project)

    # Get file content black list and project waivers
    flag_list, ignore_list = lists.file_content_list(project)

    # Get URL Ignore Lists
    url_ignore = lists.url_ignore(project)

    # Get URL Ignore Lists
    ip_ignore = lists.ip_ignore(project)

    # Get File Ignore Lists
    file_ignore = lists.file_ignore()

    # Get Directory Ignore Lists
    ignore_directories = lists.ignore_directories(project)

    if binaries or ips or urls:
        try:
            apikey = os.environ["VT_KEY"]
        except KeyError:
            logger.error("Please set your virustotal.com API key as an environment variable")
            sys.exit(1)
        try:
            vt_rate_type = config.get('config', 'vt_rate_type')
        except six.moves.configparser.NoSectionError:
            logger.error("A config section is required for vt_rate_type with a public | private option ")
            sys.exit(1)

        patten = re.compile(r'\bpublic\b|\bprivate\b')
        if not patten.match(vt_rate_type):
            logger.error("Unrecognized %s option for vt_rate_type", vt_rate_type)
            sys.exit(1)
    else:
        apikey = ""

    # Open patch set to get file list
    try:
        fo = open(patchset, 'r')
        lines = fo.readlines()
    except IOError:
        logger.error('%s does not exist', patchset)
        sys.exit(1)

    for line in lines:
        patch_file = line.strip('\n')
        # Perform binary and file / content checks
        scan_patch(project, patch_file, binaries, ips, urls, file_audit_list,
                   file_audit_project_list, flag_list, ignore_list,
                   file_ignore, ignore_directories, url_ignore, ip_ignore, apikey)

    # Process final result
    process_failure(project)
def prepare_patchset ( project , patchset , binaries , ips , urls ) : lists = get_lists . GetLists ( ) file_audit_list , file_audit_project_list = lists . file_audit_list ( project ) flag_list , ignore_list = lists . file_content_list ( project ) url_ignore = lists . url_ignore ( project ) ip_ignore = lists . ip_ignore ( project ) file_ignore = lists . file_ignore ( ) ignore_directories = lists . ignore_directories ( project ) if binaries or ips or urls : try : apikey = os . environ [ "VT_KEY" ] except KeyError : logger . error ( "Please set your virustotal.com API key as an environment variable" ) sys . exit ( 1 ) try : vt_rate_type = config . get ( 'config' , 'vt_rate_type' ) except six . moves . configparser . NoSectionError : logger . error ( "A config section is required for vt_rate_type with a public | private option " ) sys . exit ( 1 ) patten = re . compile ( r'\bpublic\b|\bprivate\b' ) if not patten . match ( vt_rate_type ) : logger . error ( "Unrecognized %s option for vt_rate_type" , vt_rate_type ) sys . exit ( 1 ) else : apikey = "" try : fo = open ( patchset , 'r' ) lines = fo . readlines ( ) except IOError : logger . error ( '%s does not exist' , patchset ) sys . exit ( 1 ) for line in lines : patch_file = line . strip ( '\n' ) scan_patch ( project , patch_file , binaries , ips , urls , file_audit_list , file_audit_project_list , flag_list , ignore_list , file_ignore , ignore_directories , url_ignore , ip_ignore , apikey ) process_failure ( project )
Create black/white lists and default / project waivers
        and iterates over patchset file