Skip to content

Binary Scanning via Command Line (Java)

Important

You must open the command line as an Administrator.

Run the approriate agent script

/opt/codelogic/java# ./run_agent.sh
C:\Program Files (x86)\CodeLogic\java>run_agent.bat

Analyze an application

analyze -a yourApp -t ARCHIVE -f /locationToYourApp/app.jar
analyze -a yourApp -d jdbc:postgresql://localhost:5432/sampledb -t ARCHIVE -f /locationToYourApp/app.jar

Help options for the CodeLogic Java Agent

codelogic-java:>help 

NAME
    analyze - 
            Analyze java artifacts on demand. This command requires parameters
            in interactive or commandline mode. Values from the agent
            configuration are ignored.

SYNOPSYS
    analyze [-a] string  [-p] string  [[-t] string]  [[-o] string]  [[--depth] integer]  [[-f] string]  [[-r] string]  [[-d] string]  [[-m] string]  [--rescan]  [-e]  [[-s] string]  

OPTIONS
    -a or --application  string
        The Application node to create that will be the parent of all objects found in the scan.
        The value is a comma-separated list of 'Application' semantic names.
        Semantic names may be anything you wish if creating a new application.
        If linking grouping to an existing application,the semantic name is its 'identity' minus the 'grouping:' prefix.
        Identities for items may be found in the 'Item Details' page of the CodeLogic UI.
        [Mandatory]

    -p or --path  string
        A comma-separated list of absolute filepaths to analyze or scan.
        [Mandatory]

    -t or --type  string
        'SCAN' - automatically search for archives
        'ARCHIVE' - specify a Java archive to analyze (.jar,.war,.ear)
        'FILE' - (deprecated) Specify a file to analyze. Usually a .class file.
        [Optional, default = SCAN]

    -o or --output  string
        'API_CSV' - Batch data locally in CSV zipped in the auxiliary directory. Upload the zip to the api when finished.
        'CSV' - Batch data locally in CSV files zipped in the auxiliary directory.
        [Optional, default = API_CSV]

    --depth  integer
        During scanning, this value will be used as the depth of subdirectories to traverse before stopping.
        [Optional, default = 500]

    -f or --filter  string
        A comma-separated list of partial filenames that will cause an artifact to be marked for
        analysis during a SCAN if the artifact's filename contains the filter.
        Wildcards are not supported.
        [Optional, default = <none>]

    -r or --recursive  string
        A comma-separated list of substrings to key off of to trigger recursive analysis (jar within jar).
        Ex: 'codelogic,spring' would match 'codelogic-core-services.jar' and 'spring-data-jpa.jar'.
        The star character '*' may be used to match all jars recursively. Warning: expensive operation.
        [Optional, default = <none>]

    -d or --database  string
        A comma-separated list of database identities to use in the creation of relationships.
        These database identities will only be used if the scan finds tables and columns but cannot find
        the related database connection. One example where this may happen is with external configuration files.
        [Optional, default = <none>]

    -m or --method-filter  string
        A comma-separated list of Java package prefixes that should be included in
        method-invokes-method relationships. By default no packages are included in method-to-method scanning.
        [Optional, default = <none>]

    --rescan    [Flag Parameter: 'true' if option is specified.]

        Normally to speed up analysis, archives already detected in the CodeLogic DB are skipped.
        With this flag, all archives that match filters will be scanned regardless.
        [Optional, default = false]

    -e or --expunge-scan-sessions
        [Flag Parameter: 'true' if option is specified.]

        Instruct the server to delete all other scan sessions created
        by this agent and its configuration after the current scan
        session has completed successfully.
        [Optional, default = false]

    -s or --scan-space-name  string
        The name of the scan space that the data will be saved to.
        If specified, a ScanSpace with this name will be created if not found.
        If not specified, information will be saved to the default ScanSpace.
        [Optional, default = <none>]