Collecting Ledger Information
Command Function
Collects application ledger information in system migration using the terminal tool.
Syntax
- Linux:
1devkit 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:
1.\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
Parameter Description
Parameter |
Option |
Description |
|---|---|---|
-h/--help |
- |
Obtains help information. |
-c/--command |
stmt/sbom |
Information collection mode.
|
-cf/--config |
- |
Configuration file path. Parameters can be entered using a configuration file. The default configuration file template is sys-mig/resources/sysmig_default.conf. For details about the file format, see Configuration File Use (-cf/--config). |
-d/--directory |
- |
File paths to be scanned. If you enter multiple paths, separate them with spaces. |
-src/--source |
- |
File directory to be scanned. It is used to calculate the number of source code lines. You can enter multiple directories and separate them with spaces. Supported source code languages: Java, C, C++, Python, Shell, JS, HTML, and CSS. If a directory name contains spaces, use single quotation marks (') to mark the parameter. |
-t/--template |
- |
Template file path of the ledger scan result. By default, the scan result is generated based on the built-in template of the program. NOTE:
The default template file path is sys-mig/template/stmt_template_default.csv. In the template file, the first row is the information to be searched for and the second row is the internal variable of the searched information. For the internal variables, you can delete or move them, but cannot modify them. |
-o/--output |
- |
Report output directory, which defaults to the report directory where the binary file is located. |
-l/--log-level |
0/1/2/3 |
Log level, which defaults to 1.
|
-db/--db-config |
- |
Collects database information about one or more nodes in Linux using either of the following methods:
|
-mn/--multi-node |
all/ungrouped/groupName |
Group name of the remotely scanned server. This parameter is available only in Linux. The configuration file is sys-mig/nodes/nodes.conf. For details about the format, see Configuration File Use (-mn/--multi-node). NOTE:
All groups are placed in the all group, and ungrouped servers are placed in the ungrouped group. |
-ec/--encipher |
- |
Enter the text to be encrypted. |
-v/--version |
- |
Displays the program version information. You do not need to set this parameter. |
Example
- Collecting the local node information:As an example, collect information in the /home/software directory, calculate the number of code lines in the /opt/code directory, and export the scan report to the /home/report directory. Replace the example file path with the actual one.
1devkit sys-mig -c stmt -d /home/software -src /opt/code -o /home/report
Command output:
[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.
- Collecting information about multiple remote nodes:
Obtain the IP address, SSH user name/password/port, and scan address of each target server in advance. If a target server has a different architecture from the local server, prepare the software package that is used to collect the target server information. You can run uname -a to query the architecture type.
- Encrypt the password for logging in to the target server.
1devkit sys-mig -ec
Enter the text to be encrypted as prompted.
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: ***********************************************************************
- Configure the target server information file. The default template file is sys-mig/nodes/nodes.conf. For example:
group1 contains two nodes, 192.168.0.2 and 192.168.0.3, and group2 contains the node 192.168.0.4. group2 is a subnode of group1 and inherits the parameter settings in [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
- Collect the ledger information.
1devkit sys-mig -c stmt -d /home/software -mn all
Command output:
[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.
- Encrypt the password for logging in to the target server.
Configuration File Use (-cf/--config)
1 2 3 4 5 6 7 | ... # [stmt] # directory= # output= # template= # log-level= # db-config= |
- To use the preceding template, delete the comment tags and set the parameters.
- Parameters in the command lines take precedence over those in the configuration file. If parameters have been set in the command lines, the parameters in the configuration file do not take effect.
Configuration File Use (-mn/--multi-node)
1 2 3 4 5 6 7 8 9 10 11 12 | [groupName] host key=value [groupName:vars] ssh_port= ssh_user= ssh_pass= soft_path= scan_dir= [groupName:children] groupName [groupName:host] host |
- [groupName]: group name, which consists of letters and digits.
- host key=value: node IP address and parameter values. If multiple parameter values are listed, separate them with spaces. The following parameters are supported:
- ssh_port: port number, 22 by default.
- ssh_user: user name.
- ssh_pass: user password encrypted using the devkit sys-mig -ec command.
- soft_path: If a target server has a different architecture from the local server, designate a directory on the local server to decompress the software package that is used to collect the target server information.
- scan_dir: directories to be scanned on the target server. Separate multiple directories with commas (,).
- [groupName:vars]: global parameter setting of the group. The format is key=value, which can be inherited by child groups.
- [groupName:children]: child group, which specifies the parent-child relationship.
- [groupName:host]: IP addresses of servers in the specified group.
Output Report
Report Type |
Description |
|---|---|
csv |
Provides server ledger information, including information about server specifications, middleware, and databases. |