ScanApplication
描述
扫描指定应用程序并执行与扫描相关的其他操作。
语法
ounceauto ScanApplication
-application <name of application>|
-application_file <path to application file>
[-name <assessment name>]
[-scanconfig <scan_configuration_name>]
[-waitforlicense <wait_time>]
[-save <filename>]
[-caller <caller>]
[-publish]
[-clearcache]
[-report <report type> <output format>
<output location>]
[-export <export type> <output location>]
[-includeSrcBefore <n>]
[-includeSrcAfter <n>]
[-includeTraceDefinitive]
on[-includeTraceSuspect]
[-includeTraceCoverage]
[-appserver_type]
[-include_all_lib_jars]
[-include_lib_jars]
[-no_ear_project]
-application <name of application>
或-application_file <path to application file>
:需要其中之一。- 如果指定
-application <name of application>
,请指定要扫描的应用程序的名称。 - 如果指定
-application_file <path to application file>
,请指定以下某个文件类型的完整路径和文件名:- AppScan® 源代码 应用程序文件 (.paf)。
- Eclipse 工作空间 (.ewf)注: 当您使用
openapplication
来打开工作空间目录(通过指定其路径)时,将生成 .ewf 文件。 - WAR 文件 (.war)
- EAR 文件 (.ear)
- 仅适用于 Windows:Microsoft™ Visual C++ Workspace 文件 (.dsw)
- 仅适用于 Windows:Microsoft™ Visual Studio.NET 解决方案文件 (.sln)
注: 要了解 AppScan® Source for Analysis、AppScan® Source for Automation 和 AppScan® Source 命令行界面 支持哪些版本的导入文件,请参阅系统需求和安装必备软件。在此页面中,选择您在使用的 AppScan® 源代码 版本所对应的选项卡,然后选择您在使用的 AppScan® 源代码 组件。如果 AppScan® 源代码 支持从其他开发环境打开和扫描文件,该支持将在受支持软件选项卡的编译器和语言部分中列出。
- 如果指定
-name <assessment name>
:可选。评估的名称。-scanconfig <scan_configuration_name>
:可选。指定要用于扫描的扫描配置的名称。如果未指定扫描配置,那么缺省扫描配置将用于扫描。-waitforlicense <wait_time>
:可选。指定当 AppScan® Source for Automation 许可证不可用时扫描将等待的等待时间(以分钟为单位)。如果未使用-waitforlicense
指示等待时间,则会从CLI.ozsettings
中提取缺省值。可以通过将值设置为 0 来禁用等待时间。-save <filename>
:可选。将评估结果保存到此文件。-caller <caller>
:可选。生成操作指定调用者。调用者可以是实际用户的名称,但不要求如此。调用者名称将写入ounceauto
日志文件。-publish
:可选。扫描后发布评估。-clearcache
:可选。在扫描之前除去漏洞分析高速缓存和定制规则签名数据。-report
:可选。扫描后生成报告。- 必需
-report
命令选项:<report type>
:报告的类型。报告类型包含 Findings 报告、AppScan® 源代码 报告和定制报告。请参阅 GenerateReport 中的选项。<output format>
:指定报告格式。请参阅 GenerateReport 中的选项。<output location>
:用以保存报告的位置。
- 可选
-report
命令选项:-includeSrcBefore <n>
:要包含在每个结果之前的源代码的行数。-includeSrcAfter <n>
:要包含在每个结果之后的源代码的行数。-includeTraceDefinitive
:在明确结果的报告中包含跟踪信息(请参阅 分类 以了解关于结果分类的信息)。-includeTraceSuspect
:在可疑结果的报告中包含跟踪信息。-includeTraceCoverage
:在扫描覆盖范围结果的报告中包含跟踪信息。
- 必需
-export
:可选。将扫描发现结果导出为 CSV 或 SARIF 文件。如果使用,则需要以下命令选项。<export type>
:导出报告的格式(CSV 或 SARIF)。<output location>
:保存报告的路径和文件名。
-appserver_type
:可选。如果要打开的应用程序包含 JavaServer Pages(例如 WAR 或 EAR 文件),使用该设置来指定应用程序服务器以用于 JSP 编译。指定以下某项(用双引号括起):Tomcat 8
Tomcat 9
WebSphere 7.0
WebSphere 8.0
WebSphere 8.5
WebLogic 11g
WebLogic 12c
注:- 指定应用程序之前,确保已在 AppScan® Source for Analysis 首选项中对其进行正确的配置。
- 如果未使用
-appserver_type
,在 AppScan® Source for Analysis 中当前设置的缺省 JSP 编译器将用于 JSP 编译。现成可用的 Tomcat 9 是缺省 JSP 编译器。
- 对于 WAR 文件:
-include_all_lib_jars
:使用该设置可指定 WAR 文件中的要在扫描期间包含的所有库。-include_lib_jars
:使用该设置可指定 WAR 文件中的您需要在扫描期间包含的所有库。使用该设置时,请勿包含库路径信息,并通过逗号分隔多个库。
-no_ear_project
:导入 EAR 文件时,将自动创建用于存储共享库的项目。如果没有共享库,那么将创建项目,但项目将为空。使用该设置时,将不会为 EAR 文件创建项目。
返回值
如果成功,那么返回请求标识;如果请求提交不成功,那么返回 -1。
示例
- 扫描 WebGoat 应用程序,将其发布,然后以 John Smith 作为调用者来注释日志:
ounceauto scanapplication -application_file C:\WebGoat\WebGoat.paf -publish -caller JohnSmith
- 扫描 WebGoat 应用程序并在 C:\WebGoat directory 中创建 Findings 报告。在报告中,包含明确结果的跟踪信息:
ounceauto scanapplication -application WebGoat -report Findings html C:\WebGoat\MyReport.html -includeTraceDefinitive
- 扫描 WAR 文件并仅包含其库中的某些库:
ounceauto scanapplication -application_file c:\mywar.war -include_lib_jars lib1.jar,lib2.jar