A character-based operation and maintenance command segmentation and parsing method based on word segmentation technology

Through the character operation and maintenance command segmentation analysis method based on word segmentation technology, the problem of insufficient operation and maintenance command capture and parsing in the existing technology is solved, efficient command analysis and interception is achieved, and operation and maintenance security and user experience are improved.

CN119067112BActive Publication Date: 2025-03-11SICHUAN ZHONGTIAN YINGYAN INFORMATION TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411573664.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-03-11
Estimated Expiration
2044-11-06

AI Technical Summary

Technical Problem

The existing technology has shortcomings in the capture and parsing of character-type operation and maintenance commands, and it is impossible to effectively identify and intercept complex and high-risk operation and maintenance commands, resulting in high false alarm rates, high false alarm rates and poor user experience.

Method used

The character-type operation and maintenance command segmentation analysis method based on word segmentation technology is adopted, and the operation and maintenance commands are analyzed and intercepted in detail through preprocessing, word segmentation, conflict processing and rule matching.

Benefits of technology

It realizes comprehensive command capture and parsing, reduces false positives and missed reports, improves the parsing ability of complex commands, enhances operation transparency and responsibility traceability, and improves the security of command execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067112B_ABST
    Figure CN119067112B_ABST
Patent Text Reader

Abstract

The present invention discloses a character-based operation and maintenance command segmentation and parsing method based on word segmentation technology, which belongs to the field of network operation and maintenance. The method adopts a combined command segmentation method to segment the processed standard text commands, analyzes the command structure in the segmentation result through predefined interception command rules, identifies the command intent and operation object, and pre-intercepts the high-risk commands therein, and reconfirms the intercepted high-risk commands. If the command is not set for secondary approval, it is directly intercepted; if the command is set for secondary approval, the administrator conducts secondary confirmation to determine whether it is executed. Through the above method, the operation and maintenance character command parsing and recognition technology input by the user can accurately convert complex commands into recognizable commands, thereby improving the effective accuracy of operation and maintenance operation interception.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network operation and maintenance, and in particular to a character-based operation and maintenance command segmentation and parsing method based on word segmentation technology. Background Art

[0002] In the modern information technology environment, character operation and maintenance is a very common remote operation and maintenance protocol, which is widely used in server management and maintenance. Operation and maintenance users usually input various character commands through character operation and maintenance terminals to operate and manage servers, such as file operations, system configuration, software installation and updates, etc. However, as the complexity of the system continues to increase, erroneous or malicious command input may lead to serious system failures, data loss or security vulnerabilities.

[0003] Traditional command line operations rely on the professional knowledge and operational experience of operation and maintenance personnel. Once an error occurs, such as accidentally executing a destructive command (such as rm -rf *), it will cause irreparable damage to the system. Although existing security mechanisms (such as permission control and log monitoring) can prevent error operations to a certain extent, these measures are often post-event remediation rather than pre-event prevention. Therefore, how to timely and accurately identify and intercept potential high-risk operations before command execution has become an urgent problem to be solved in the field of information security.

[0004] In addition, the definition and identification criteria of high-risk commands may vary in different business scenarios and operating habits, so the system needs to be flexible enough to dynamically adjust the identification rules according to actual needs. This flexibility is difficult to achieve with traditional methods.

[0005] Existing technical solutions generally capture input commands by monitoring user input to simulate keystrokes, or by intercepting data sent by users to the target server. Although existing technical solutions have solved the problem of centralized management and control of access to key servers and network devices to a certain extent, they still have significant deficiencies in parsing and interception. Command capture is limited, and existing technical solutions usually only capture basic commands entered by users. Parsing is inaccurate. Due to the lack of precise command parsing, existing solutions often misreport normal operations as abnormal behaviors, resulting in invalid interception or alarms, affecting user experience and inaccurate parsing of high-risk commands, resulting in low interception accuracy. These solutions have the following problems:

[0006] 1. Limited command capture: Existing technical solutions can usually only capture basic commands entered by users. For complex, multi-step commands or commands that use advanced functions such as pipelines and redirection, it is often impossible to effectively capture and analyze them. This limitation makes it difficult for the system to conduct comprehensive security monitoring of the entire command operation, resulting in some potential high-risk operations not being identified and processed.

