使用命令通过终端工具进行系统迁移应用系统成分信息收集。
1 | devkit sys-mig -c,--command sbom -cf,--config configure_file_path -d,--directory scan_path -o,--output report_dir -f,--format {html/json} -e,--exclude-fields {version/checkOutPath} -mn,--multi-node group_name -l,--log-level {0/1/2/3} -pid,--process_id pid -pname,--process_name pname -ec,--encipher -v,--version -h,--help |
1 | sys-mig.exe -c,--command sbom -cf,--config configure_file_path -d,--directory scan_path -o,--output report_dir -f,--format {html/json} -e,--exclude-fields {version/checkOutPath} -l,--log-level {0/1/2/3} -v,--version -h,--help |
参数 |
参数选项 |
说明 |
---|---|---|
-h/--help |
- |
获取帮助信息。 |
-c/--command |
stmt/sbom/mvn_analyse |
收集信息的模式。
|
-cf/--config |
- |
输入参数配置文件路径。支持通过配置文件方式输入参数,默认模板位置为“sys-mig/resources/sysmig_default.conf”,具体使用示例请参见配置文件使用示例。 |
-d/--directory |
- |
输入扫描文件目录,支持输入多个目录,多个目录间以空格分隔。 例如:/home/test1 /home/test2。 |
-o/--output |
- |
报告输出目录,默认为sys-mig二进制所在report目录。 例如:/home/report。 |
-f/--format |
html/json |
扫描报告的格式,默认为html。支持选择多个报告格式,多个报告格式以空格间隔。
|
-e/--exclude-fields |
version/checkOutPath |
表示需要隐藏的参数信息。支持同时选择,多个参数信息以空格间隔。
|
-l/--log-level |
0/1/2/3 |
设置日志级别,默认为1。
|
-mn/--multi-node |
all/ungrouped/groupName |
远程扫描服务器的组名,仅支持Linux环境。配置文件为“sys-mig/nodes/nodes.conf”,具体格式请参见配置文件使用说明(-mn/--multi-node)。 说明:
所有组都放在all组下,未分组的服务器配置放在ungrouped组下。 |
-ec/--encipher |
- |
输入需要加密的文本。 |
-pid/--process_id |
- |
该参数仅适用于Java应用程序。动态扫描指定进程ID的Java应用程序,与-pname无对应关系,支持输入多个PID,多个PID以空格分隔。 |
-pname/--process_name |
- |
该参数仅适用于Java应用程序。动态扫描指定进程名称的Java应用程序,与-pid无对应关系,支持输入多个进程名称,多个进程名称以空格分隔。 |
-v/--version |
- |
展示程序版本信息,无需输入参数。 |
1 | devkit sys-mig -c sbom -d /home/jar -o /home/report |
返回信息如下:
[2024-05-14 16:26:17,245] [INFO] Start to execute the command: ./devkit sys-mig -c sbom -d /home/jar -o /home/report -f html -l 1 [2024-05-14 16:26:17,245] [INFO] Creating file indexing... [2024-05-14 16:26:17,252] [INFO] Parsing... [2024-05-14 16:26:17,252] [INFO] Middleware binary start analysis. [2024-05-14 16:26:17,252] [INFO] Middleware binary end of analysis. [2024-05-14 16:26:17,253] [INFO] Middleware package start analysis. [2024-05-14 16:26:17,253] [INFO] Middleware package end of analysis. [2024-05-14 16:26:17,253] [INFO] Java software package start analysis. [2024-05-14 16:26:17,254] [INFO] Scan completed successfully. Clear the tmp directory. [2024-05-14 16:26:17,254] [INFO] Analyzing. The dependency is being established. [2024-05-14 16:26:17,254] [INFO] Analysis completed. Converting to the standardized sbom format. [2024-05-14 16:26:17,254] [INFO] Converted to the standard sbom format successfully. [2024-05-14 16:26:17,254] [INFO] Java software package end of analysis. [2024-05-14 16:26:17,255] [INFO] Start parsing hardware info ... [2024-05-14 16:26:17,255] [INFO] Parsing CPU info. [2024-05-14 16:26:17,374] [INFO] Parsing memory info. [2024-05-14 16:26:17,375] [INFO] Parsing disk info. [2024-05-14 16:26:17,376] [INFO] Parsing hardware info succeed. [2024-05-14 16:26:17,376] [INFO] Start parsing OS info ... [2024-05-14 16:26:17,376] [INFO] Parsing kernel info. [2024-05-14 16:26:17,389] [INFO] Parsing kernel modules. [2024-05-14 16:26:17,396] [INFO] 86 kernel modules in total, please wait. [2024-05-14 16:26:17,689] [INFO] Parsing rpm packages. [2024-05-14 16:26:17,834] [INFO] 698 rpm packages in total, please wait. [2024-05-14 16:26:23,946] [INFO] Parsing OS info succeed. Html report is created successfully. The file is located in /home/report/sys-mig_xx.xx.xx.xx_20240514162617/sbom.html. Json file is created successfully. The file is located in /home/report/sys-mig_xx.xx.xx.xx_20240514162617/sbom.json.
用户需提前获取目标服务器的IP地址、SSH相关的用户名/密码/端口、扫描地址。当目标服务器与本地服务器架构不一致时,需要准备可适配目标服务器执行信息收集的软件包,架构可通过uname -a查看。
1 | devkit sys-mig -ec |
按照提示输入需要加密的文本:
1 2 3 4 | please enter the password(the password must contain a maximum of 32 characters): Initializing the working key... Please wait. encrypted password: *********************************************************************** |
group1分组下为192.168.0.2/192.168.0.3两个节点,group2分组下为192.168.0.4,group2为group1的子节点,可以继承[group1:vars]中参数配置。
1 2 3 4 5 6 7 8 9 10 | [group1] 192.168.0.2 ssh_pass=**** scan_dir=/home 192.168.0.3 ssh_pass=**** scan_dir=/home/test,/home/test1 [group1:vars] ssh_user=root ssh_port=22 [group2] 192.168.0.4 ssh_pass=**** scan_dir=/home/test [group1:children] group2 |
1 | devkit sys-mig -c sbom -d /home/software -mn all |
返回信息如下:
[2024-05-27 11:34:12,449] [INFO] Start to execute the command: ./devkit sys-mig -c sbom -d /home/software -o /usr/local/devkit/sys-mig/report -f html json -l 1 -mn all [2024-05-27 11:34:12,449] [INFO] Creating file indexing... [2024-05-27 11:34:12,469] [INFO] Parsing... [2024-05-27 11:34:12,510] [INFO] [multi_node] 192.168.0.2 Connecting to the server... [2024-05-27 11:34:12,512] [INFO] [multi_node] 192.168.0.3 Connecting to the server... [2024-05-27 11:34:12,512] [INFO] Middleware binary start analysis. [2024-05-27 11:34:12,513] [INFO] [multi_node] 192.168.0.4 Connecting to the server... [2024-05-27 11:34:12,513] [INFO] Middleware binary end of analysis. [2024-05-27 11:34:12,514] [INFO] Middleware package start analysis. [2024-05-27 11:34:12,515] [INFO] Middleware package end of analysis. [2024-05-27 11:34:12,515] [INFO] Java software package start analysis. [2024-05-27 11:34:12,530] [INFO] Start scanning file: mixed.zip. [2024-05-27 11:34:12,531] [INFO] Start scanning file: apache-tomcat-9.0.29.tar.gz. [2024-05-27 11:34:12,534] [INFO] Start scanning file: snappy-java-1.0.5.jar. [2024-05-27 11:34:12,717] [INFO] Start scanning file: netty-transport-4.1.55.Final.jar. [2024-05-27 11:34:12,734] [INFO] [multi_node] 192.168.0.2 Successfully connected to the server. [2024-05-27 11:34:12,831] [INFO] [multi_node] 192.168.0.4 Successfully connected to the server. [2024-05-27 11:34:12,915] [INFO] [multi_node] 192.168.0.2 Uploading the collection software package... [2024-05-27 11:34:12,982] [INFO] [multi_node] 192.168.0.4 Uploading the collection software package... [2024-05-27 11:34:13,663] [INFO] Start scanning file: netty-transport-download.jar. [2024-05-27 11:34:13,814] [INFO] [multi_node] 192.168.0.3 Successfully connected to the server. [2024-05-27 11:34:13,905] [INFO] [multi_node] 192.168.0.3 Uploading the collection software package... [2024-05-27 11:34:14,773] [INFO] Start scanning file: netty-transport-4.1.55.Final.jar. [2024-05-27 11:34:15,014] [INFO] [multi_node] 192.168.0.4 Successfully uploaded the collection software package. [2024-05-27 11:34:15,157] [INFO] [multi_node] 192.168.0.2 Successfully uploaded the collection software package. [2024-05-27 11:34:15,191] [INFO] Start scanning file: leveldbjni-all-1.8.jar. [2024-05-27 11:34:15,374] [INFO] Start scanning file: lz4-java-1.4.0.jar. [2024-05-27 11:34:15,380] [INFO] [multi_node] 192.168.0.3 Successfully uploaded the collection software package. [2024-05-27 11:34:15,485] [INFO] Start scanning file: netty-all-4.1.48.Final.jar. [2024-05-27 11:34:17,653] [INFO] [multi_node] 192.168.0.4 Collecting information about the remote server... Please wait 1 minute. [2024-05-27 11:34:17,703] [INFO] [multi_node] 192.168.0.2 Collecting information about the remote server... Please wait 1 minute. [2024-05-27 11:34:18,651] [INFO] [multi_node] 192.168.0.3 Collecting information about the remote server... Please wait 1 minute. ... [multi_node] Successfully generated the collection result to /usr/local/devkit/sys-mig/report/sys-mig_xx.xx.xx.xx_20240527113412_merged.zip.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [groupName] host key=value [groupName:vars] ssh_port= ssh_user= ssh_pass= soft_path= scan_dir= process_id= process_name= [groupName:children] groupName [groupName:host] host |
用户可通过“sys-mig/resources/sysmig/compatibility_extend”目录下文件配置软件兼容性的可兼容替换以及黑白名单,支持名单如下:
系统内置的名单位于“sysmig/resources/sysmig/compatibility_builtin”目录下,用户配置的名单优先级大于系统内置的名单。对于JAVA应用,支持的名单优先级从高到低为:可替换名单、黑名单、白名单。
配置示例:
1 2 3 4 5 6 7 8 9 10 | { "rules": { "tomcat": { "versionRule": "8.8.5*" }, "weblogic": { "versionRule": "10.3.6*" } } } |
1 2 3 4 5 6 7 8 9 10 | { "rules": { "commons-crypto": { "versionRule": "1.0.0|1.1.0" }, "snappy-java": { "versionRule": "1.1.4" } } } |
报告类型 |
报告详细说明 |
---|---|
json |
汇总Java应用、中间件、OS、硬件等系统成分的相关元数据详细信息,如:成分名称、版本号、检出路径、兼容性等,以及成分之间的父子关系。 |
html |
通过树形图的方式分别展示Java应用、中间件、数据库、OS等系统成分的关联关系,以及每个成分的基础信息,如:成分名称、版本号、检出路径、兼容性等。 |