scan (sc)

描述

扫描一个应用程序(或所有应用程序)、项目、文件夹(或所有文件夹)或文件。使用此命令需要有效的 AppScan® Source for Automation 许可证。

重要: 如果您所处理的是在开发环境中具有依赖性的 AppScan® 项目(例如 IBM® MobileFirst Platform 项目),请确保在导入该项目之前在开发环境中对其进行构建。导入该项目后,如果您修改其中的文件,请确保在 AppScan® 中进行扫描之前在开发环境中重新构建该项目(如果不执行此操作,那么 AppScan® 将忽略对文件做出的修改)。
注: 扫描文件夹时,缺省情况下将扫描目标文件夹中的所有文件,而不考虑语言。因此,扫描结果可能不同于扫描应用程序或项目。要将特定文件作为目标,请创建 appscan-config.xml 文件以定义扫描目标。当目标文件夹中存在 appscan-config.xml 文件时,扫描过程会自动考虑其中的配置信息。

语法

scan [path][config <proj_config>][-name <assessment_name>][-scanconfig <scan_configuration_name>] [-sourcecodeonly <true/false>] [-enablesecrets <true/false>] [-secretsonly <true/false>] [-waitforlicense <wait_time>]
  • path:可选。所导出评估将另存为的完整路径和文件名 (.ozasmt)。
    注:
    • 如果指定有效目录但不指定文件名,那么将根据应用程序名称、项目名称以及创建评估时使用的扫描配置来为您创建评估文件 (.ozasmt)。
    • 如果指定有效目录但文件名不存在,那么将使用所指定的文件名在该位置创建评估文件。
    • 如果指定已存在的文件,那么将覆盖现有文件。
    • 如果在不存在的目录中指定文件名 (.ozasmt),那么将不保存任何评估。
  • config <proj_config>:可选。此参数仅对项目级别评估有效。如果您的项目具有配置文件,请使用此参数来指定配置文件。
  • -name <assessment_name>:可选。提供评估的名称。该名称在 AppScan® 客户机产品中用于将评估彼此区分开(例如,在 AppScan® 中,该名称将出现在“我的评估”视图的名称列中)。
  • -enablesecrets <true/false>:可选。指定可使用密钥扫描程序(除了其他相关扫描程序外)扫描源文件。有效值为 truefalse
    注: -enablesecrets-secretsonly 是互斥的。 和 不能同时安装。
  • -scanconfig <scan_configuration_name>:可选。指定要用于扫描的扫描配置的名称。如果未指定扫描配置,那么缺省扫描配置将用于扫描。
  • -secretsonly <true/false>:可选。指定可仅使用密钥扫描程序扫描源文件。有效值为 truefalse
    注: -enablesecrets-secretsonly 是互斥的。 和 不能同时安装。
  • -sourcecodeonly <true/false>:可选。指定仅扫描源文件,而忽略其他支持的文件类型(.dll.exe)。有效值为 truefalse
  • -waitforlicense <wait_time>:可选。指定当 AppScan® Source for Automation 许可证不可用时扫描将等待的等待时间(以分钟为单位)。如果未使用 -waitforlicense 指示等待时间,则会从 CLI.ozsettings 中提取缺省值。可以通过将值设置为 0 来禁用等待时间。
注: 只有在文件夹扫描的情况下才支持 -enablesecrets-secretsonly-sourcecodeonly 选项。它不适用于应用程序和项目扫描。

示例

  • 扫描所有应用程序中项目的缺省配置:
    AllApplications>> Scan

    结果显示为:

    New Scan started
    		.
    		.
    Preparing for Vulnerability Analysis...
    Performing Vulnerability Analysis...
    Generating Findings...
    Preparing project for scan...
    		.
    		.
    Scanned Project:
      Total files: 15
      Total findings: 167
      Total lines: 385
    	vkloc: 0.44448395412925595
    	v-Density: 22.446439683527426
    Scanned Application:
      Total files: 15
      Total findings: 167
      Total lines: 385
    	vkloc: 0.44448395412925595
    	v-Density: 22.446439683527426
    Scan completed:
      Total files: 15
      Total findings: 167
      Total lines: 385
    	vkloc: 0.44448395412925595
    	v-Density: 22.446439683527426
    Elapsed Time - 18 Seconds
    New Scan started. Please wait...
    Assessment complete
    -------------------
    Total Call Sites: 75
    Total Definitive Security Findings with High Severity: 25
    Total Definitive Security Findings with Medium Severity: 37
    Total Definitive Security Findings with Low Severity: 9
    Total Suspect Security Findings with High Severity: 20
    Total Suspect Security Findings with Medium Severity: 80
    Total Suspect Security Findings with Low Severity: 60
    Total Scan Coverage Findings with High Severity: 50
    Total Scan Coverage Findings with Medium Severity: 33
    Total Scan Coverage Findings with Low Severity: 17
    Total Lines: 3000
    ...
  • 扫描 Prj1 的调试配置:
    AllApplications\Prj1>> SC config debug
  • 要扫描文件夹,请执行以下操作:
    AllApplications>> of C:\workspace\SimpleIOT
    SimpleIOT>> Scan