台账信息收集
命令功能
使用命令通过终端工具进行系统迁移应用台账信息收集。
命令格式
- Linux环境
devkit sys-mig -c,--command stmt -cf,--config configure_file_path -src,--source source_file_path -d,--directory scan_path -t,--template stmt_template_path -db,--db-config db_config -mn,--multi-node group_name -o,--output report_dir -l,--log-level {0/1/2/3} -ec,--encipher -v,--version -h,--help
- Windows环境
.\sys-mig.exe -c,--command stmt -cf,--config configure_file_path -src,--source source_file_path -d,--directory scan_path -t,--template stmt_template_path -o,--output report_dir -l,--log-level {0/1/2/3} -v,--version -h,--help
参数说明
参数 |
参数选项 |
说明 |
---|---|---|
-h/--help |
- |
获取帮助信息。 |
-c/--command |
stmt/sbom |
收集信息的模式。
|
-cf/--config |
- |
输入参数配置文件路径。支持通过配置文件方式输入参数,默认模板位置为sys-mig/resources/sysmig_default.conf,具体格式请参见配置文件使用说明(-cf/--config)。 |
-d/--directory |
- |
输入扫描文件目录,支持输入多个目录,多个目录间以空格分隔。 |
-src/--source |
- |
输入扫描文件目录,用于统计源码行数。支持输入多个目录,多个目录间以空格分隔。 支持的源代码语言:Java、C、C++、Python、Shell、JS、HTML和CSS。 如果待扫描的目录名称中包含空格,请使用单引号标识该参数。 |
-t/--template |
- |
输入台账扫描结果模板路径,默认按照程序内置模板生成扫描结果。 说明:
默认模板位置为sys-mig/template/stmt_template_default.csv。文件有两行数据,第一行是待搜索的信息,第二行是搜索信息对应的内部变量,可删除或更换位置,但不可修改。 |
-o/--output |
- |
报告输出目录,默认为二进制所在report目录。 |
-l/--log-level |
0/1/2/3 |
设置日志级别,默认为1。
|
-db/--db-config |
- |
收集数据库信息,支持多节点数据库信息收集,仅支持Linux环境。支持以下两种方式:
|
-mn/--multi-node |
all/ungrouped/groupName |
远程扫描服务器的组名,仅支持Linux环境。配置文件为sys-mig/nodes/nodes.conf,具体格式请参见配置文件使用说明(-mn/--multi-node)。 说明:
所有组都放在all组下,未分组的服务器配置放在ungrouped组下。 |
-ec/--encipher |
- |
输入需要加密的文本。 |
-v/--version |
- |
展示程序版本信息,无需输入参数。 |
使用示例
- 本地节点信息收集:此处以收集“/home/software”目录下信息,统计“/opt/code”下代码行数且扫描报告输出至“/home/report”为例,请根据实际情况替换需要扫描的文件路径。
devkit sys-mig -c stmt -d /home/software -src /opt/code -o /home/report
返回信息如下:
[2024-03-07 14:24:02,424] [INFO] Start to execute the command: ./devkit sys-mig -c stmt -d /home/software -o /home/report -t /usr/local/devkit/sys-mig/template/stmt_template_default.csv -l 1 -src /opt/code [2024-05-14 16:24:18,817] [INFO] Creating file indexing... [2024-05-14 16:24:18,819] [INFO] Parsing... [2024-05-14 16:24:18,819] [INFO] Start Scanning stmt information. [2024-05-14 16:24:18,820] [INFO] Start to collect database details [2024-05-14 16:24:18,820] [INFO] Database details is collected Successfully [2024-05-14 16:24:18,820] [INFO] Middleware binary start analysis. [2024-05-14 16:24:18,820] [INFO] Middleware binary end of analysis. [2024-05-14 16:24:18,821] [INFO] Middleware package start analysis. [2024-05-14 16:24:18,821] [INFO] Middleware package end of analysis. csv report is created successfully. the file is located in /home/report/sys-mig_xx.xx.xx.xx_20240307142402.csv [2024-05-14 16:24:18,828] [INFO] Scanning information successfully completed.
- 远程多节点信息收集:
用户需提前获取目标服务器的IP地址、SSH相关的用户名/密码/端口、扫描地址。当目标服务器与本地服务器架构不一致时,需要准备可适配目标服务器执行信息收集的软件包,架构可通过uname -a查看。
- 加密目标服务器登录密码。
devkit sys-mig -ec
按照提示输入需要加密的文本:
please enter the password(the password must contain a maximum of 32 characters): Initializing the working key... Please wait. encrypted password: ***********************************************************************
- 配置目标服务器信息文件,默认模板位置为sys-mig/nodes/nodes.conf,如下为示例,请用户根据实际情况进行配置。
group1分组下为192.168.0.2/192.168.0.3两个节点,group2分组下为192.168.0.4,group2为group1的子节点,可以继承[group1:vars]中参数配置。
[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
- 执行以下命令收集台账信息。
devkit sys-mig -c stmt -d /home/software -mn all
返回信息如下:
[2024-05-27 11:30:21,041] [INFO] Start to execute the command: ./devkit sys-mig -c stmt -d /home/software -o /usr/local/devkit/sys-mig/report -t /usr/local/devkit/sys-mig/template/stmt_template_default.csv -l 1 -mn all [2024-05-27 11:30:21,042] [INFO] Creating file indexing... [2024-05-27 11:30:21,052] [INFO] Parsing... [2024-05-27 11:30:21,094] [INFO] [multi_node] 192.168.0.2 Connecting to the server... [2024-05-27 11:30:21,095] [INFO] Start Scanning stmt information. [2024-05-27 11:30:21,095] [INFO] Start to collect database details [2024-05-27 11:30:21,096] [INFO] [multi_node] 192.168.0.3 Connecting to the server... [2024-05-27 11:30:21,096] [INFO] Database details is collected Successfully [2024-05-27 11:30:21,096] [INFO] [multi_node] 192.168.0.4 Connecting to the server... [2024-05-27 11:30:21,097] [INFO] Middleware binary start analysis. [2024-05-27 11:30:21,097] [INFO] Middleware binary end of analysis. [2024-05-27 11:30:21,098] [INFO] Middleware package start analysis. [2024-05-27 11:30:21,098] [INFO] Middleware package end of analysis. csv report is created successfully. the file is located in /usr/local/devkit/sys-mig/report/sys-mig_xx.xx.xx.xx_20240527113021/stmt.csv [2024-05-27 11:30:21,107] [INFO] Scanning information successfully completed. [2024-05-27 11:30:21,524] [INFO] [multi_node] 192.168.0.2 Successfully connected to the server. [2024-05-27 11:30:21,640] [INFO] [multi_node] 192.168.0.4 Successfully connected to the server. [2024-05-27 11:30:22,024] [INFO] [multi_node] 192.168.0.2 Uploading the collection software package... [2024-05-27 11:30:22,052] [INFO] [multi_node] 192.168.0.4 Uploading the collection software package... [2024-05-27 11:30:22,352] [INFO] [multi_node] 192.168.0.3 Successfully connected to the server. [2024-05-27 11:30:22,922] [INFO] [multi_node] 192.168.0.3 Uploading the collection software package... [2024-05-27 11:30:44,681] [INFO] [multi_node] 192.168.0.4 Successfully uploaded the collection software package. [2024-05-27 11:30:45,009] [INFO] [multi_node] 192.168.0.2 Successfully uploaded the collection software package. [2024-05-27 11:30:45,447] [INFO] [multi_node] 192.168.0.3 Successfully uploaded the collection software package. [2024-05-27 11:30:48,497] [INFO] [multi_node] 192.168.0.4 Successfully collected information about the remote server. [2024-05-27 11:30:48,507] [INFO] [multi_node] 192.168.0.4 Downloading the collection result file... [2024-05-27 11:30:48,767] [INFO] [multi_node] 192.168.0.2 Collecting information about the remote server... Please wait 1 minute. [2024-05-27 11:30:49,396] [INFO] [multi_node] 192.168.0.4 Successfully downloaded the collection result file. [2024-05-27 11:30:49,657] [INFO] [multi_node] 192.168.0.3 Collecting information about the remote server... Please wait 1 minute. [2024-05-27 11:31:50,321] [INFO] [multi_node] 192.168.0.2 Successfully collected information about the remote server. [2024-05-27 11:31:50,332] [INFO] [multi_node] 192.168.0.2 Downloading the collection result file... [2024-05-27 11:31:51,415] [INFO] [multi_node] 192.168.0.2 Successfully downloaded the collection result file. [2024-05-27 11:31:51,703] [INFO] [multi_node] 192.168.0.3 Successfully collected information about the remote server. [2024-05-27 11:31:51,714] [INFO] [multi_node] 192.168.0.3 Downloading the collection result file... [2024-05-27 11:31:53,908] [INFO] [multi_node] 192.168.0.3 Successfully downloaded the collection result file. [multi_node] Successfully generated the collection result to /usr/local/devkit/sys-mig/report/sys-mig_xx.xx.xx.xx_20240527113021/stmt.csv.
- 加密目标服务器登录密码。
配置文件使用说明(-cf/--config)
... # [stmt] # directory= # output= # template= # log-level= # db-config=

- 如需使用上述模板,请删除注释符号,并填写对应参数内容。
- 命令行参数优先级高于配置文件,若命令行已填写参数,则配置文件中填写内容无效。
配置文件使用说明(-mn/--multi-node)
[groupName] host key=value [groupName:vars] ssh_port= ssh_user= ssh_pass= soft_path= scan_dir= [groupName:children] groupName [groupName:host] host

- [groupName]:分组名称,由字母、数字组成。
- host key=value:节点IP和参数值,多个参数以空格分隔,支持参数如下:
- ssh_port:端口号,默认22。
- ssh_user:用户名。
- ssh_pass:通过devkit sys-mig -ec命令加密的用户密码。
- soft_path:当目标服务器与本地服务器架构不一致时,需要指定当前服务器上,可适配目标服务器执行信息收集的软件包解压后目录。
- scan_dir:目标服务器的扫描目录,多个请使用英文逗号分割。
- [groupName:vars]:分组全局参数设置,格式为key=value,可被子分组继承。
- [groupName:children]:子分组,指定父子关系。
- [groupName:host]:指定分组中服务器的IP地址。
输出报告说明
报告类型 |
报告详细说明 |
---|---|
csv |
用于展示服务器台账信息,信息主要包含服务器规格、中间件、数据库等信息。 |