[0007] 2. Inaccurate parsing: Since existing technical solutions usually rely on simple pattern matching or keyword search methods and lack a deep understanding of the context and structure of commands, false positives are prone to occur when parsing complex commands.

[0008] Lack of in-depth analysis of complex commands: When processing complex commands containing multiple parameters, paths, and options, existing technologies are often unable to accurately parse the relationship between each element, and may ignore certain dangerous parameter combinations or paths, thereby missing high-risk operations.

[0009] 3. High false alarm rate: Due to the lack of accurate parsing capabilities, existing technical solutions are prone to misreporting legitimate operations as abnormal behaviors when processing some complex or non-standardized commands. This situation will cause the system to frequently issue invalid alarms, affecting the user experience, and may cause operation and maintenance personnel to lose trust in system alarms, thereby ignoring real security threats.

[0010] 4. Insufficient parsing and interception of high-risk commands: Existing solutions usually rely on predefined rule bases, which have limited coverage and may not be able to identify all potential high-risk commands, especially some newly emerging or deformed command patterns.

[0011] 5. Poor user experience: Due to inaccurate analysis and high false alarm rate, existing technical solutions may frequently issue invalid alarms. Summary of the invention

[0012] In view of the above-mentioned deficiencies in the prior art, the present invention provides a character-based operation and maintenance command segmentation and parsing method based on word segmentation technology.

[0013] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is:

[0014] A character-based operation and maintenance command segmentation and parsing method based on word segmentation technology includes the following steps:

[0015] S1. Preprocess the current command and output the processed standard text command;

[0016] S2, using a combined command segmentation method to segment the standard text command output by S1, and performing conflict resolution on the segmentation results, and outputting the segmentation results;

[0017] S3, analyzing the command structure in the segmentation result through predefined interception command rules, identifying the command intent and operation object, and pre-intercepting the high-risk commands;

[0018] S4. Confirm the intercepted high-risk command again. If the command is not set for secondary approval, it will be directly intercepted; if the command is set for secondary approval, the administrator will confirm whether to execute it for the second time.

[0019] Furthermore, the S1 specifically includes the following steps:

[0020] S11, analyzing the prefix of the current command, performing special segmentation according to the characteristics of the prefix, and taking the subsequent actual command as the analysis object;

[0021] S12, determining whether the command type is a compound command, and splitting the identified compound command into multiple sub-commands;

[0022] S13. Remove irrelevant stop words, unify text format and punctuation, and output standard text commands.

[0023] Furthermore, the S2 specifically includes the following steps:

[0024] S21, using the forward maximum matching method and the reverse maximum matching method to match the standard text command output by S1 word by word in both the front and back directions, and sorting the split commands according to the length of the entries;

[0025] S22. Based on the length priority principle, if the character sequences at the same position of the word segmentation results generated by the forward maximum matching method and the reverse maximum matching method are recognized as different entries, the word segmentation result with the longer entry length is selected first;

[0026] S23. The specific structure segmentation results that meet the path identification and command parameter identification are selected first, and the data in the specific format of file path, IP address, number, and time stamp are identified using regular expressions and regarded as a whole entry.

[0027] Furthermore, the forward maximum matching method in S21 is specifically:

[0028] A1. Starting from the first character of the standard text command, set the pointer to the character position currently being processed and determine the length of the longest hit entry, which is used as the maximum length of each match;

[0029] A2. Starting from the current position of the pointer, forwardly extract the longest character string and find out whether the character string exists in the preset dictionary. If so, segment the character string as an independent word and record it in the word segmentation result.

[0030] A3. Prioritize searching for a character substring that matches the longest entry in the preset dictionary. If a character substring that matches the longest entry in the preset dictionary cannot be found, reduce the length of the substring word by word until a matching character substring is found or the substring is reduced to the shortest length.

[0031] A4. If a matching term is found, the pointer position is updated to the next unprocessed character and A1-A3 are repeated until the entire text is processed.

[0032] Furthermore, the reverse maximum matching method in S21 is specifically:

[0033] B1. Starting from the last character of the standard text command, set the pointer to the character position currently being processed and determine the length of the longest hit entry, which is used as the maximum length of each match;

