Configuration risk control intelligent system combining deep learning and semantic reasoning

By combining deep learning and semantic reasoning, a configuration risk control intelligent system is built. It utilizes convolutional neural networks, generative adversarial networks, and Transformer self-attention mechanisms to construct an end-to-end instruction recognition model. This solves the problems of insufficient accuracy and real-time performance of traditional instruction authentication methods, and achieves efficient identification and personalized prompts for dangerous instructions.

CN120996102APending Publication Date: 2025-11-21ZHENGJIANG PUBLIC INFORMATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510904576.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Traditional command authentication methods are insufficient in terms of accuracy and real-time performance, making it difficult to effectively identify and filter new malicious commands. They are also costly to maintain and lack a high level of intelligence.

Method used

A configuration risk control intelligent system combining deep learning and semantic reasoning is adopted. It combines convolutional neural networks, generative adversarial networks and Transformer self-attention mechanism to build an end-to-end instruction recognition model. It identifies dangerous instructions through instruction collection, data cleaning, word embedding, feature extraction and knowledge graph, and provides personalized prompts based on user permissions.

Benefits of technology

It improves the accuracy and robustness of identifying dangerous commands, enhances network security defense capabilities, and provides personalized risk warnings and suggestions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120996102A_ABST
    Figure CN120996102A_ABST
Patent Text Reader

Abstract

According to the deep learning and semantic reasoning combined configuration risk control intelligent system provided by the invention, the trained instruction recognition model is combined with the instruction intelligent prompt map, the instruction risk information is efficiently queried through the map traversal algorithm, and personalized risk prompts and suggestions are provided for the user according to the user authority for specific scenes. According to the innovative technology, the accuracy, robustness and generalization ability of danger instruction identification can be greatly improved, powerful guarantee is provided for network security defense, and the method has important theoretical significance and application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, specifically to a configuration risk control intelligent system that combines deep learning and semantic reasoning. Background Technology

[0002] The security and stability of system configuration commands are receiving increasing attention. If a system receives and executes malicious or high-risk commands, it could lead to serious consequences such as data breaches and system crashes. However, traditional command authentication methods often suffer from problems such as low accuracy, insufficient real-time performance, and high maintenance costs.

[0003] Traditional methods primarily rely on manually writing a set of rules to identify and filter dangerous commands through pattern matching. However, due to the diverse forms of commands, the coverage of the rule set is often limited, easily overlooking new commands. Furthermore, as system complexity increases, the workload of maintaining the rule set also grows exponentially. In addition, rule engines lack a deep understanding of command semantics, relying too heavily on explicit pattern matching and lacking sufficient intelligence. Summary of the Invention

[0004] This invention aims to improve the recognition rate of dangerous instructions by providing a configuration risk control intelligent system that combines deep learning and semantic reasoning.

[0005] To achieve this objective, the present invention adopts the following technical solution:

[0006] A configuration risk control intelligent system combining deep learning and semantic reasoning is provided, comprising:

[0007] The instruction collection module is used to acquire the instructions issued by the configuration and transmit them to the dangerous instruction authentication module after data processing.

[0008] The dangerous instruction authentication module is used to identify dangerous instructions after the instructions have been processed by the instruction collection module using a pre-trained instruction recognition model; the instruction recognition model is trained by a convolutional neural network, a generative adversarial network and a Transformer self-attention mechanism.

[0009] The command alarm system is used to issue an alarm after the dangerous command authentication module identifies a dangerous command.

[0010] Preferably, the instruction collection module processes the acquired instructions by: cleaning the acquired instructions and then converting the cleaned instruction text into a word embedding sequence; the method for converting the cleaned instruction text into a word embedding sequence is as follows:

[0011] Static word embeddings are generated using pre-trained word vector models such as Word2Vec and GloVe.

[0012] Alternatively, context-aware Transformer models such as BERT and RoBERTa can be used to output a context-related vector for each token;

[0013] It supports character- and sub-word-based embedding strategies and adapts to instruction syntax fragments.

[0014] Preferably, the network structure for training the instruction recognition model includes a generator network architecture and a discriminator network architecture.

[0015] The generator network architecture is a Transformer encoder-decoder structure, consisting of an encoder and a decoder. The input representation of the generator network architecture is as follows:

[0016] The random noise vector z is mapped to a constant embedding sequence, which serves as the input to the encoder.

[0017] The encoder comprises N Transformer encoder layers, each containing a multi-head attention mechanism, layer normalization, and a feedforward fully connected network; position encoding is added to the embedding of each input token;

[0018] The decoder consists of N Transformer decoder layers, each containing a masked multi-head self-attention layer, an encoder-decoder attention layer, and a feedforward fully connected network. During decoding, the tokens generated by the encoder are masked to ensure autoregressive generation, and then the word distribution is output through a linear layer and a softmax layer.

[0019] As a preferred option, the discriminator network architecture integrates a CNN module and a Self-Attention module. The CNN module is used to capture local textual pattern features of the input word embedding sequence, and the Self-Attention module is used to capture global semantic dependencies.

[0020] The input to the discriminator network architecture is represented as follows: the word distribution represented by the text instruction sequence output by the generator network architecture is transformed into a word embedding sequence as input;

[0021] The CNN module includes 5 1D convolutional layers and max pooling layers. Each 1D convolutional layer includes 1D convolution, BatchNorm, and ReLU activation functions. After extracting text pattern features of different scales using multiple convolutional kernels of different sizes, the features are transmitted to the connected max pooling layers to downsample the feature maps. The input of the CNN module is the word embedding sequence.

[0022] The Self-Attention module includes a multi-head Self-Attention layer, which allows each word to interact with other words to capture global dependencies, and employs residual connections and layer normalization to improve training stability; the input of the Self-Attention module is the word embedding sequence.

[0023] The discriminator network structure also includes:

[0024] The fusion module is used to concatenate the local features output by the CNN module with the global features output by the Self-Attention module;

[0025] The output layer, connected to the fusion module, is used to output a discrimination score on the splicing result of the fusion module through Sigmoid, so as to distinguish dangerous instructions from normal instructions.

[0026] Preferably, the dangerous instruction authentication module specifically includes:

[0027] The input layer is used as input by concatenating the instruction features extracted by the CNN module and the Self-Attention module in the discriminator, respectively;

[0028] The feature extraction module, connected to the input layer, is used to further extract instruction features from the concatenation result;

[0029] The output layer, connected to the feature extraction module, is used to output the judgment result of whether the further extracted instruction features are dangerous instructions through the Sigmoid activation function.

[0030] Preferably, the dangerous instruction authentication module further extracts instruction features from the splicing result using the following method:

[0031] (1) Feature normalization: Batch normalization is first applied to the splicing result to eliminate scale differences between features from different sources;

[0032] (2) Parallel convolution extraction: The normalized features are input into multiple one-dimensional convolution kernels (e.g., kernel sizes of 3, 5, and 7) to capture local patterns in different receptive fields, and then activated by ReLU after convolution;

[0033] (3) Multi-head self-attention weighting: Normalized features are fed into the multi-head self-attention layer in parallel, and the temporal position with the strongest semantic relevance in the sequence is highlighted by the learned attention weights;

[0034] (4) Feature fusion and pooling: After concatenating the outputs of steps (2) and (3) along the channel dimension, perform global average pooling and global max pooling simultaneously to obtain a globally compressed feature vector;

