Software management and control method and system based on valid stamp confirmation
By adding valid stamps to the executable file in the ELF format of Linux system and generating text files, the problem of frequent software iterations and inconsistent version status is solved, convenient control and effectiveness verification of software upgrades and deployments is achieved, and software management is improved controllability and reliability.
Patent Information
- Application Number
- CN202411143176.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2025-02-07
AI Technical Summary
During the software development and deployment process, software iterations are frequent and version status is inconsistent, especially when multiple people work together, resulting in no control over the software status changes and the project falls into chaos, and an effective software control method is needed.
Using a software control method based on valid stamp confirmation, by adding valid stamps to the executable file in the ELF format of Linux system and generating corresponding text files, the software is conveniently controlled in terms of upgrade deployment and effectiveness verification.
Through the raising and confirmation of effective stamps, the consistency and effectiveness of the software during the upgrade and deployment process are ensured, and the problem of uncontrolled changes in software status is avoided, and the controllability and reliability of software management is improved.
Smart Images

Figure CN119396427A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic information technology, and in particular to a software management and control method and system based on valid stamp confirmation. Background Art
[0002] As electronic information systems become larger and larger, the scale of software development, the number of applications, and the complexity are increasing. The problem of software reliability is becoming more and more prominent. At the same time, due to the frequent changes in software functional requirements and the uncertainty of technical status, the software iteration frequency is high and the version status is inconsistent. Especially in the case of multi-person collaboration, uncontrolled software status changes will cause the project to fall into chaos. Therefore, it is particularly important to control software upgrades, deployments, and version validity verification. Summary of the invention
[0003] The present invention provides a software management and control solution based on valid stamp confirmation, which is applicable to executable files in ELF format of Linux system, and can realize convenient management and control of software in aspects such as upgrade deployment and validity verification by making use of the annotation and confirmation of valid stamp.
[0004] The software control method based on valid stamp confirmation provided by the present disclosure includes the following steps:
[0005] 1. Valid stamp addition
[0006] The local software control system reads the current ELF format executable file, adds a valid stamp to the executable file, generates a text file with the same valid stamp, saves the text file locally, and deploys the executable file and text file with the valid stamp to the target machine; specifically includes:
[0007] Step 1: The local software control system reads the ELF format executable file to obtain the executable file name, obtain the ELF file information of the file, and obtain the system time of the software control system. The ELF format description is as follows Figure 2 As shown;
[0008] Step 2: The local software control system modifies bytes 7-15 in e_ident[ET_NIDENT] in the ELF header data of the executable file, and writes the year of the system time (using big-endian sequence) to bytes 7-8, the month to byte 9, the day to byte 10, the hour to byte 11, the minute to byte 12, and the second to byte 13. The ELF header data structure is as follows: Figure 3 As shown, the ELF header data e_ident[ET_NIDENT] is described as follows Figure 4 As shown;
[0009] Step 3: The local software control system stores the system time in a text file in binary format according to the hexadecimal format of year, month, day, hour, minute, and second. The text file is named "executable file name + .txt" and saved in the local software control system.
[0010] 2. Software loading
[0011] In the target machine, determine whether the executable file deployed to the target machine matches the valid stamp of the text file. If they match, load the executable file. If they do not match, exit the loading process. Specifically, include:
[0012] Step 1: The local software control system deploys the executable file and the corresponding text file injected with the valid stamp to the target machine;
[0013] Step 2: The target machine control system reads the text file in binary mode through the script file to obtain valid stamp data;
[0014] Step 3: The target machine control system reads the executable file through the script file, obtains the ELF file information, reads bytes 7-15 in e_ident[ET_NIDENT] of the ELF header data, and checks whether bytes 7-15 in e_ident[ET_NIDENT] are consistent with the data in step S2. If they are consistent, the program is loaded; otherwise, it is not loaded.
[0015] 3. Software validity check
[0016] Download the executable file in the target machine to the local control system, read the valid stamp of the executable file to see if it matches the text file saved in the local control system, and if it is valid, confirm that the software is legal. Specifically include:
[0017] Step 1: Download the executable file in the target machine to the local software control system;
[0018] Step 2: The local software control system searches for a txt file with the same name as the executable file in the system. If the search is successful, the system reads the file in binary format and obtains data in the format of year, month, day, hour, minute, and second. If the data is obtained successfully, the system jumps to step S3. If it fails, the system prompts the verification stage.
[0019] Step 3: The local software control system obtains the ELF file information of the executable file, reads bytes 7-15 in e_ident[ET_NIDENT] of the ELF header data, and checks whether bytes 7-15 in e_ident[ET_NIDENT] are consistent with the time data in step S2. If they are consistent, it indicates that the check is successful, otherwise it indicates that the check failed.
[0020] Compared with the prior art, the beneficial effects of the present invention are: (1) adding a valid stamp on the local side and generating a corresponding text file, which provides a basis for subsequent software upgrades and deployment on the target side, and software validity verification on the local side; (2) the content of the valid stamp can be flexibly set; (3) the method is simple and fast. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present disclosure.
[0022] Figure 1 is a flowchart of an exemplary embodiment according to the present disclosure;
[0023] Figure 2 It is composed of ELF format files;
[0024] Figure 3 It is the ELF header data structure;
[0025] Figure 4 The meaning of ELF file header e_ident[ET_NIDENT];
[0026] Figure 5 For program examples;
[0027] Figure 6 The result of executing the executable file;
[0028] Figure 7 It is the binary content of the executable file;
[0029] Figure 8 This is an example of the local software control system interface;
[0030] Fig. 9 Inject valid stamped content into executable files;
[0031] Fig.10 For text file content;
[0032] Fig.11 The content of the script file;
[0033] Fig.12 The result of successful running of the script file;
[0034] Fig.13 This is the result interface of script file running failure;
[0035] Fig.14 This is the successful result interface of the executable file verification;
[0036] Fig.15This is the result interface of executable file verification failure. DETAILED DESCRIPTION
[0037] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0038] The present invention provides a software management and control method and system based on valid stamp confirmation, which is applicable to executable files in ELF format of Linux system.
[0039] In an exemplary embodiment, an executable file testelf and a software control system are provided, and a software control method based on valid stamp confirmation is adopted for software upgrade deployment and software validity check. The specific process is as shown in the attached Figure 1 As shown, including:
[0040] (1) Upgrade phase: The local software control system reads the executable file testelf in ELF format, injects a valid stamp into it to generate an executable file testelf containing a valid stamp, and generates a corresponding text file "testelf.txt", saves the text file "testelf.txt" to the local software control system, and deploys the executable file testelf containing a valid stamp and the text file "testelf.txt" to the target machine together. The target machine software control system determines through the script file that the valid stamps of the executable file testelf and the text file "testelf.txt" are consistent, and loads the executable file testelf; deploys the executable file testelf without a valid stamp and the text file "testelf.txt" to the target machine together. The target machine control system determines through the script file that the valid stamps of the executable file testelf and the text file "testelf.txt" are inconsistent, and does not load the executable file testelf;
[0041] (2) Verification phase: Download the executable file testelf with a valid stamp from the target machine to the local control system, find the text file "testelf.txt" with the same name as the executable file, compare the valid stamp of the text file "testelf.txt" with the executable file testelf, and determine that the executable file testelf is valid software; compare the valid stamp of the executable file testelf without a valid stamp with the text file "testelf.txt", and determine that the executable file testelf is invalid software.
[0042] Application Examples
[0043] Write a program to print "hello" through QT, generate an executable file testelf, obtain the current time, inject a valid stamp into the file testelf to generate a new executable file testelf and a text file "testelf.txt". After the target machine gets the executable file testelf and the text file "testelf.txt", use the script to compare whether the valid stamp of the executable file testelf and the valid stamp of the text file "testelf.txt" are consistent. If the data is consistent, load the executable file testelf, and prompt that the verification is successful. The software running result is to print "hello". Then deploy the executable file testelf and the text file "testelf.txt" together to the target machine. The target machine software management and control system uses the script file to determine that the valid stamps of the executable file testelf and the text file "testelf.txt" are inconsistent, and does not load the executable file testelf, and prompts that the loading failed.
[0044] Download the executable file testelf from the target machine to the local software management and control system, find the text file "testelf.txt" with the same name as the executable file testelf, compare the valid stamps of the text file "testelf.txt" and the executable file testelf, determine that the executable file testelf is valid software, and prompt that the verification is successful; compare the valid stamps of the executable file testelf without the valid stamp and the text file "testelf.txt", and determine that the executable file testelf is invalid software.
[0045] Further details are as follows
[0046] 1. Upgrade stage:
[0047] 1.1 ELF format executable file reading
[0048] Step 1: Use QT to write a program that prints "hello". The program code is as follows Figure 5 As shown, generate the executable file testelf, run the executable file, and the running results are as follows Figure 6 As shown;
[0049] Step 2: Use the xxd command to view the hexadecimal content of the executable file testelf, such as Figure 7 As shown, the first line is the content of e_ident[ET_NIDENT];
[0050] Step 3: The local software control system reads the executable file, selects the executable file testelf in the "Input software to be upgraded" column, and clicks the "Upgrade" button. Figure 8 As shown, the local software control system obtains the current system time 16:34:27 on March 20, 2024, and injects it into the executable file testelf;
[0051] Step 4: Use the xxd command to view the contents of the executable file testelf, such as Fig. 9 As shown, at this time, the 7th to 16th bytes in the first line are 07, e8, 03, 14, 10, 22, and 1b, respectively, where 07 and e8 bytes represent the high byte and low byte of the "year" data, namely 7×256+16×14+8=2024, 03 represents the "month" data is March, 14 represents the "day" data is the 20th, 10 represents the "hour" data is 16 hours, 22 represents the "minute" data is 34 minutes, and 1b represents the "second" data is 27 seconds, which is consistent with the obtained system time. At the same time, the local software control system writes the system time to "testelf.txt". The contents of testelf.txt can be viewed through the xxd command as shown in the figure Fig.10 As shown, the data are 07, e8, 03, 14, 10, 22, and 1b, which are consistent with the obtained system time and the time information written to the elf file.
[0052] 1.2 Software Loading
[0053] Step 1: The local software control system deploys "testelf.txt" and the executable file "testelf" injected with a valid stamp to the target machine;
[0054] Step 2: The target machine control system reads the text file "testelf.txt" in binary mode through the script file to obtain the valid stamp data "07e8031410221b";
[0055] Step 3: The target machine control system reads the executable file "testelf" injected with a valid stamp, obtains the ELF file information through the script file, reads bytes 7-15 in the ELF header data e_ident[ET_NIDENT], and the data is "07e8031410221b". Check that bytes 7-15 in e_ident[ET_NIDENT] are consistent with the data in step S2, and loads and runs the program. The script file is as follows: Fig.11 As shown, the loading results are as follows Fig.12 shown.
[0056] The target machine control system reads the original executable file "testelf" injected without a valid stamp, obtains the ELF file information through the script file, reads bytes 7-15 in the ELF header data e_ident[ET_NIDENT], and the data is "00000000000000". It checks that bytes 7-15 in e_ident[ET_NIDENT] are inconsistent with the data in step S2, and does not load the running program. The loading result is as follows Fig.13 shown.
[0057] II. Inspection Phase
[0058] Step 1: Download the executable file "testelf" from the target machine to the local software control system;
[0059] Step 2: In the local software control system, select the executable file "testelf" downloaded from the target machine in the "Enter the software to be checked" column, and click the "Check" button. The local software control system searches for the "testelf.txt" file in the system. After the search is successful, it reads the data in the format of year, month, day, hour, minute, and second in binary mode. At this time, the data obtained is "07, e8, 03, 14, 10, 22, 1b". Get the ELF file information of the executable file "testelf" downloaded from the target machine, read the 7-15 bytes of e_ident[ET_NIDENT] in the ELF header data, and check that the 7-15 bytes of e_ident[ET_NIDENT] are "07, e8, 03, 14, 10, 22, 1b". The two are consistent, and the executable file is successfully checked. A pop-up window pops up to confirm that the executable file has been successfully checked. The check result is as follows: Fig.14 As shown;
[0060] Step 3: In the "Input software to be checked" column, select the executable file "testelf" that has never been injected with a valid stamp in the local software control system, and click the "Check" button. The local software control system searches for the "testelf.txt" file in the system. After the search is successful, it reads the data in the format of year, month, day, hour, minute, and second in binary mode. At this time, the data obtained is "07, e8, 03, 14, 10, 22, 1b", and obtains the ELF file information of the executable file "testelf" that has not been injected with a valid stamp. Read bytes 7-15 in e_ident[ET_NIDENT] of the ELF header data, and check that bytes 7-15 in e_ident[ET_NIDENT] are "00, 00, 00, 00, 00, 00, 00". If the two are inconsistent, the executable file verification fails, and a pop-up window pops up to indicate that the executable file is not a released version. The verification result is as follows: Fig.15 shown.
[0061] The above technical scheme is only an exemplary embodiment of the present invention. For those skilled in the art, it is easy to make various types of improvements or modifications based on the application methods and principles disclosed in the present invention, and it is not limited to the method described in the above specific embodiment of the present invention. Therefore, the method described above is only preferred and does not have a restrictive meaning.
Claims
1. A software control method based on valid stamp confirmation, comprising the following steps: S1, in the local software management and control system, add a valid stamp to the header information of the ELF format executable file, generate a text file containing the same valid stamp, save the text file locally, and the executable file and text file containing the valid stamp are used for deployment to the target machine; S2, in the target machine, determine whether the executable file deployed to the target machine matches the valid stamp of the text file, if they match, load the executable file, if not, exit the loading.
2. The method according to claim 1, characterized in that In the step S1, the system time is used as the valid stamp; the valid stamp is added at the position of: 7-15 bytes in e_ident[ET_NIDENT] in the header data of the ELF format executable file.
3. The method according to claim 2, characterized in that The step S1 specifically includes: S11, read the ELF format executable file, obtain the name of the executable file, obtain the ELF file information of the file, and obtain the system time of the software control system; S12, write the system time into bytes 7-15 of e_ident[ET_NIDENT] in the ELF header data of the executable file; S13, the system time is stored in a text file in binary format according to the hexadecimal format of year, month, day, hour, minute and second. The text file is named "executable file name + .txt" and saved in the local software management and control system.
4. The method according to claim 2, characterized in that: The step S2 specifically includes: S21, deploying the executable file injected with the valid stamp and the corresponding text file to the target machine; S22, the target machine software control system reads the text file in binary mode through the script file to obtain valid stamp data; S23, the target machine software control system reads the executable file through the script file, obtains the ELF file information, reads bytes 7-15 in e_ident[ET_NIDENT] of the ELF header data, and checks whether bytes 7-15 in e_ident[ET_NIDENT] are consistent with the data obtained in step S22. If they are consistent, the program is loaded, otherwise it is not loaded.
5. The method according to any one of claims 1 to 4, characterized in that: The following steps are also included: S3, download the executable file in the target machine to the local control system, read the valid stamp of the executable file to see if it matches the text file saved in the local control system, and if it is valid, confirm that the software is legal software.
6. The method according to claim 5, characterized in that The step S3 specifically includes: S31, downloading the executable file in the target machine to the local software management and control system; S32, the local software management and control system searches the system for a txt file with the same name as the executable file. If the search is successful, the system reads the file in binary format and obtains data in the format of year, month, day, hour, minute, and second. If the data is obtained successfully, the system jumps to step S33. If the data fails, the system prompts that the check failed. S33: The local software management and control system obtains the ELF file information of the executable file, reads bytes 7-15 in e_ident[ET_NIDENT] of the ELF header data, and checks whether bytes 7-15 in e_ident[ET_NIDENT] are consistent with the time data obtained in step S32. If they are consistent, it prompts that the verification is successful, otherwise it prompts that the verification fails.
7. A software control system based on valid stamp confirmation using the method described in any one of claims 1 to 6, suitable for executable files in ELF format of Linux system, characterized in that: include: The valid stamp injection module and software inspection module applied to the local software control system, and the valid stamp inspection module applied to the target machine software control system, wherein: The valid stamp injection module is used to add a valid stamp to the header information of the ELF format executable file, and generate a text file containing the same valid stamp, save the text file locally, and the executable file and text file containing the valid stamp are used to be deployed to the target machine; The valid stamp checking module is used to determine whether the valid stamps of the executable file deployed to the target machine match the valid stamps of the text file. If they match, the executable file is loaded; otherwise, the loading is aborted. Software validity check module: used to download the executable file in the target machine to the local control system, read the validity stamp of the executable file to see if it matches the text file saved in the local control system, and if valid, confirm that the software is legal.
8. The system according to claim 7, characterized in that In the valid stamp injection module, the system time is used as the valid stamp; the valid stamp is added at the position of: 7-15 bytes in e_ident[ET_NIDENT] in the header data of the ELF format executable file.