[0034] B2, starting from the current position of the pointer, reverse the longest character string and find whether the character string exists in the preset dictionary. If it exists, the character string is segmented as an independent word and recorded in the word segmentation result;

[0035] B3, prioritize searching for a character substring that matches the longest entry in the preset dictionary. If a character substring that matches the longest entry in the preset dictionary cannot be found, reduce the length word by word until a matching character substring is found or the length is reduced to the shortest length;

[0036] B4. If a matching entry is found, the pointer position is updated to the next unprocessed character and B1-B3 are repeated until the entire text is processed.

[0037] Furthermore, in S21, if the segmentation results of the forward maximum match and the reverse maximum match are consistent, the segmentation is considered correct; if they are inconsistent, a group of segmentation results with a smaller number of matched terms is selected.

[0038] The present invention has the following beneficial effects:

[0039] Comprehensive command capture and parsing: No missed command capture, able to capture surface commands and script commands, ensuring that all user operations are recorded in detail to prevent any important operations from being overlooked. Reduce false positives and missed negatives: Reduce command misidentification, reducing the frequency of false positives and missed negatives. Parsing of complex commands: Enhance operational transparency and responsibility traceability. Improve the security of command execution: The system can effectively identify high-risk commands, thereby greatly reducing the risk of system failure or data loss caused by misoperation. Real-time interception of dangerous commands: The present invention can analyze and identify commands entered by operation and maintenance users in real time, and immediately intercept high-risk commands based on a predefined rule base. No need to rely on model training: Unlike methods that rely on complex model training, the present invention achieves accurate parsing and interception of commands through precise word segmentation command segmentation and rule matching technology, reducing dependence on training samples and machine learning models, and reducing system complexity and maintenance costs. Flexible rule update and expansion: The predefined interception command rule base can be dynamically updated and expanded according to actual needs, ensuring that the system can adapt to new high-risk command patterns in a timely manner and improve the adaptability and durability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 The figure is a flow chart of the character-based operation and maintenance command segmentation and parsing method based on word segmentation technology of the present invention.

[0041] Figure 2 This is a specific segmentation and parsing process of an embodiment of the present invention. DETAILED DESCRIPTION

[0042] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.

[0043] A character-based operation and maintenance command segmentation and parsing method based on word segmentation technology, such as Figure 1 As shown, the following steps are included:

[0044] S1. Preprocess the current command and output the processed standard text command;

[0045] like Figure 2 As shown, this implementation example specifically includes the following steps:

[0046] S11, analyzing the prefix of the current command, performing special segmentation according to the characteristics of the prefix, and taking the subsequent actual command as the analysis object;

[0047] When entering a command instruction, the system processes the prefix. First, when the current command contains a prefix (such as sudo, nohup, etc.), the system will determine the existence of the prefix and perform special processing based on the characteristics of the prefix. For example, if the command begins with sudo, the system will recognize sudo as a prefix for escalating permissions, and will not treat it as part of the core command. Prefixes such as sudo will be independently identified and split, and subsequent actual operation commands (such as rm -rf / etc) will be the main analysis object.

[0048] S12, determining whether the command type is a compound command, and splitting the identified compound command into multiple sub-commands;

[0049] The command splitting process first determines whether the command type is a compound command based on the structural characteristics of the command. For example, if the command contains the symbol \, or starts with { and ends with}, or starts with ( and ends with ), or starts with ' and ends with ', etc., it will first identify that this is a compound command containing multiple subcommands, and split the complex command into multiple independent subcommands. For example, cat file.txt \ grep "error" will be split into cat file.txt and grep "error" for processing.

[0050] S13. Remove irrelevant stop words, unify text format and punctuation, and output standard text commands.

[0051] Remove irrelevant stop words, process punctuation, convert to standardized text, ensure text format consistency, convert uppercase and lowercase, and output the processed standard text content.

[0052] This implementation example describes a typical example of SSH character-based operation and maintenance command parsing and dangerous command interception. This example involves three main role objects: operation and maintenance user, bastion host service system, and system administrator.

[0053] 1. Definition of high-risk command library

