dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java
/**
     * Checks if the file being scanned is a JAR that begins with '#!/bin' which
     * indicates it is a fully executable jar. If a fully executable JAR is
     * identified the input stream will be advanced to the start of the actual
     * JAR file ( skipping the script).
     *
     * @see
     * <a href="http://docs.spring.io/spring-boot/docs/1.3.0.BUILD-SNAPSHOT/reference/htmlsingle/#deployment-install">Installing
     * Spring Boot Applications</a>
     * @param archiveExt the file extension
     * @param in the input stream
     * @throws IOException thrown if there is an error reading the stream
     */
Checks if the file being scanned is a JAR that begins with '#!/bin' which
indicates it is a fully executable jar. If a fully executable JAR is
identified the input stream will be advanced to the start of the actual
JAR file ( skipping the script).

@see
Installing
Spring Boot Applications
@param archiveExt the file extension
@param in the input stream
@throws IOException thrown if there is an error reading the stream
Checks if the file being scanned is a JAR that begins with ' #! / bin ' which indicates it is a fully executable jar . If a fully executable JAR is identified the input stream will be advanced to the start of the actual JAR file ( skipping the script ) . @see Installing Spring Boot Applications @param archiveExt the file extension @param in the input stream @throws IOException thrown if there is an error reading the stream
private void ensureReadableJar(final String archiveExt, BufferedInputStream in) throws IOException {
        if ("jar".equals(archiveExt) && in.markSupported()) {
            in.mark(7);
            final byte[] b = new byte[7];
            final int read = in.read(b);
            if (read == 7
                    && b[0] == '#'
                    && b[1] == '!'
                    && b[2] == '/'
                    && b[3] == 'b'
                    && b[4] == 'i'
                    && b[5] == 'n'
                    && b[6] == '/') {
                boolean stillLooking = true;
                int chr;
                int nxtChr;
                while (stillLooking && (chr = in.read()) != -1) {
                    if (chr == '\n' || chr == '\r') {
                        in.mark(4);
                        if ((chr = in.read()) != -1) {
                            if (chr == 'P' && (chr = in.read()) != -1) {
                                if (chr == 'K' && (chr = in.read()) != -1) {
                                    if ((chr == 3 || chr == 5 || chr == 7) && (nxtChr = in.read()) != -1) {
                                        if (nxtChr == chr + 1) {
                                            stillLooking = false;
                                            in.reset();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                in.reset();
            }
        }
    }
private void ensureReadableJar ( final String archiveExt , BufferedInputStream in ) throws IOException { if ( "jar" . equals ( archiveExt ) && in . markSupported ( ) ) { in . mark ( 7 ) ; final byte [ ] b = new byte [ 7 ] ; final int read = in . read ( b ) ; if ( read == 7 && b [ 0 ] == '#' && b [ 1 ] == '!' && b [ 2 ] == '/' && b [ 3 ] == 'b' && b [ 4 ] == 'i' && b [ 5 ] == 'n' && b [ 6 ] == '/' ) { boolean stillLooking = true ; int chr ; int nxtChr ; while ( stillLooking && ( chr = in . read ( ) ) != - 1 ) { if ( chr == '\n' || chr == '\r' ) { in . mark ( 4 ) ; if ( ( chr = in . read ( ) ) != - 1 ) { if ( chr == 'P' && ( chr = in . read ( ) ) != - 1 ) { if ( chr == 'K' && ( chr = in . read ( ) ) != - 1 ) { if ( ( chr == 3 || chr == 5 || chr == 7 ) && ( nxtChr = in . read ( ) ) != - 1 ) { if ( nxtChr == chr + 1 ) { stillLooking = false ; in . reset ( ) ; } } } } } } } } else { in . reset ( ) ; } } }
Checks if the file being scanned is a JAR that begins with '#!/bin' which
 indicates it is a fully executable jar.
Checks if the file being scanned is a JAR that begins with ' #! / bin ' which indicates it is a fully executable jar .