dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.java
/**
     * Analyzes python packages and adds evidence to the dependency.
     *
     * @param dependency the dependency being analyzed
     * @param engine the engine being used to perform the scan
     * @throws AnalysisException thrown if there is an unrecoverable error
     * analyzing the dependency
     */
Analyzes python packages and adds evidence to the dependency.
@param dependency the dependency being analyzed
@param engine the engine being used to perform the scan
@throws AnalysisException thrown if there is an unrecoverable error
analyzing the dependency
Analyzes python packages and adds evidence to the dependency . @param dependency the dependency being analyzed @param engine the engine being used to perform the scan @throws AnalysisException thrown if there is an unrecoverable error analyzing the dependency
@Override
    protected void analyzeDependency(Dependency dependency, Engine engine)
            throws AnalysisException {
        final File file = dependency.getActualFile();
        final String parentName = file.getParentFile().getName();
        final String name = file.getName();
        dependency.setDisplayFileName(String.format("%s%c%s", parentName, File.separatorChar, name));
        String contents;
        try {
            contents = FileUtils.readFileToString(file, Charset.defaultCharset()).trim();
        } catch (IOException e) {
            throw new AnalysisException(
                    "Problem occurred while reading dependency file.", e);
        }
        if (StringUtils.isNotBlank(contents)) {
            final Matcher m = PROJECT.matcher(contents);
            int count = 0;
            while (m.find()) {
                count++;
                LOGGER.debug(String.format(
                        "Found project command match with %d groups: %s",
                        m.groupCount(), m.group(0)));
                final String group = m.group(1);
                LOGGER.debug("Group 1: {}", group);
                dependency.getProductEvidence().addEvidence(name, "Project",
                        group, Confidence.HIGH);
            }
            LOGGER.debug("Found {} matches.", count);
            analyzeSetVersionCommand(dependency, engine, contents);
        }
    }
@ Override protected void analyzeDependency ( Dependency dependency , Engine engine ) throws AnalysisException { final File file = dependency . getActualFile ( ) ; final String parentName = file . getParentFile ( ) . getName ( ) ; final String name = file . getName ( ) ; dependency . setDisplayFileName ( String . format ( "%s%c%s" , parentName , File . separatorChar , name ) ) ; String contents ; try { contents = FileUtils . readFileToString ( file , Charset . defaultCharset ( ) ) . trim ( ) ; } catch ( IOException e ) { throw new AnalysisException ( "Problem occurred while reading dependency file." , e ) ; } if ( StringUtils . isNotBlank ( contents ) ) { final Matcher m = PROJECT . matcher ( contents ) ; int count = 0 ; while ( m . find ( ) ) { count ++ ; LOGGER . debug ( String . format ( "Found project command match with %d groups: %s" , m . groupCount ( ) , m . group ( 0 ) ) ) ; final String group = m . group ( 1 ) ; LOGGER . debug ( "Group 1: {}" , group ) ; dependency . getProductEvidence ( ) . addEvidence ( name , "Project" , group , Confidence . HIGH ) ; } LOGGER . debug ( "Found {} matches." , count ) ; analyzeSetVersionCommand ( dependency , engine , contents ) ; } }
Analyzes python packages and adds evidence to the dependency.
Analyzes python packages and adds evidence to the dependency .