[0054] The system administrator will first maintain a predefined high-risk command rule base in the bastion service system. This rule base contains a series of high-risk command patterns or keyword combinations. These rules are based on historical experience and common dangerous operations, such as "rm", "rm -rf", "fork", etc.

[0055] 2. Operation and maintenance command input

[0056] The operation and maintenance user logs in to the target server through the SSH client and enters an operation and maintenance command, such as "sudo rm -rf / var / log / ", which deletes a target folder.

[0057] 3. Command parsing preprocessing

[0058] The command sent by the operation and maintenance user is received and immediately parsed. After receiving the input command, the command is preprocessed. First, the command prefix is ​​checked to see if it is a system special command prefix, and then the command is judged to see if it is a compound command. If it is a qualified command, the compound command is processed. For example, if the command contains the symbol \, or starts with { and ends with}, or starts with ( and ends with ), or starts with ' and ends with ', etc., it will first recognize that this is a compound command containing multiple subcommands, and disassemble the complex command into multiple independent subcommands. Remove redundant spaces to ensure the consistency of text format, mark key characters and signs as specific symbols, and recognize " / var / log / " and mark it as a path type.

[0059] S2, using a combined command segmentation method to segment the standard text command output by S1, and performing conflict resolution on the segmentation results, and outputting the segmentation results;

[0060] like Figure 2 As shown, this embodiment specifically includes the following steps:

[0061] S21, using the forward maximum matching method and the reverse maximum matching method to match the standard text command output by S1 word by word in both the front and back directions, and sorting the split commands according to the length of the entries;

[0062] The bastion host service system begins to segment the preprocessed command text, identifies the various parts in the command and generates command segmentation results.

[0063] The processing logic is as follows: The first step is to perform a forward maximum match (MM) to match the terms in the command word by word from left to right. The system first recognizes "sudo", then "rm", "-rf" and the " / var / log / " path, as follows:

[0064] A1. Starting from the first character of the standard text command, set the pointer to the character position currently being processed and determine the length of the longest hit entry, which is used as the maximum length of each match;

[0065] A2. Starting from the current position of the pointer, forwardly extract the longest character string and find out whether the character string exists in the preset dictionary. If so, segment the character string as an independent word and record it in the word segmentation result.

[0066] A3. Prioritize searching for a character substring that matches the longest entry in the preset dictionary. If a character substring that matches the longest entry in the preset dictionary cannot be found, reduce the length of the substring word by word until a matching character substring is found or the substring is reduced to the shortest length.

[0067] A4. If a matching term is found, the pointer position is updated to the next unprocessed character and A1-A3 are repeated until the entire text is processed.

[0068] The second step is to perform reverse maximum match (RMM), matching word by word from right to left, to confirm the integrity of the path " / var / log / ", "-rf", command "rm", and "sudo", as follows:

[0069] B1. Starting from the last character of the standard text command, set the pointer to the character position currently being processed and determine the length of the longest hit entry, which is used as the maximum length of each match;

[0070] B2, starting from the current position of the pointer, reverse the longest character string and find whether the character string exists in the preset dictionary. If it exists, the character string is segmented as an independent word and recorded in the word segmentation result;

[0071] B3, prioritize searching for a character substring that matches the longest entry in the preset dictionary. If a character substring that matches the longest entry in the preset dictionary cannot be found, reduce the length word by word until a matching character substring is found or the length is reduced to the shortest length;

[0072] B4. If a matching entry is found, the pointer position is updated to the next unprocessed character and B1-B3 are repeated until the entire text is processed.

[0073] The third step is to compare the results of forward and reverse matching. If the segmentation results of the forward maximum match and the reverse maximum match are consistent, the segmentation is considered correct. If they are inconsistent, a group of segmentation results with fewer matching entries is selected to reduce conflicts.

[0074] The fourth step is special format recognition. The path " / var / log / " is identified through regular expressions and confirmed as a whole entry. The final command segmentation output result is: "sudo", "rm", "−rf", " / var / log / ", and each entry is attached with a corresponding label and type identifier (such as "command", "parameter", "path").

[0075] S22. Based on the length priority principle, if the character sequences at the same position of the word segmentation results generated by the forward maximum matching method and the reverse maximum matching method are recognized as different entries, the word segmentation result with the longer entry length is selected first;