[0035] (5) Dimensionality reduction and activation: The pooling results are input into several fully connected layers (e.g., 512→256→128 dimensions), and Batch Normalization, ReLU activation and Dropout are sequentially connected after each layer to further fuse features and suppress overfitting;

[0036] (6) Final feature output: The output of the fully connected layer is the high-dimensional feature vector used for dangerous instruction discrimination, which is fed into the Sigmoid output layer to give the danger probability.

[0037] As a preferred approach, a constructed intelligent instruction prompting graph can be used to identify dangerous instructions.

[0038] The methods for constructing an intelligent instruction suggestion graph include:

[0039] The instruction knowledge base is constructed by collecting various instructions, their uses, risks, and security measures to build an instruction knowledge base, which serves as the data source for the knowledge graph.

[0040] Entity node construction is used to extract at least one entity from the instruction knowledge base, including instructions, uses, risks, and security measures, and to create a unique node ID for each entity;

[0041] Relationship edge construction involves building relationship edges for each instruction and one or more of its purpose, risks, and security measures, and / or building permission relationship edges for different user permissions and instructions;

[0042] The intelligent instruction prompting graph storage stores one or more knowledge graph data, including the constructed instruction knowledge base, entity nodes, and relation edges, as an intelligent instruction prompting graph.

[0043] As a preferred method, the identification of dangerous commands using the constructed command intelligence prompting graph includes:

[0044] Obtain user permissions;

[0045] The current instruction is identified using an instruction recognition model;

[0046] Query the instructions recognized by the model in the intelligent instruction prompting graph;

[0047] Traverse the system library to obtain one or more of the following: purpose, risks, and security measures of the queried instructions;

[0048] Determine whether the acquired user permissions grant execution rights to the retrieved commands.

[0049] If so, execute the instruction;

[0050] If not, then the query result is determined to be a dangerous command for the current user.

[0051] Preferably, the identification of dangerous commands is completed by combining the first identification result of the dangerous command authentication module and the second identification result of the dangerous command using the command intelligent prompt map. The identification method is as follows:

[0052] The first identification result and the second identification result for the same instruction are weighted and summed to obtain the final judgment result on whether the instruction is a dangerous instruction.

[0053] This application combines a trained command recognition model with a command intelligent prompting graph. It efficiently queries command risk information using a graph traversal algorithm and provides personalized risk warnings and suggestions to users based on their permissions and specific scenarios. This innovative technology significantly improves the accuracy, robustness, and generalization ability of dangerous command recognition, providing strong support for network security defense and possessing significant theoretical and practical value. Attached Figure Description

[0054] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0055] Figure 1 This is a flowchart of the cleaning instruction data;

[0056] Figure 2 This is a structural diagram of the fusion network provided in this embodiment;

[0057] Figure 3 This is a flowchart illustrating the use of intelligent instruction prompting graphs to identify dangerous instructions;

[0058] Figure 4 This is a schematic diagram of the configuration risk control intelligent system that combines deep learning and semantic reasoning provided in this embodiment. Detailed Implementation

[0059] The technical solution of the present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0060] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual images. They should not be construed as limiting the scope of this patent. To better illustrate the embodiments of the present invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual dimensions of the product. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.

[0061] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "inner," and "outer" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present patent. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.

[0062] In the description of this invention, unless otherwise explicitly specified and limited, the term "connection" or similar designation indicating a connection between components should be interpreted broadly. For example, it can refer to a fixed connection, a detachable connection, or an integral part; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can refer to the internal communication between two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0063] The intelligent configuration risk control system combining deep learning and semantic reasoning provided in this application identifies dangerous instructions as follows: The instruction collection module obtains configuration instruction data from the system, cleans and vectorizes it, and then transmits it to the dangerous instruction authentication module. The dangerous instruction authentication module uses a pre-trained instruction recognition model to classify the instruction text and then determines the danger level of the instruction based on the classification results. For instructions classified as dangerous, the instruction alarm system issues an alarm.

[0064] The inventive point of this application is:

[0065] For the first time, three high-performing deep learning models in computer vision and natural language processing—CNN (Convolutional Neural Network), GAN (Generative Adversarial Network), and Transformer self-attention mechanism—are innovatively integrated into a unified end-to-end deep neural network architecture for dangerous instruction recognition tasks. The CNN module leverages its powerful ability to extract local patterns and hierarchical features to learn local cues that distinguish dangerous instructions from instruction text data. The GAN's generative adversarial training mechanism endows the model with excellent generalization and adversarial capabilities, enhancing its robustness against adversarial examples and unknown instructions. The Transformer self-attention mechanism performs global semantic modeling of the entire instruction sequence by capturing long-range dependencies between elements in the sequence. These three components complement each other in this fused network: CNN mines local cues, GAN enhances generalization, and Transformer completes semantic modeling, ultimately outputting a judgment result on whether the instruction belongs to the dangerous category. This achieves a perfect fusion of local feature extraction, adversarial training generalization, and global semantic understanding. Through a cleverly designed loss function and an end-to-end joint training strategy, this innovative model achieves a comprehensive improvement in accuracy, robustness, and generalization ability in the dangerous command identification task, laying a solid foundation for enhancing network security defense capabilities. The command identification model provided in this application, trained on large-scale command data, can efficiently and accurately classify and identify whether input commands are dangerous or not. Then, based on contextual and user information, it provides personalized prompts through a knowledge graph.

[0066] like Figure 4 As shown, the configuration risk control intelligent system combining deep learning and semantic reasoning provided in this embodiment includes:

[0067] The instruction collection module is used to acquire the instructions issued by the configuration and transmit them to the dangerous instruction authentication module after data processing.

[0068] The dangerous instruction authentication module is used to identify dangerous instructions after the instruction collection module has processed the data using a pre-trained instruction recognition model. The instruction recognition model is trained by a convolutional neural network, a generative adversarial network, and with the help of the Transformer self-attention mechanism.

[0069] The alarm system is used to issue an alarm after the dangerous command authentication module identifies a dangerous command.

[0070] I. Data Preprocessing

[0071] like Figure 1 As shown, the instruction collection module performs data processing on the acquired instructions, including:

[0072] 1.1.1 Establish a custom data model to clean instruction data. Encapsulate the custom data model within the system to enable it to clean instruction data. When the system cleans instructions, it stores instruction data that has not yet been cleaned. When the number of stored instructions reaches a certain threshold, the system will learn autonomously, provide feedback to the user, remind them to optimize the internal data model, and offer optimization solutions.

[0073] In this embodiment, the system's autonomous learning includes:

[0074] The system first performs statistical feature analysis on the accumulated new instructions that have not yet been triggered for cleaning (such as the distribution of common keywords, the diversity of field formats, and the types / frequency of abnormal characters).

[0075] Based on the above statistical results, the system will automatically (online or offline) adjust existing cleaning rules or model parameters, for example:

[0076] The stop word list is dynamically updated (if some high-frequency words are misjudged as invalid words, they are removed);

[0077] Refine the regular expression matching rules (generate or modify the corresponding regular expression for newly appearing illegal characters or formats);

[0078] Retrain or fine-tune the spell correction module (based on newly discovered abbreviations, aliases, or common misspellings).

[0079] The system provides feedback to the user including:

[0080] Cleaning coverage and statistics on missed or false detections: This shows how many instructions were successfully cleaned after the new rules were applied, and which patterns were still missed or misjudged.