[0076] If there is a conflict between the forward and reverse word segmentation results (i.e., the character sequence at the same position is recognized as different terms), we give priority to the word segmentation result with the longer term. This principle is based on the "long word first" strategy in natural language processing and can effectively reduce word segmentation errors.

[0077] S23. The specific structure segmentation results that meet the path identification and command parameter identification are selected first, and the data in the specific format of file path, IP address, number, and time stamp are identified using regular expressions and regarded as a whole entry.

[0078] In certain scenarios (such as path identification, command parameter identification, etc.), the word segmentation results that conform to the specific grammatical structure are preferred. For example, for "restart apache2", the word segmentation rule can prioritize identifying "restart apache2" as a whole command word rather than two independent entries of "restart" and "apache2".

[0079] When processing data in a specific format (such as file paths, IP addresses, numbers, timestamps, etc.), regular expressions are used. Regular expressions can quickly identify text in these special formats and process them as a whole term to avoid incorrect splitting during command segmentation. For example, " / var / log / syslog" can be directly used as a term through the path identification rules instead of being incorrectly split into " / var", "log", and "syslog".

[0080] S3, analyzing the command structure in the segmentation result through predefined interception command rules, identifying the command intent and operation object, and pre-intercepting the high-risk commands;

[0081] like Figure 2 As shown in the figure, the result of command segmentation is used as input data. The base machine service system matches the command segmentation result with the predefined interception command rules. This process is to compare the parsed command with the high-risk command patterns in the rule library one by one to find matching items. The matching methods are divided into keyword matching and pattern matching. The matching methods are as follows:

[0082] Keyword matching: Exact matching. First, the system will perform an exact match based on the keywords in the command segmentation results. For example, "rm -rf" as a whole is matched with the high-risk commands in the rule base. If the high-risk combination "rm-rf" exists in the rule base, the system will immediately mark the command as high-risk.

[0083] Path matching: The system will further analyze the path parameters in the command, such as " / var / log / ", and match them with the path keywords in the rule base. If the path involving the system core directory is matched, the system will immediately mark the command as high risk.

[0084] Pattern matching: Combined pattern matching, the system not only matches single keywords, but also matches the combined pattern of multiple entries. For example, the system recognizes the combination of "sudo", "rm", "-rf" and " / var / log / ", which may be consistent with a specific high-risk command pattern in the rule base.

[0085] Regular expression matching: Use regular expressions to match complex command patterns. Through regular expressions, the system can identify deformed or derived high-risk commands. For example, the "" in "rm -rf" can match any content, thus covering a variety of potential risk scenarios.

[0086] Nested identification: When other command operations are nested in a command, the system will identify these nested parts and parse and detect them separately. This conditional logic helps to accurately identify the risks of each subcommand in complex command scenarios. For example: if you enter the command find / -name "*.sh" -exec rm -f {} \;, the system will identify find as the main command and rm-f {} as the nested execution command, and detect rm -f as a high-risk command.

[0087] The base machine service system identifies the segmented commands. If a high-risk command is identified, the execution of the command is immediately intercepted to prevent the dangerous command.

[0088] S4. Confirm the intercepted high-risk command again. If the command is not set for secondary approval, it will be directly intercepted; if the command is set for secondary approval, the administrator will confirm whether to execute it for the second time.

[0089] like Figure 2 As shown in the figure, if the command is set for secondary approval, the system administrator needs to conduct secondary approval to determine whether to allow execution. If the administrator allows execution, the command will be automatically executed and the execution result will be fed back to the operation and maintenance user screen. Otherwise, the command will be blocked and the operation and maintenance user will be prompted. If the command is not set for secondary approval, the command will be directly blocked and the operation and maintenance user will be prompted with the reason.

[0090] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0091] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0093] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

[0094] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.

Claims

1. A character-based operation and maintenance command segmentation and parsing method based on word segmentation technology, characterized in that: The steps include: S1. Preprocess the current command and output the processed standard text command, which specifically includes the following steps: S11, analyzing the prefix of the current command, performing special segmentation according to the characteristics of the prefix, and taking the subsequent actual command as the analysis object; S12, determining whether the command type is a compound command, splitting the identified compound command into multiple sub-commands, if the command contains the symbol \, or starts with { and ends with}, or starts with ( and ends with ), or starts with ' and ends with ', it will first be recognized that this is a compound command containing multiple sub-commands, and the complex command will be split into multiple independent sub-commands; S13, removing irrelevant stop words, unifying text format and punctuation, and outputting standard text commands; S2, using a combined command segmentation method to segment the standard text command output by S1, and performing conflict resolution on the segmentation results, and outputting the segmentation results, specifically including the following steps: S21, using the forward maximum matching method and the reverse maximum matching method to match the standard text command output by S1 word by word in both the front and back directions, sorting the split commands by the length of the entries, first performing the forward maximum matching method, matching the entries in the command word by word from left to right, the system first identifies "sudo", then identifies "rm", "-rf" and the " / var / log / " path; then performing the reverse maximum matching method, matching word by word from right to left, confirming the integrity of the path " / var / log / ", "-rf", the command "rm", and "sudo"; identifying the path " / var / log / " through a regular expression and confirming it as a whole entry, and finally command segmentation output results: "sudo", "rm", "-rf", " / var / log / ", each entry is attached with a corresponding label and type identification; S22. Based on the length priority principle, if the character sequences at the same position of the word segmentation results generated by the forward maximum matching method and the reverse maximum matching method are recognized as different entries, the word segmentation result with the longer entry length is selected first; S23, giving priority to the specific structure segmentation results that meet the path identification and command parameter identification, and using regular expressions to identify the data in the specific format of file path, IP address, number, and timestamp, and treating them as a whole entry; S3, analyzing the command structure in the segmentation result through predefined interception command rules, identifying the command intent and operation object, and pre-intercepting the high-risk commands; S4. Confirm the pre-intercepted high-risk command again. If the command is not set for secondary approval, it will be directly intercepted; if the command is set for secondary approval, the administrator will confirm whether to execute it for the second time.

2. According to the character-based operation and maintenance command segmentation and parsing method based on word segmentation technology according to claim 1, it is characterized in that: The forward maximum matching method in S21 is specifically: A1. Starting from the first character of the standard text command, set the pointer to the character position currently being processed and determine the length of the longest hit entry, which is used as the maximum length of each match; A2. Starting from the current position of the pointer, forwardly extract the longest character string and find out whether the character string exists in the preset dictionary. If so, segment the character string as an independent word and record it in the word segmentation result. A3. Prioritize searching for a character substring that matches the longest entry in the preset dictionary. If a character substring that matches the longest entry in the preset dictionary cannot be found, reduce the length of the substring word by word until a matching character substring is found or the substring is reduced to the shortest length. A4. If a matching term is found, the pointer position is updated to the next unprocessed character and A1-A3 are repeated until the entire text is processed.

3. The character-based operation and maintenance command segmentation and parsing method based on word segmentation technology according to claim 1 is characterized in that: The reverse maximum matching method in S21 is specifically: B1. Starting from the last character of the standard text command, set the pointer to the character position currently being processed and determine the length of the longest hit entry, which is used as the maximum length of each match; B2, starting from the current position of the pointer, reverse the longest character string and find whether the character string exists in the preset dictionary. If it exists, the character string is segmented as an independent word and recorded in the word segmentation result; B3, prioritize searching for a character substring that matches the longest entry in the preset dictionary. If a character substring that matches the longest entry in the preset dictionary cannot be found, reduce the length word by word until a matching character substring is found or the length is reduced to the shortest length; B4. If a matching entry is found, the pointer position is updated to the next unprocessed character and B1-B3 are repeated until the entire text is processed.

4. The character-based operation and maintenance command segmentation and parsing method based on word segmentation technology according to claim 3 is characterized in that: In S21, if the segmentation results of the forward maximum match and the reverse maximum match are consistent, the segmentation is considered correct; if they are inconsistent, a group of segmentation results with a smaller number of matching terms is selected.

Citation Information

Patent Citations

  • A method and apparatus for detecting malicious commands

    CN109344615A

  • Command line character string processing method, terminal, device and readable storage medium

    CN110750984A

  • Command identification method and device, equipment and storage medium

    CN112799722A