[0081] Typical exception examples: List the most common cases of data cleaning failure (such as new format fields, unrecognized abbreviations, etc.) to remind users to pay attention;

[0082] Optimization suggestion list: For scenarios with missed or false detections, suggestions are provided for rule improvement (such as "suggest adding 'cfgx' to the alias dictionary" or "adding support for %2F to the URL discrimination rules").

[0083] In this embodiment, the internal data model is optimized as follows:

[0084] Incremental learning / online update: Feedback user-confirmed or corrected examples (positive / negative examples) back to the cleaned model, and continue training in a small-batch incremental manner to quickly adapt to new instruction formats;

[0085] Rule generator: Automatically extracts pattern candidates from high-frequency missed detection samples in the background, and automatically generates or modifies cleaning regularization through confidence evaluation;

[0086] Human-machine collaborative annotation: For samples with low system confidence, a task to be reviewed is automatically created, allowing users to confirm and provide feedback with one click on the interface. The feedback results are used for the next model iteration.

[0087] The system provides the following optimization method:

[0088] The system maintains an "optimization decision engine" that automatically scores based on cleaning logs and evaluation metrics (such as Precision / Recalculation, cleaning time, etc.) and selects the modules that most urgently need improvement.

[0089] For each improvement request, the engine will recommend specific operations from the predefined "optimization action library" (such as "expanding the dictionary", "adjusting regularization", "fine-tuning the model learning rate") according to priority;

[0090] The generated "optimization plan" includes both high-level improvement directions (such as "strengthening the support of Chinese word segmentation model for new terms") and small iterative actions that can be directly implemented (such as "adding 5 common abbreviation mappings").

[0091] The “internal data model” mentioned here refers to the custom model in the system that abstracts and encapsulates instructions, including a cleaning rule set, a dictionary, a regular expression set, a simple spell correction module, and a trainable embedding and word segmentation sub-module.

[0092] It is not a fixed open-source tool, but is defined and continuously expanded / fine-tuned by users according to their own business scenarios—therefore it has a high degree of flexibility: new validation fields can be inserted, word segmentation tools can be replaced, and embedding strategies can be upgraded, etc.

[0093] 1.1.2 Perform data cleaning in the data storage to extract useful information from the data.

[0094] In this embodiment, the useful information in the data includes:

[0095] 1. Instruction keywords (Intent), including:

[0096] Action verbs (such as "start", "stop", "configure", etc.)

[0097] Operation types (create, delete, modify, query, authorize, revoke, etc.)

[0098] 2. Target Entity, including:

[0099] Device identifier (Device ID, IP address, MAC address)

[0100] Configuration item names (such as "interface rate", "log level", etc.)

[0101] 3. Parameters and their values, including:

[0102] Parameter name (e.g., "bandwidth", "timeout")

[0103] Parameter values ​​(e.g., "100Mbps", "30s")

[0104] Parameter data type (numeric, enumeration, boolean, string)

[0105] 4. Execution context information, including:

[0106] User / Service Initiator (Username, Role, Service Process)

[0107] Timestamp (command issuance time)

[0108] Source IP / port

[0109] 5. Dependencies and Preconditions, including:

[0110] Associated commands (initialization instructions that must be executed first)

[0111] Environmental status (current system mode, security level, etc.)

[0112] 6. Security and Permission Tags, including:

[0113] Minimum privilege requirements (e.g., "Administrator", "Operations and Maintenance")

[0114] Sensitivity level (low / medium / high risk)

[0115] 7. Semantic Roles, including:

[0116] Subject-verb-object structure (who does what, and what is done)

[0117] Conditional and constraint phrases ("if...then...", "only if...")

[0118] 8. Anomaly Patterns, including:

[0119] Illegal character position and type

[0120] Spelling or grammar anomalies (abbreviations, spelling mistakes)

[0121] 9. Logging & Trace information, including:

[0122] Command execution result code, system response latency, error code

[0123] The method for data cleaning of the obtained instructions is as follows:

[0124] Remove illegal characters, such as special control characters, escape characters, etc.;

[0125] Format normalization: unify case, unify field symbol style;

[0126] Chinese word segmentation (such as using THULAC / jieba tools);

[0127] Stop word filtering: remove high-frequency invalid words such as "of", "and", "is", etc.;

[0128] Spelling / grammar correction, such as automatically converting "cfg" to "configure".

[0129] 1.1.3. After obtaining the processed encapsulated data, classify the data, establish a data classification table, and change the structure to make the data available for subsequent model learning. Perform corresponding verification on the encapsulated data according to the data model. The verification rules include: definition of instruction keywords, instruction objects, instruction core content, and instruction relationships.

[0130] Examples of encapsulated data are:

[0131]

[0132]

[0133] The method for classifying the data and establishing a data classification table is as follows:

[0134] Data classification

[0135] 1. Classify by instruction type [[ID=​​​​​​​​​​

[0140] 2. Classified by risk level

[0141] High risk: Modifying core system parameters, restarting critical services

[0142] Medium risk: Changes to common configuration items

[0143] Low risk: Query or read-only operations

[0144] 3. Categorize by module

[0145] Network modules (interface, route, ACL)

[0146] Security modules (firewall, SSH, user management)

[0147] System modules (service, process, time sync)

[0148] Create a classification table

[0149] It is divided into a dictionary table and a main table. The dictionary table stores the allowed enumeration values, and the main table uses foreign keys or CHECK constraints to ensure the validity of command_type, risk_level, and module.

[0150] The method for changing the structure of categorized data is as follows:

[0151] Dictionary normalization: Change enumeration fields (such as command_type, risk_level, module) to foreign keys that reference dictionary tables.

[0152] Entity table partitioning:

[0153] The `command_params` parameter list: One command corresponds to multiple lines of parameters.

[0154] The `command_conditions` table only applies to conditional directives.

[0155] JSON column storage: For free text fields that are not frequently queried (such as raw_text, semantic_roles), they can be retained as JSONB columns, which also provides flexibility.

[0156] The data models used to perform corresponding validations on the encapsulated data include:

[0157] Logical model: Based on ER diagram, the main entities are Command, Parameter, Condition, User, Module, and RiskLevel.

[0158] Physical model: a relational table as shown above; or in a NoSQL scenario, using MongoDB's document model, where each Command document embeds params and conditions arrays.

[0159] Validation model: Based on JSON Schema or a custom validation framework (such as Spring Validation in Java), perform structure and content validation before data is imported into the database.

[0160] In this embodiment, verifying the packaged data includes:

[0161] 1. Command Keyword Validation

[0162] Objective: Ensure that the verbs or operators that must be included in the instructions appear and are spelled correctly, and do not allow unknown or ambiguous words to be included in the database.

[0163] Specific steps:

[0164] Predefined keyword dictionary

[0165] Table keyword_dict(keyword VARCHAR,category VARCHAR), such as ("configure", "ACTION"), ("start", "ACTION").

[0166] Matching after word segmentation

[0167] The cleaned_text was split into a list of tokens using a token segmentation tool (jieba / THULAC).

[0168] Exact and Fuzzy Matching

[0169] Precision: Check if the token set contains at least one dictionary entry with category=ACTION;

[0170] Fuzzy: For unmatched tokens, perform a fuzzy comparison with dictionary entries with an Edit Distance ≤ 1 to capture common spelling errors.

[0171] Verification results

[0172] If there is neither an exact match nor a fuzzy match, mark it as "keyword missing" or "unknown operation word", reject the data from entering the database and record the exception log.

[0173] 2. Instruction object verification

[0174] Objective: To confirm that the objects (devices, interfaces, services, etc.) operated on in the command are legitimate and identifiable in the system.

[0175] Specific steps:

[0176] Loading object whitelist

[0177] Table object_dict(obj_key VARCHAR,obj_type VARCHAR,extra_info JSON), such as ("GigabitEthernet0 / 1","INTERFACE").

[0178] Regular expression validation

[0179] Different obj_types define regular expression templates:

[0180] INTERFACE: ^GigabitEthernet\d+ / \d+$

[0181] SERVICE: ^[a-zA-Z0-9_-]+d$ (such as "sshd")

[0182] Table lookup verification

[0183] Perform a primary key check between the extracted object token and the object_dict;

[0184] If the object does not exist or the regular expression fails, it is marked as "object is invalid" or "object is not registered".

[0185] System status verification (optional)

[0186] If the object is in the whitelist, an API call can be initiated to the asset management system to verify the object's current status (whether it is online or enabled) and write the result to the context field.

[0187] ________________________________________

[0188] 3. Verification of core instruction content

[0189] Objective: To verify whether the action, object, and parameter triples in the instruction are semantically complete and whether the parameter values ​​are reasonable.

[0190] Specific steps:

[0191] Triple skewer extraction

[0192] Using a custom dependency parsing template, extract<action,object,params> Triplet.

[0193] Parameter schema validation

[0194] Configure the schema parameter for different action / object combinations:

[0195] yaml

[0196] Copy and edit

[0197]

[0198] Check if the extracted params contains required_params and if the types match.

[0199] Numerical range and enumeration verification

[0200] Numeric type: Check if min ≤ value ≤ max, such as 0 <speed≤10000;

[0201] Enumeration type: The parameter value must be in the defined enumeration list, otherwise an "invalid parameter value" error will be reported.

[0202] Semantic consistency check

[0203] If action = restart and object_type = SERVICE, check that params must contain service_name; otherwise, prompt "Core content is incomplete".

[0204] 4. Instruction relationship definition verification

[0205] Objective: To verify whether the logical relationships (such as conditions and dependencies) within the instructions meet the format and business rules, and to ensure context consistency.

[0206] Specific steps:

[0207] Conditional statement format validation

[0208] Perform JSON Schema validation on the condition field:

[0209] jsonc

[0210] Copy and edit

[0211]

[0212]

[0213] If the operator is not in the allowed set, the error message "Illegal conditional operator" will be returned.

[0214] Dependency chain validity check

[0215] For each command_id in the dependencies array, look up the command main table for a status of "successful" or "completed".

[0216] If any dependency is incomplete, the system will report "Dependency not ready" and refuse to execute the current instruction.

[0217] Permission and Relationship Verification

[0218] Define the relationship between user roles and commands in permission_model:

[0219] SQL

[0220] Copy and edit

[0221] CREATE TABLErole_command(

[0222] role VARCHAR,command_type VARCHAR );

[0224] --Such as ('operator','QUERY'),('administrator','CONFIG')

[0225] Check if the current user_role matches the command_type association table. If they do not match, display the message "Insufficient permissions".

[0226] Multi-instruction transaction relationship verification

[0227] For transactional instruction sequences (such as "if...then...else..."), verify logical integrity:

[0228] The if statement must correspond to a then statement, but else is optional.

[0229] Each branch action must pass the above core content verification.

[0230] 1.1.4. Convert the cleaned instruction text into a word embedding sequence, which will then serve as input to the dangerous instruction authentication module. The method for converting the cleaned instruction text into a word embedding sequence is as follows:

[0231] Static word embeddings are generated using pre-trained word vector models such as Word2Vec and GloVe.

[0232] Alternatively, context-aware Transformer models such as BERT and RoBERTa can be used to output a context-related vector for each token;

[0233] It supports character- and sub-word-based embedding strategies and adapts to instruction syntax fragments.

[0234] II. Converged Network Design

[0235] The fusion network designed in this application consists of a Transformer-GAN generator and a discriminator that integrates a CNN and a self-attention module. The discriminator is used both for GAN adversarial training and as an independent instruction recognition model. By alternately updating the generator and the discriminator, high-quality instruction generation capability and accurate dangerous instruction detection capability are obtained respectively.

[0236] 2.1.1 Generator Section

[0237] Generator network architecture: Based on the Transformer sequence-to-sequence (Seq2Seq) model, using the standard Transformer encoder-decoder structure.

[0238] The input to the generator network architecture is represented as: mapping a random noise vector z to a constant embedding sequence, which serves as the input to the encoder.

[0239] Random noise vector z: taken from a standard normal distribution vector to ensure the diversity of generator output.

[0240] Mapping to a constant embedding sequence: z is transformed into a sequence of vectors consistent with the vocabulary size or the model's hidden dimension through a learnable linear layer (or lookup table operation), which maintains its length and position unchanged (i.e., "constant") during each training iteration.

[0241] As encoder input: This mapped embedding sequence is the "token embedding" received by the subsequent N Transformer encoder layers.

[0242] The encoder consists of N Transformer encoder layers, each containing a multi-head attention mechanism, layer normalization, and a feedforward fully connected network; position encoding is added to the embedding of each input token.

[0243] The data input / output relationships of the multi-head attention mechanism, layer normalization, and feedforward fully connected network in each layer are as follows:

[0244] Input: The hidden state sequence H(l-1)∈RT×d output from the previous layer, where T is the sequence length and d is the model's hidden dimension. Multi-Head Attention:

[0245] Attention(Q,K,V)=softmax(QKTd)V,

[0246] Each head's Q, K, V comes from a linear mapping of H(l-1), d = d / . After concatenating and linearly transforming the multiple heads, A(l) ∈ RT × d is generated. Residual connection + Layer Normalization (LayerNorm):

[0247] X(l)=LayerNorm(H(l-1)+A(l)).

[0248] Feed-Forward Network (FFN):

[0249] FFN(X) = ReLU(XW1+b1)W2+b2,

[0250] Where W1∈Rd×dff and W2∈Rdff×d, we get F(l)∈RT×d.

[0251] Quadratic residual connection + layer normalization:

[0252] H(l)=LayerNorm(X(l)+F(l)).

[0253] Position encoding refers to using sine and cosine for position encoding at the i-th position.

[0254] PEi,2k=sini / 100002k / d),PEi,2k+1=cos(i / 100002k / d),

[0255] Where k = 0, ..., d / 2-1, it is ensured that the perception of position is different in different dimensions.

[0256] Each input token refers to:

[0257] The basic semantic units (such as words, subwords, and characters) obtained from word segmentation or subwords in the text have a sequence length of T. Each token has a unique index in the vocabulary.

[0258] The embedding of each input token refers to:

[0259] Using a pre-trained or randomly initialized embedding matrix E∈RV×d (V is the vocabulary size), the token index i is mapped to the row vector E[i], resulting in the embedding vector ei∈Rd.

[0260] The method for adding position encoding to the embedding of each input token is as follows:

[0261] For the i-th token in the sequence, calculate the element-wise sum of its embedding ei and the corresponding position encoding PEi:

[0262] xi = ei + PEi.

[0263] The initial representation of the entire input sequence X(0) = [x1; x2; ...; xT] is used as the input of the first layer encoder.

[0264] The parameters are explained as follows:

[0265] T: Length of the input sequence (number of tokens)

[0266] d: Model hidden dimension (embedding dimension)

[0267] h: Number of heads in multi-head attention

[0268] d h =d / h: Dimensions of each attention head

[0269] V: Vocabulary size

[0270] l: Current Transformer layer number (1 to N)

[0271] Token: The basic semantic unit (such as word, subword, character) after input text is segmented.

[0272] The word embedding matrix, where V is the vocabulary size, and each row contains the embedding vector of a token, ei = E[i]: the embedding vector of the i-th token.

[0273] Sine and cosine position encoding at position i

[0274] x i =e i +PE i The input vector after adding the position encoding to the i-th token.

[0275] X(0): Sequence input representation, input of the first layer encoder, X(0) = [x1; x2; ...; x t ]

[0276] The input of the current layer is the output of the previous layer.

[0277] W p Q,W p K,W p V: These are the projection matrices for generating the Query, Key, and Value, respectively, with dimensions d×d. h

[0278] Q, K, V: Represent the query, key, and value vectors respectively: Q = H(l-1)W p Q, K = H(l-1)W p K, V = H(l-1)W p V

[0279] Attention(Q,K,V): Attention calculation: softmax(QK) T / √d h V

[0280] The result of concatenating all attention points is then linearly transformed and used as the output X(l) of this module: First residual path: X(l) = LayerNorm(H(l-1) + A(l))

[0281] H(l) is the second residual path: H(l) = LayerNorm(X(l) + F(l)).

[0282] LayerNorm: A layer normalization operation that performs mean-variance normalization on the feature dimensions of each token.

[0283] The first linear transformation weights expand the dimension.

[0284] First bias term

[0285] The second linear transformation weights restore the dimension.

[0286] Second bias term

[0287] FFN(X): Feedforward output: FFN(X) = ReLU(XW1+b1)W2+b2

[0288] Current layer FFN output

[0289] PE i 2k = sin(i / 10000^(2k / d)): The encoding of the i-th position in an even-numbered dimension.

[0290] PE i 2k+1=cos(i / 10000^(2k / d)): The encoding of the i-th position in an odd-numbered dimension.

[0291] k∈[0,d / 2-1]: Corresponding dimension index The encoding vector at position i

[0292] The decoder consists of N Transformer decoder layers, each containing masked multi-head self-attention, encoder-decoder attention, and feedforward fully connected network. During decoding, the tokens generated by the encoder are masked to ensure autoregressive generation, and then the word distribution is output through a linear layer and Softmax.

[0293] The data input-output relationships of the masked multi-head self-attention, encoder-decoder attention, and feedforward fully connected network in each layer are as follows:

[0294] enter:

[0295] The output of the previous layer decoder or the initial input D(l-1)∈RT′×d, and the final output of the encoder H(L)∈RT×d.

[0296] masked multi-head self-attention (Causal Multi-Head Self-Attention):

[0297] Attentionmask(Q,K,V)=softmax(QKTd+M)V, where K,Q,V are all derived from the linear mapping of D(l-1), and M∈RT′×T′ is the causal mask (see below for details); after concatenation and linear transformation of multiple heads, Aself(l)∈RT′×d is produced.

[0298] Residual connectivity and layer normalization:

[0299] X(l)=LayerNorm(D(l-1)+Aself(l)).

[0300] Encoder–Decoder Attention:

[0301] Aencdec(l)=softmax((X(l)WQ)(H(L)WK)Td)(H(L)WV),

[0302] Where WQ, WK, and WV are learnable projection matrices, and the output Aencdec(l)∈RT′×d.

[0303] Similarly, residual + layer normalization is used:

[0304] Y(l)=LayerNorm(X(l)+Aencdec(l)).

[0305] Feed-Forward Network:

[0306] F(l)=ReLU(Y(l)W1+b1)W2+b2,

[0307] Where W1∈Rd×dff and W2∈Rdff×d, F(l)∈RT′×d is generated.

[0308] Finally, perform residual + layer normalization again:

[0309] D(l) = LayerNorm(Y(l) + F(l)).

[0310] The method for masking the tokens generated by the encoder is as follows:

[0311] Construct an upper triangular causal mask matrix M ∈ R^{T'×T'}, where M_{i,j} = {0, j ≤ i; -∞, j > i}.

[0312] When calculating the self-attention scores, add this mask to QK^T / √d, so that the model can only "see" the previous (and current) positions at position i, ensuring autoregressive generation. [[ID=IO]]

[0313] The method for outputting the word distribution through a linear layer and Softmax is as follows:

[0314] Multiply the output of the last layer of the decoder D(N) ∈ R^{T'×d} by the output projection matrix W_o ∈ R^{d×V} and the bias b_o ∈ R^V:

[0315] logits_t = D_t(N)W_o + b_o, t = 1,..., T'.

[0316] Apply Softmax to the logits at each time step t:

[0317] P(y_t = v | y_{<t}, z) = exp(logits_{t,v}) / ∑_{v' = 1}^V exp(logits_{t,v'}), obtaining the probability distribution over the vocabulary size V.

[0318] The parameter explanations are as follows:

[0319] Transformer Decoder Parameter and Symbol Summary Table

[0320] T': The length of the decoder input sequence (number of predicted tokens)

[0321] d: The dimension of the model's hidden layer (embedding dimension, the same as the encoder)

[0322] h: The number of multi-head attention heads

[0323] d_k = d / h: The dimension of each attention head

[0324] l: The index of the current decoder layer, l ∈ [1, N]

[0325] N: The total number of Transformer decoder layers

[0326] D(l - 1) ∈ R^{T'×d}: The input of the l-th layer, the output of the previous layer or the initial embedding (if l = 1); H(L) ∈ R^{T×d}: The output of the encoder (L is the number of encoder layers)

[0327] M∈^{T′×T′}: Autoregressive causal masking matrix (upper triangular masking)

[0328] Q, K, V: Query, key, and value vectors derived from linear mappings of D(l-1) or H(L).

[0329] W_Q,W_K,W_V∈^{d×d}: Linear transformation matrices in the attention module

[0330] A_self(l)∈^{T′×d}: Output of the l-th layer masked self-attention

[0331] A_encdec(l)∈^{T′×d}: Output of the l-th encoder-decoder attention layer

[0332] X(l)∈^{T′×d}:First residual connection +LayerNorm output

[0333] Y(l)∈^{T′×d}:Second residual connection +LayerNorm output

[0334] W∈^{d×d_ff}: Weights of the first layer of the feedforward network; dimension expansion b∈^{d_ff}: Bias of the first layer of the feedforward network.

[0335] W∈^{d_ff×d}: Weights of the second layer of the feedforward network; b∈^{d}: Bias of the second layer of the feedforward network (dimension restored).

[0336] F(l)∈^{T′×d}:Output of the l-th layer feedforward network

[0337] D(l)∈^{T′×d}: Final output of the l-th layer (after LayerNorm)

[0338] W_o∈^{d×V}: Output projection matrix (mapped to the vocabulary space)

[0339] b_o∈^V: Output projection bias term; logits_t∈^V: Vocabulary distribution vector output at position t (unnormalized).

[0340] CausalMask mechanism

[0341] M∈^{T′×T′}: Self-attention mask matrix, used to prevent the current position from seeing future tokens M. i ={0(j≤i),-∞(j>i)}: Masking rule: Only allow looking forward from the current position.

[0342] Output probability calculation

[0343] logits = D(N)W_o + b_o: The decoder output vector D(N) is projected onto the vocabulary logits vector P(y = v). Softmax is used to normalize the logits, yielding the probability of y taking each word.

[0344] The generation process is as follows:

[0345] Given random noise z, map it into a constant embedding sequence and input it to the encoder;

[0346] The encoder encodes the constant embedding sequence and then inputs it to the decoder;

[0347] The decoder generates tokens autoregressively, sampling one token at each step until a terminator is generated or the maximum length is reached. The relationship between the token and the constant embedding sequence is as follows: the constant embedding sequence is obtained by mapping a random noise vector z and serves as the semantic starting point for generation, representing an implicit semantic intent. The final generated token is the specific linguistic expression of that semantic intent. In other words, the token is a readable instruction unit gradually generated by the decoder under the guidance of constant embedding semantics; there is an implicit semantic-driven relationship between the two, but they reside in the input and output spaces respectively.

[0348] The generator's loss can utilize the maximum likelihood of the negative discriminator output, i.e., maximizing the probability that the discriminator is fooled. Auxiliary losses, such as the cross-entropy loss between the generated and reference sequences, are also added to improve generation quality and fluency. A negative discriminator means that the discriminator's judgment of the generator's output is used as part of the loss function. The generator's goal is to "fool" the discriminator, making it unable to distinguish between the generated instruction sequence and the real instruction sequence. Specifically, this is achieved by maximizing the log-likelihood of the discriminator's output value, i.e., maximizing the probability that the discriminator considers the generated sample to be true, equivalent to minimizing -log(D(G(z))), where D is the discriminator, G is the generator, and z is the random noise input.

[0349] Preferably, the generator and discriminator are trained alternately, with the generator model or discriminator model being updated each time. The generator and discriminator are preferably trained using different optimizers, such as Adam or AdamW, and preferably with different learning rates, for example, a larger learning rate for the discriminator compared to the generator, to stabilize training. Furthermore, techniques such as batch normalization and gradient pruning are preferably employed to improve training stability.

[0350] The discriminator network architecture integrates a CNN module and a Self-Attention module. The CNN module is used to capture local textual pattern features of the input word embedding sequence, and the Self-Attention module is used to capture global semantic dependencies.

[0351] The input to the discriminator network architecture is represented as follows: the word distribution represented by the text instruction sequence output by the generator network architecture is transformed into a word embedding sequence as input;

[0352] The CNN module consists of 5 1D convolutional layers and max pooling layers. Each 1D convolutional layer includes 1D convolution, BatchNorm, and ReLU activation functions. After extracting text pattern features at different scales using multiple convolutional kernels of different sizes, the features are passed to the connected max pooling layers to downsample the feature maps.

[0353] The data input and output relationships of the 1D convolution, BatchNorm, and ReLU activation functions in each 1D convolutional layer are as follows:

[0354] The input is a two-dimensional tensor representing a sequence of word embeddings, with shape (sequence length, embedding dimension);

[0355] 1D convolution operations slide the convolution kernel along the time dimension (sequence length) to output a locally perceptual feature map;

[0356] Then, BatchNorm normalization is performed, which normalizes the features of each channel in the current batch (mean is 0, variance is 1) and outputs the normalized feature tensor.

[0357] Then, the ReLU activation function is used to perform a non-linear transformation on each feature, and the activated local features are output.

[0358] Finally, a max pooling layer is applied, which performs max pooling along the time dimension, downsampling to compress the length of the feature representation and retains the most significant response features.

[0359] BatchNorm indicates:

[0360] Batch Normalization is a technique that accelerates neural network training and improves stability. It standardizes the intermediate features of the convolutional layer output within each batch, giving them a uniform distribution, thereby alleviating the gradient vanishing problem and improving convergence speed.

[0361] The process of extracting text pattern features using a 1D convolutional layer is as follows:

[0362] 1D convolutional layers extract n-gram-level local feature patterns in the temporal dimension by sliding convolutional kernels of different sizes (such as window sizes of 3, 5, 7, etc.) over the embedded sequence. These patterns include keyword combinations in instructions and the combinational relationships between verbs and objects, thereby capturing semantic fragments and syntactic structures. Multiple convolutional kernels can cover different receptive fields and extract semantic information at different scales.

[0363] The Self-Attention module includes a multi-head Self-Attention layer, which allows each word to interact with other words to capture global dependencies. Residual connections and layer normalization are used to improve training stability. The input to the multi-head Self-Attention layer is also a sequence of word embeddings. The process of capturing the global dependencies of the word embedding sequence by the Self-Attention layer is as follows: the input word embedding sequence is mapped to three vectors, Query(Q), Key(K), and Value(V), respectively. By calculating the dot product of Query and Key and performing scaling and Softmax normalization, the attention weight of each word to all other words is obtained. Then, the corresponding Value vector is weighted and summed, and the output is a representation containing global context information. Multiple attention heads perform the above operations in parallel to capture the dependencies of different subspaces. Finally, the outputs of all attention heads are concatenated and projected to form the final global feature representation.

[0364] The discriminator network structure also includes:

[0365] The fusion module is used to concatenate the local features output by the CNN module and the global features output by the Self-Attention module. The concatenation method is as follows: the outputs of the two modules are concatenated along the feature dimension (i.e., the channel dimension) to form a joint representation tensor, which contains both local contextual information and global semantic information. Then, it is mapped to a unified feature space through a fully connected layer to ensure that the concatenated representation has consistent expressive power in subsequent classification tasks.

[0366] The output layer, connected to the fusion module, outputs a discrimination score based on the concatenation result from the fusion module using the Sigmoid function to distinguish between dangerous and normal instructions. The process of inputting the discrimination score from the concatenation result using the Sigmoid function involves feeding the output vector of the fusion module into a fully connected layer for feature compression, resulting in a single scalar. This scalar serves as the input to the Sigmoid function, which maps it to a probability value between (0,1). This probability value represents the confidence that the current instruction is a dangerous instruction. If the value is greater than a set threshold (e.g., 0.5), it is determined to be a dangerous instruction; otherwise, it is a normal instruction.

[0367] The discriminator uses a binary cross-entropy loss function, assigning "1" to dangerous commands and "0" to normal commands. Additionally, auxiliary supervisory losses, such as semantic similarity loss, can be added to improve classification accuracy.

[0368] The CNN module and the Self-Attention module can be pre-trained separately.

[0369] The dangerous command authentication module can identify dangerous commands using the command recognition model as follows:

[0370] Using the concatenated result of the instruction features extracted by the CNN module and the Self-Attention module in the discriminator as input, two fully connected layers and the ReLU activation function are used to further extract high-level instruction features from the concatenated result.

[0371] The process of improving high-level instruction features is as follows: the concatenated feature vector is input into the first fully connected layer, and a linear transformation is performed to learn the deep semantic combination relationship between different features. Then, non-linearity is introduced through the ReLU activation function so that the model can express complex instruction semantic patterns.

[0372] The output of the first layer is then fed into the second fully connected layer for further compression and reconstruction of features, so that the model focuses on the feature dimensions that have the ability to judge danger, thereby forming a more abstract and semantically complete high-level feature representation.

[0373] The specific methods to prevent overfitting are as follows:

[0374] After each fully connected layer, a Dropout layer is inserted. During the training phase, the activation values ​​of some neurons are randomly masked with a set probability (e.g., 0.5). This allows the model to use different combinations of neurons in each forward propagation, thereby reducing dependence on specific local features, improving the model's generalization ability, and preventing overfitting on the training data.

[0375] Then, through the output layer, the Sigmoid activation function is used to output the judgment result of whether the further extracted instruction features are dangerous instructions.

[0376] The process by which the output layer determines whether an instruction is dangerous based on further extracted instruction features is as follows:

[0377] High-level features are input into a single neuron in the output layer for linear transformation, and a real-valued discrimination score is calculated.

[0378] This score is then used as input to the Sigmoid function, which maps its value to a probability value between [0,1].

[0379] This probability value represents the confidence level that the current instruction is a dangerous instruction. The system can determine whether the current instruction is a dangerous instruction based on a preset threshold (such as 0.5).

[0380] If the Sigmoid function output is close to 1, it indicates that the model considers the instruction to be dangerous with high confidence; if the output is close to 0, it indicates that the instruction is judged to be normal.

[0381] This application combines the instruction features extracted by the discriminator with the instruction features extracted separately by the dangerous instruction authentication module, making full use of the discriminator's learned discrimination knowledge and reducing model training costs. At the same time, it also makes the dangerous instruction authentication module independent, with a certain degree of flexibility and scalability.

[0382] The fusion network provided in this embodiment for training the instruction recognition model is as follows: Figure 2 As shown, this fusion network can train two models: a Generative Adversarial Network (GAN) model and a Convolutional Neural Network (CNN) model. The GAN model includes a generator model and a discriminator model. The GAN model can generate realistic dangerous instructions for data augmentation and attack testing. The CNN model can extract discriminative features from the text to detect and classify dangerous instructions.

[0383] In this embodiment, the instruction rule engine is designed as follows:

[0384] The instruction rule engine is implemented using a thread-based rule engine framework, such as a YAML rule engine. Rules can be defined in IF-THEN form, for example:

[0385]

[0386] To further improve the accuracy of hazard level assessment, this embodiment combines the contextual information and historical information of the instruction to identify hazardous instructions. The additional information combined includes:

[0387] Instruction context: The file, script, process information, etc., where the instruction is located.

[0388] User information: User identity, permissions, etc., of the user executing the command.

[0389] Time information: instruction execution time, frequency, etc.

[0390] System information: system configuration, operating environment, etc.

[0391] History: The user's execution history of this command.

[0392] A context collection module can be built to extract relevant information from different data sources (such as logs, process information, file metadata, etc.) and store it in a database.

[0393] Finally, a comprehensive evaluation will be conducted:

[0394] The dangerous command classification results from the command recognition model, the dangerous command level assessment from the command rule engine, and the context and historical information of the command are used to calculate a comprehensive danger score. Based on this comprehensive score, the command is then classified into different danger levels. For example:

[0395] Low risk (0-30 points)

[0396] Medium risk (31-70 points)

[0397] Dangerous (71-100 points)

[0398] The advantage of this approach is that it combines the command recognition model, command rule engine, and contextual information, leveraging their respective strengths to improve the accuracy and interpretability of risk level assessment. Furthermore, incorporating historical records helps detect persistent attacks and anomalous behavior patterns.

[0399] In addition, dangerous commands can be identified by designing intelligent command prompt maps, such as... Figure 3 As shown, specifically:

[0400] The instruction suggestion graph will include the following main entity types and relation types:

[0401] Entity type:

[0402] Instruction

[0403] Purpose

[0404] Risk

[0405] Security Measures

[0406] User permissions (UserPermission)

[0407] Relationship type:

[0408] It has a purpose.

[0409] There may be risks (mayHaveRisk)

[0410] Recommended method: (recommendsMeasure)

[0411] HasPermission

[0412] For example:

[0413] Command "rm -rf / "

[0414] Purpose: To delete files / directories

[0415] Potential risks: Deleting critical system files is recommended using the safer command (rm -i).

[0416] Regular user permissions

[0417] Permissions granted: Cannot execute "rm -rf / "

[0418] In this embodiment, the construction method of the intelligent instruction prompting graph is as follows: 1. Construction of the instruction knowledge base.

[0419] 1. Collect information on common commands, their uses, risks, and recommended measures to construct a command knowledge base, which serves as the data source for the knowledge graph. 2. Entity node construction.

[0420] Extract entities such as instructions, uses, risks, and security measures from the instruction knowledge base. The extraction method is as follows:

[0421] Rule-based text parsing methods (such as regular expressions) are used to identify keywords, parameters, path identifiers, etc. in the command line structure and extract the "instruction" entity.

[0422] Use semantic classification models (such as BERT+ classifier) ​​to identify phrases such as "purpose", "risk", and "safety measures" in text fragments;

[0423] If the knowledge base contains structured data (such as Excel / CSV), then entity columns can be extracted directly through field mapping.

[0424] For the "user permissions" entity, standardized entity extraction is performed based on system permission categories (such as root, ordinary user, sudoer).

[0425] Create a unique node ID for each entity

[0426] 3. Relationship edge construction

[0427] Based on the instruction knowledge base, a relationship edge is constructed between each instruction and its purpose / risk / measure. The construction method is as follows: for each instruction record, according to field mapping rules, such as associating the "command" field with "purpose",

[0428] The fields are "risk" and "recommendation";

[0429] By aligning entity names with unique IDs, edges of type hasPurpose, mayHaveRisk, and recommendationsMeasure are established between the "Instruction" node and the corresponding "Purpose", "Risk", and "Safety Measures" nodes.

[0430] For situations involving multiple uses or risks, multiple edges are established to support one-to-many relationships.

[0431] To construct permission relationship edges for different user permissions and instructions, the construction method is as follows: based on the permission control fields in the knowledge base (such as "allowed_user_roles" or "required_permission_level"), the permission level is mapped to the "user permission" entity;

[0432] Create an edge of type hasPermission, connecting the "User Permission" node and the "Instruction" node, indicating whether the permission level has the ability to execute the instruction;

[0433] If a certain permission level cannot execute the command, an edge attribute such as canExecute=false can be added to enhance the expressive capability.

[0434] 4. Intelligent instruction prompts and graph storage

[0435] Use graph databases (such as Neo4j) or other NoSQL databases to store knowledge graph data.

[0436] In this embodiment, the process of using the constructed intelligent instruction prompting graph to perform risk assessment and suggestions for instructions is as follows:

[0437] 1. Obtain user permissions

[0438] The system obtains the current user's account and permission information.

[0439] 2. Command recognition

[0440] Identify the current instruction using an instruction recognition model

[0441] 3. Intelligent instruction prompts and graph query

[0442] Query the instruction node in the intelligent prompt system.

[0443] Traverse the system library to obtain information such as its purpose, risks, and measures.

[0444] Determine if execute permission is granted based on user permissions.

[0445] 4. Risk Warnings and Suggestions

[0446] Based on the query results, the following prompts are generated for the user:

[0447] Instruction Purpose

[0448] Potential risks

[0449] Recommended safety measures

[0450] Does the user have execute permission?

[0451] 5. Log recording

[0452] Risk assessment results, user information, and instruction context are recorded in the log.

[0453] This design stores structured knowledge related to instructions in an intelligent instruction prompt graph, enabling efficient retrieval of risk information through graph traversal algorithms. Furthermore, by incorporating user permissions, personalized risk warnings and suggestions can be provided based on specific circumstances, improving the system's interpretability and user experience.

[0454] In summary, this application combines a trained command recognition model with a command intelligent prompting graph. It efficiently queries command risk information using a graph traversal algorithm and provides personalized risk warnings and suggestions to users based on their permissions and specific scenarios. This innovative technology significantly improves the accuracy, robustness, and generalization ability of dangerous command recognition, providing strong support for network security defense and possessing significant theoretical and practical value.

[0455] It should be stated that the above-described specific embodiments are merely preferred embodiments of the present invention and the technical principles employed. Those skilled in the art should understand that various modifications, equivalent substitutions, and variations can be made to the present invention. However, such variations, as long as they do not depart from the spirit of the present invention, should be within the scope of protection of the present invention. Furthermore, some terminology used in this specification and claims is not limiting, but merely for ease of description.

Claims

1. A configuration risk control intelligent system combining deep learning and semantic reasoning, characterized in that, include: The instruction collection module is used to acquire the instructions issued by the configuration and transmit them to the dangerous instruction authentication module after data processing. The dangerous instruction authentication module is used to identify dangerous instructions by using a pre-trained instruction recognition model after the instruction collection module has processed the data. The instruction recognition model is trained using a convolutional neural network, a generative adversarial network, and a Transformer self-attention mechanism. The command alarm system is used to issue an alarm after the dangerous command authentication module identifies a dangerous command.

2. The intelligent configuration risk control system combining deep learning and semantic reasoning according to claim 1, characterized in that, The instruction collection module processes the acquired instructions by cleaning the data and then converting the cleaned instruction text into a word embedding sequence. The method for converting the cleaned instruction text into a word embedding sequence is as follows: Static word embeddings are generated using pre-trained word vector models such as Word2Vec and GloVe. Alternatively, context-aware Transformer models such as BERT and RoBERTa can be used to output a context-related vector for each token; It supports character- and sub-word-based embedding strategies and adapts to instruction syntax fragments.

3. The intelligent configuration risk control system combining deep learning and semantic reasoning according to claim 1, characterized in that, The network structure for training the instruction recognition model includes a generator network architecture and a discriminator network architecture. The generator network architecture is a Transformer encoder-decoder structure, consisting of an encoder and a decoder. The input representation of the generator network architecture is as follows: The random noise vector z is mapped to a constant embedding sequence, which serves as the input to the encoder. The encoder includes N Transformer encoder layers, each layer containing a multi-head attention mechanism, layer normalization, and a feedforward fully connected network. Location encoding is added to the embedding of each input token; The decoder consists of N Transformer decoder layers, each containing a masked multi-head self-attention layer, an encoder-decoder attention layer, and a feedforward fully connected network. During decoding, the tokens generated by the encoder are masked to ensure autoregressive generation, and then the word distribution is output through a linear layer and a softmax layer.

4. The intelligent configuration risk control system combining deep learning and semantic reasoning according to claim 3, characterized in that, The discriminator network architecture integrates a CNN module and a Self-Attention module. The CNN module is used to capture local textual pattern features of the input word embedding sequence, and the Self-Attention module is used to capture global semantic dependencies. The input to the discriminator network architecture is represented as follows: the word distribution represented by the text instruction sequence output by the generator network architecture is transformed into a word embedding sequence as input; The CNN module includes 5 1D convolutional layers and max pooling layers. Each 1D convolutional layer includes 1D convolution, BatchNorm, and ReLU activation functions. After extracting text pattern features of different scales using multiple convolutional kernels of different sizes, the features are transmitted to the connected max pooling layers to downsample the feature maps. The input of the CNN module is the word embedding sequence. The Self-Attention module includes a multi-head Self-Attention layer that allows each word to interact with other words to capture global dependencies, and employs residual connections and layer normalization to improve training stability. The input to the Self-Attention module is the word embedding sequence; The discriminator network structure also includes: The fusion module is used to concatenate the local features output by the CNN module with the global features output by the Self-Attention module; The output layer, connected to the fusion module, is used to output a discrimination score on the splicing result of the fusion module through Sigmoid, so as to distinguish dangerous instructions from normal instructions.

5. The intelligent configuration risk control system combining deep learning and semantic reasoning according to any one of claims 1-4, characterized in that, The dangerous command authentication module specifically includes: The input layer is used as input by concatenating the instruction features extracted by the CNN module and the Self-Attention module in the discriminator, respectively; The feature extraction module, connected to the input layer, is used to further extract instruction features from the concatenation result; The output layer, connected to the feature extraction module, is used to output the judgment result of whether the further extracted instruction features are dangerous instructions through the Sigmoid activation function.

6. The intelligent configuration risk control system combining deep learning and semantic reasoning according to claim 5, characterized in that, The dangerous command authentication module further extracts command features from the splicing result using the following method: (1) Feature normalization: Batch normalization is first applied to the splicing result to eliminate scale differences between features from different sources; (2) Parallel convolution extraction: The normalized features are input into multiple one-dimensional convolution kernels to capture local patterns in different receptive fields. After convolution, they are activated by ReLU. (3) Multi-head self-attention weighting: Normalized features are fed into the multi-head self-attention layer in parallel, and the temporal position with the strongest semantic relevance in the sequence is highlighted by the learned attention weights; (4) Feature fusion and pooling: After concatenating the outputs of steps (2) and (3) along the channel dimension, global average pooling and global max pooling are performed simultaneously to obtain a globally compressed feature vector. (5) Dimensionality reduction and activation: The pooling results are input into several fully connected layers, and BatchNormalization, ReLU activation and Dropout are sequentially connected after each layer to further fuse features and suppress overfitting; (6) Final feature output: The output of the fully connected layer is the high-dimensional feature vector used for dangerous instruction discrimination, which is fed into the Sigmoid output layer to give the danger probability.

7. The intelligent configuration risk control system combining deep learning and semantic reasoning according to claim 5, characterized in that, By constructing an intelligent instruction prompting graph, dangerous instructions can be identified. The methods for constructing an intelligent instruction suggestion graph include: The instruction knowledge base is constructed by collecting various instructions, their uses, risks, and security measures to build an instruction knowledge base, which serves as the data source for the knowledge graph. Entity node construction is used to extract at least one entity from the instruction knowledge base, including instructions, uses, risks, and security measures, and to create a unique node ID for each entity; Relationship edge construction involves building relationship edges for each instruction and one or more of its purpose, risks, and security measures, and / or building permission relationship edges for different user permissions and instructions; The intelligent instruction prompting graph storage stores one or more knowledge graph data, including the constructed instruction knowledge base, entity nodes, and relation edges, as an intelligent instruction prompting graph.

8. The intelligent configuration risk control system combining deep learning and semantic reasoning according to claim 7, characterized in that, Methods for identifying dangerous commands using a constructed command intelligence map include: Obtain user permissions; The current instruction is identified using an instruction recognition model; Query the instructions recognized by the model in the intelligent instruction prompting graph; Traverse the system library to obtain one or more of the following: purpose, risks, and security measures for the queried instructions; Determine whether the acquired user permissions grant execution rights to the retrieved commands. If so, execute the instruction; If not, the query result is determined to be a dangerous command for the current user.

9. The intelligent configuration risk control system combining deep learning and semantic reasoning according to claim 7, characterized in that, Combining the first identification result of the dangerous command authentication module and the second identification result of the dangerous command using the intelligent command prompt graph, the dangerous command is identified. The identification method is as follows: The first identification result and the second identification result for the same instruction are weighted and summed to obtain the final judgment result on whether the instruction is a dangerous instruction.