A method and device for generating port information based on potential diffusion model
Through the port information generation method based on the potential diffusion model, the efficiency and accuracy of port information generation in large-scale network environments in the prior art are solved, efficient, accurate and real-time port information generation is achieved, and the security of the network system is improved.
Patent Information
- Application Number
- CN202510041437.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2045-01-10
AI Technical Summary
The existing port information generation method is wasted computing resources in large-scale network environments, slow scanning speed, and large-scale parallel scanning, making it difficult to meet the needs of efficient, accurate and real-time monitoring.
Using the port information generation method based on the latent diffusion model, the potential variables of the port matrix are generated by training the latent diffusion model and the vector quantization variational autoencoder model, and the precise port matrix is obtained through the decoder to achieve efficient port information generation.
It effectively reduces the consumption of computing resources, improves the port scanning speed, supports large-scale parallel scanning, meets the real-time monitoring needs in large network environments, and improves the accuracy of port configuration and the overall security of the network system.
Smart Images

Figure CN119484157B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and device for generating port information based on a potential diffusion model, and belongs to the field of network technology. Background Art
[0002] The generation of port information is an important tool in the field of network security, and plays a vital role in discovering open ports and potential security vulnerabilities of network devices. However, the existing port scanning methods in port information generation have many limitations and cannot meet the requirements of high efficiency and accuracy in large-scale network environments. The existing port information generation mainly has the following problems: (1) Waste of computing resources: The existing port scanning methods in port information generation often need to scan the entire network address space, and each IP (1) The scanning speed is slow: Due to the large scale of the network, the existing scanning method for port information generation takes a long time to complete the entire scanning process, which is difficult to meet the needs of real-time monitoring; (2) The scanning speed is slow: Due to the large scale of the network, the existing scanning method for port information generation takes a long time to complete the entire scanning process, which is difficult to meet the needs of real-time monitoring; (3) It is impossible to perform large-scale parallel scanning: Most of the existing port scanning methods rely on real-time updates of the scanning results, which makes it difficult to perform large-scale parallel scanning, limiting their application in large-scale network environments. Summary of the invention
[0003] The present invention provides a method and device for generating port information based on a potential diffusion model, which can effectively reduce computing resources, improve port scanning speed, adapt to real-time monitoring requirements in a large-scale network environment, and effectively discover vulnerabilities.
[0004] In order to solve the above technical problems, the present invention provides a method for generating port information based on a potential diffusion model, comprising the following steps:
[0005] Step 1: Train the latent diffusion model and the vector quantized variational autoencoder model by using the training samples of the acquired network devices, thereby completing the training of the latent diffusion model and the vector quantized variational autoencoder model;
[0006] Step 1 is as follows:
[0007] 1.1 Constructing a latent diffusion model and a vector quantized variational autoencoder model, the latent diffusion model consists of an embedding module and U-Net Module composition: the vector quantized variational autoencoder model consists of an encoder, a decoder and a codebook;
[0008] 1.2 Obtain training samples, which include n sample port information of n network devices, sample port information of the n network devices IP address, label noise of each of the sample port information, where nis an integer greater than or equal to 1;
[0009] 1.3 Encode the port information of each network device in the training sample into a sample port matrix, then merge the encoded n sample port matrices into a three-dimensional port matrix tensor, train the vector quantized variational autoencoder model through the three-dimensional port matrix tensor, obtain the potential variable tensor of the three-dimensional port matrix, and complete the training of the vector quantized variational autoencoder model;
[0010] 1.4 Each sample of the training sample IP The address is digitized, encoded, and dimensioned in turn to obtain each sample. IP The 64*64 tensor of the address, and then the multiple samples obtained IP The 64*64 tensors of the addresses are merged into three dimensions IP Address tensor, 3D IP The dimension of the address tensor is consistent with the dimension of the latent variable tensor of the three-dimensional port matrix in step 1.3;
[0011] 1.5 Using the latent variable tensor of the three-dimensional port matrix obtained in step 1.3 and the three-dimensional IP Address tensor, train the potential diffusion model, thereby completing the training of the potential diffusion model;
[0012] Step 2: Get the network device for which port information needs to be generated IP Address, take the noise and time step sampled from the standard normal distribution as initial data;
[0013] Step 3: Set the IP address of each network device obtained in step 2 IP The addresses and initial data are input into the latent diffusion model for iteration to generate the corresponding latent variables of the port matrix of each network device;
[0014] Step 4: Decode the latent variables of the port matrix of each network device generated in step 3 using the decoder of the vector quantized variational autoencoder model to obtain the corresponding port matrix of each network device.
[0015] Preferably, the step 1.3 is specifically:
[0016] 1.3.1 The sample port information of each network device in the training sample is encoded into a sample port matrix through the following steps: Initialize the sample port matrix M , sample port matrix M The value of all positions in the sample port matrix is 0.0. M Each position ( i, j ) is set to 0.0, that is, M ( i, j)=0.0, calculate each open port in the sample port information p i In the sample port matrix M The position in , where the row position is , the column position is , and the sample port matrix M The value of the corresponding position is set to 1.0, that is, ,in, i and j Represents the sample port matrix M The row and column positions of
[0017] 1.3.2 Superimpose the multiple sample port matrices generated in step 1.3.1 along the first dimension to form n *256*256 three-dimensional port matrix tensor;
[0018] 1.3.3 Training the vector quantized variational autoencoder model: The encoder of the vector quantized variational autoencoder model converts each sample port matrix in the three-dimensional port matrix tensor M All were transformed into continuous latent variables Z e ( M ), and then through the quantization step, each continuous latent variable is mapped to the discrete codebook to obtain each latent variable Z e ( M ) Z q ( M ), the decoder of the vector quantized variational autoencoder model converts each quantized value Z q ( M ) is refactored into , according to each and the corresponding sample port matrix M The corresponding sample port matrix is obtained by calculating the mean square error M The reconstruction loss , according to each continuous latent variable Z e ( M ) and the corresponding quantized value of the latent variable Z q ( M ) Calculate the mean square error to get the corresponding sample port matrix M The quantization error ,according to Calculate the overall error ,in αIt is used to control the ratio between the two errors. Repeat the above process until the overall error converges to complete the training of the vector quantized variational autoencoder model. When the overall error converges, the port matrix of each sample is obtained. M Reconstruction is the corresponding sample port matrix M Latent variables , n Sample port matrix M Latent variables A tensor of latent variables that are stacked along the first dimension to form a three-dimensional port matrix.
[0019] Preferably, the step 1.4 is specifically:
[0020] The samples of each network device in the training sample IP The addresses are divided into 4 decimal values, and each decimal value is converted into a binary value;
[0021] For each sample IP The address constructs a 64*64 tensor with the high 4 bits and low 4 bits of the corresponding binary value as the row index and column index of the encoding structure respectively. Each sample IP The high 4 bits and low 4 bits of the binary value corresponding to the address are set to 1.0 in the corresponding position of the 64*64 tensor, and then the dimension of each 64*64 tensor is adjusted and expanded. Finally, multiple samples are IP The 64*64 tensors of addresses are stacked along the first dimension to form n *64*64 three-dimensional IP address tensor, the dimension of the three-dimensional IP address tensor is consistent with the dimension of the latent variable tensor of the three-dimensional port matrix.
[0022] Preferably, the step 1.5 is specifically as follows:
[0023] For each sample port matrix of the three-dimensional port matrix latent variable tensor, the latent variable Noise is added, and the time step t Step 2, get the latent variables of the sample port matrix after adding noise , will get n The latent variables of the sample port matrix after adding noise Stack along the first dimension to form a three-dimensional latent variable tensor;
[0024] The three-dimensional latent variable tensor and the three-dimensional IP Address tensor and time step t Input to the latent diffusion model U-Net Processed in the module, n prediction noise;
[0025] According to the label noise of each sample port information in step 1.2 n The mean square error of the prediction noise is used to obtain the objective function of the potential diffusion model;
[0026] According to the objective function, the potential diffusion model is trained through back propagation to complete the optimization of the potential diffusion model.
[0027] Preferably, the U-Net The module includes a cross attention layer, an encoder layer, a data processing layer, a decoder layer and a convolution layer; the three-dimensional latent variable tensor, the three-dimensional obtained in step 1.4 IP The address tensor and time step t are input to the latent diffusion model U-Net Processed in the module, n The prediction noise includes the following steps:
[0028] The three-dimensional IP The address tensor and the three-dimensional latent variable tensor are U-Net The cross attention layer of the module obtains n The first data;
[0029] Each first data is passed into the U-Net The encoder layer of the module performs encoding processing to obtain the corresponding n Second data;
[0030] Each second data is passed into the U-Net The data processing layer of the module processes the data to obtain the corresponding n Third data;
[0031] Each third data is passed into the U-Net The decoding layer of the module performs decoding processing to obtain the corresponding n prediction noise.
[0032] Preferably, the data processing layer includes a pooling layer, a convolution layer, and a time embedding layer; each second data is transmitted to the U-Net The data processing layer of the module processes the data to obtain the corresponding n The third data comprises the following steps:
[0033] Each second data is passed to the pooling layer, and the pooling process is performed to obtain the corresponding n Target feature data;
[0034] The time step t Input to the time embedding layer, perform time embedding, and obtain the time embedding vector;
[0035] Each target feature data is XORed with the time embedding vector to obtain the corresponding n associated feature data;
[0036] Each associated feature data is passed into the convolution layer, and the convolution process is performed to obtain the corresponding n The third data.
[0037] Preferably, step 4 is specifically: using a decoder of a vector quantized variational autoencoder model δ Decode the latent variables of the port matrix of each network device generated in step 3 to obtain the port matrix of the corresponding network device: ;
[0038] in δ represents the decoder of the vector quantized variational autoencoder model, Z t The latent variable representing the port matrix of the network device generated in step 3, the decoder of the vector quantized variational autoencoder model δ The latent variables of the port matrix of each network device Z t All are converted from low-dimensional latent space back to high-dimensional latent space to obtain the port matrix of the corresponding network device , for each value in the port matrix of the network device ,if , then the port matrix of the network device The middle position is ( a, b ) The corresponding network device port is open. If , then the port matrix of the network device The middle position is ( a, b ) The corresponding network device port is not open, among which, a and b Represents the port matrix The row and column positions in .
[0039] Accordingly, the present application provides a port information generating device based on a potential diffusion model, comprising:
[0040] Acquisition module: used to obtain network devices IP Address and port information;
[0041] Training module: used to train the latent diffusion model and vector quantized variational autoencoder model;
[0042] Generate module: used to obtain IP The address,initial data generates the potential variables of the port matrix of the corresponding,network device;
[0043] Decoding module: used to input the latent variables of the port matrix of each network device into the vector quantization variational autoencoder model for decoding to obtain the port matrix of the corresponding network device.
[0044] Compared with the prior art, the present invention has the following beneficial effects:
[0045] 1. The port matrix generated by the potential diffusion model of the present invention can more accurately reflect the input conditions IP The characteristics of the address improve the accuracy and predictability of port configuration.
[0046] 2. The present invention uses deep learning technology to generate a port matrix, which can process a large amount of data in a short time and quickly respond to different network configuration requirements, thereby improving the efficiency of port generation and configuration.
[0047] 3. The port matrix generated by the present invention can better adapt to network security strategies and vulnerability scanning requirements, effectively reduce potential security risks, and improve the overall security and stability of the network system. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A schematic flow chart of a method for generating port information based on a potential diffusion model provided by an embodiment of the present invention.
[0049] Figure 2 A schematic diagram of a process for training a potential diffusion model provided by an embodiment of the present invention.
[0050] Figure 3 A schematic diagram of the structure of a port information generating device based on a potential diffusion model provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The present invention will be described in detail below in conjunction with the embodiments and drawings. It should be noted that the embodiments and features in the embodiments of the present invention can be combined with each other without conflict.
[0052] refer to Figure 1 , a method for generating port information based on a potential diffusion model, comprising the following steps:
[0053] Step 1: Train the latent diffusion model and the vector quantized variational autoencoder model by using the training samples of the acquired network devices, thereby completing the training of the latent diffusion model and the vector quantized variational autoencoder model;
[0054] refer to Figure 2 , step 1 is as follows:
[0055] 1.1 Constructing a latent diffusion model and a vector quantized variational autoencoder model, the latent diffusion model consists of an embedding module and U-NetModule composition: the vector quantized variational autoencoder model consists of an encoder, a decoder and a codebook. The codebook originates from the field of natural language processing. Each discrete code is associated with an embedding vector and all the embedding vectors are stored in a codebook. The role of the codebook is to simplify the representation, improve the storage efficiency, and maintain the key features of the data in subsequent processing steps.
[0056] 1.2 Obtain training samples, which include n sample port information of n network devices, sample port information of the n network devices IP address, label noise of each of the sample port information, where n is an integer greater than or equal to 1;
[0057] 1.3 Encode the port information of each network device in the training sample into a sample port matrix, then merge the encoded n sample port matrices into a three-dimensional port matrix tensor, train the vector quantized variational autoencoder model through the three-dimensional port matrix tensor, obtain the potential variable tensor of the three-dimensional port matrix, and complete the training of the vector quantized variational autoencoder model;
[0058] 1.4 Each sample of the training sample IP The address is digitized, encoded, and dimensioned in turn to obtain each sample. IP The 64*64 tensor of the address, and then the multiple samples obtained IP The 64*64 tensors of the addresses are merged into three dimensions IP Address tensor, 3D IP The dimension of the address tensor is consistent with the dimension of the latent variable tensor of the three-dimensional port matrix in step 1.3;
[0059] 1.5 Using the latent variable tensor of the three-dimensional port matrix obtained in step 1.3 and the three-dimensional IP Address tensor, train the potential diffusion model, thereby completing the training of the potential diffusion model;
[0060] Step 2: Get the network device for which port information needs to be generated IP Address, take the noise and time step sampled from the standard normal distribution as initial data;
[0061] Step 3: Set the IP address of each network device obtained in step 2 IP The addresses and initial data are input into the latent diffusion model for iteration to generate the corresponding latent variables of the port matrix of each network device;
[0062] Step 4: Decode the latent variables of the port matrix of each network device generated in step 3 using the decoder of the vector quantized variational autoencoder model to obtain the corresponding port matrix of each network device.
[0063] The latent diffusion model and the vector quantized variational autoencoder model in step 3 and step 4 are the trained latent diffusion model and the vector quantized variational autoencoder model respectively.
[0064] Preferably, the step 1.3 is specifically:
[0065] 1.3.1 The sample port information of each network device in the training sample is encoded into a sample port matrix through the following steps: Initialize the sample port matrix M , sample port matrix M The value of all positions in the sample port matrix is 0.0. M Each position ( i, j ) is set to 0.0, that is, M ( i, j )=0.0, calculate each open port in the sample port information p i In the sample port matrix M The position in , where the row position is , the column position is , and the sample port matrix M The value of the corresponding position is set to 1.0, that is, ,in, i and j Represents the sample port matrix M The row and column positions of
[0066] 1.3.2 Superimpose the multiple sample port matrices generated in step 1.3.1 along the first dimension to form n *256*256 three-dimensional port matrix tensor.
[0067] 1.3.3 Training the vector quantized variational autoencoder model: The encoder of the vector quantized variational autoencoder model converts each sample port matrix in the three-dimensional port matrix tensor M All were transformed into continuous latent variables Z e ( M ), and then through the quantization step, each continuous latent variable is mapped to the discrete codebook to obtain each latent variable Z e ( M ) Z q ( M ), the decoder of the vector quantized variational autoencoder model converts each quantized value Z q ( M ) is refactored into , according to each and the corresponding sample port matrix M The corresponding sample port matrix is obtained by calculating the mean square error M The reconstruction loss , according to each continuous latent variable Z e ( M ) and the corresponding quantized value of the latent variable Z q ( M ) Calculate the mean square error to get the corresponding sample port matrix M The quantization error ,according to Calculate the overall error ,in α It is used to control the ratio between the two errors. Repeat the above process until the overall error converges to complete the training of the vector quantized variational autoencoder model. When the overall error converges, the port matrix of each sample is obtained. M Reconstruction is the corresponding sample port matrix M Latent variables , n Sample port matrix M Latent variables A tensor of latent variables that are stacked along the first dimension to form a three-dimensional port matrix.
[0068] Preferably, the step 1.4 is specifically:
[0069] The samples of each network device in the training sample IP The addresses are divided into 4 decimal values, and each decimal value is converted into a binary value;
[0070] For each sample IP The address constructs a 64*64 tensor with the high 4 bits and low 4 bits of the corresponding binary value as the row index and column index of the encoding structure respectively. Each sample IP The high 4 bits and low 4 bits of the binary value corresponding to the address are set to 1.0 in the corresponding position of the 64*64 tensor, and then the dimension of each 64*64 tensor is adjusted and expanded. Finally, multiple samples are IP The 64*64 tensors of addresses are stacked along the first dimension to form n *64*64 three-dimensional IP address tensor, the dimension of the three-dimensional IP address tensor is consistent with the dimension of the latent variable tensor of the three-dimensional port matrix.
[0071] Preferably, the step 1.5 is specifically as follows:
[0072] For each sample port matrix of the three-dimensional port matrix latent variable tensor, the latent variable Noise is added, and the time step t Step 2, get the latent variables of the sample port matrix after adding noise , will get n The latent variables of the sample port matrix after adding noise Stack along the first dimension to form a three-dimensional latent variable tensor;
[0073] The three-dimensional latent variable tensor and the three-dimensional IP Address tensor and time step t Input to the latent diffusion model U-Net Processed in the module, n prediction noise;
[0074] According to the label noise of each sample port information in step 1.2 n The mean square error of the prediction noise is used to obtain the objective function of the potential diffusion model;
[0075] According to the objective function, the potential diffusion model is trained through back propagation to complete the optimization of the potential diffusion model.
[0076] Based on minimizing the objective function, the optimization process of the latent diffusion model is implemented through the back-propagation algorithm.
[0077] Preferably, the U-Net The module includes a cross attention layer, an encoder layer, a data processing layer, a decoder layer and a convolution layer; the three-dimensional latent variable tensor, the three-dimensional obtained in step 1.4 IP The address tensor and time step t are input to the latent diffusion model U-Net Processed in the module, n The prediction noise includes the following steps:
[0078] The three-dimensional IP The address tensor and the three-dimensional latent variable tensor are U-Net The cross attention layer of the module obtains n The first data;
[0079] Each first data is passed into the U-Net The encoder layer of the module performs encoding processing to obtain the corresponding n Second data;
[0080] Each second data is passed into the U-Net The data processing layer of the module processes the data to obtain the corresponding n Third data;
[0081] Each third data is passed into the U-NetThe decoding layer of the module performs decoding processing to obtain the corresponding n prediction noise.
[0082] Preferably, the data processing layer includes a pooling layer, a convolution layer, and a time embedding layer; each second data is transmitted to the U-Net The data processing layer of the module processes the data to obtain the corresponding n The third data comprises the following steps:
[0083] Each second data is passed to the pooling layer, and the pooling process is performed to obtain the corresponding n Target feature data;
[0084] The time step t Input to the time embedding layer, perform time embedding, and obtain the time embedding vector;
[0085] Each target feature data is XORed with the time embedding vector to obtain the corresponding n associated feature data;
[0086] Each associated feature data is passed into the convolution layer, and the convolution process is performed to obtain the corresponding n The third data.
[0087] Preferably, step 4 is specifically: using a decoder of a vector quantized variational autoencoder model δ Decode the latent variables of the port matrix of each network device generated in step 3 to obtain the port matrix of the corresponding network device: ;
[0088] in δ represents the decoder of the vector quantized variational autoencoder model, Z t The latent variable representing the port matrix of the network device generated in step 3, the decoder of the vector quantized variational autoencoder model δ The latent variables of the port matrix of each network device Z t All are converted from low-dimensional latent space back to high-dimensional latent space to obtain the port matrix of the corresponding network device , for each value in the port matrix of the network device ,if , then the port matrix of the network device The middle position is ( a, b ) The corresponding network device port is open. If , then the port matrix of the network device The middle position is ( a, b ) The corresponding network device port is not open, among which, a andb Represents the port matrix The row and column positions in .
[0089] like Figure 3 The present invention provides a port information generation device based on a potential diffusion model, comprising:
[0090] Acquisition module: used to obtain network devices IP Address and port information;
[0091] Training module: used to train the latent diffusion model and vector quantized variational autoencoder model;
[0092] Generate module: used to obtain IP The address,initial data generates the potential variables of the port matrix of the corresponding,network device;
[0093] Decoding module: used to input the latent variables of the port matrix of each network device into the vector quantization variational autoencoder model for decoding to obtain the port matrix of the corresponding network device.
[0094] In the training module, the potential diffusion model and the vector quantized variational autoencoder model are constructed. IP The address is processed to obtain a 64*64 tensor that meets the requirements and merged into a three-dimensional IP Address tensor, each sample port information is encoded as a 256×256 sample port matrix M and merge it into three dimensions IP The address tensor is trained through the three-dimensional port matrix to complete the training of the vector quantized variational autoencoder model, and a three-dimensional latent variable tensor is generated at the same time. The three-dimensional latent variable tensor is processed by adding noise to obtain a three-dimensional latent variable tensor. The three-dimensional latent variable tensor and the three-dimensional IP The address tensor is input into the latent diffusion model to complete the training of the latent diffusion model.
[0095] For the training of the potential diffusion model, the three-dimensional IP Each condition information in the address tensor IP The 64*64 tensor of the address is mapped into a key and value matrix through linear transformation, and the sample port matrix after noise is added M The latent variable feature map is mapped to the query matrix, and the correlation features between the two are calculated through the cross attention mechanism. The training module further optimizes the vector quantized variational autoencoder model based on the reconstruction loss and quantization loss, and uses the maximum mean difference ( Maximum Mean Discrepancy, MMD ) loss calculates the difference between label noise and target noise to obtain the objective function of the latent diffusion model. Based on the objective function, the latent diffusion model parameters are updated through back propagation so that the latent diffusion model can be based on IPThe address conditions generate accurate port matrix potential variables, ultimately achieving the goal of optimizing port generation effects.
[0096] Based on the foregoing embodiments, an embodiment of the present invention provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any of the above methods for generating port information based on a potential diffusion model.
[0097] The present invention also provides an electronic device, comprising: a memory and a processor; the memory is used to store a computer program; the processor is used to run the computer program stored in the memory to implement a port information generation method based on a potential diffusion model.
[0098] It should be noted that the above processor or CPU Can be used for application specific integrated circuits ( Application Specific Integrated Circuit, ASIC ), Digital Signal Processor ( Digital Signal Processor, DSP )、Digital Signal Processing Device( Digital Signal Processing Device, DSPD )、Programmable Logic Device( Programmable Logic Device, PLD ), Field Programmable Gate Array (FPGA) Field Programmable Gate Array, FPGA ),CPU( Central Processing Unit, CPU ), at least one of a controller, a microcontroller, and a microprocessor. It can be understood that the electronic device that implements the above-mentioned processor function can also be other, and the embodiment of the present application does not specifically limit it.
[0099] It should be noted that the above-mentioned computer readable storage medium / memory may be a read-only memory ( Read Only Memory, ROM ), Programmable Read-Only Memory ( Programmable Read-Only Memory, PROM ), Erasable Programmable Read-Only Memory (EPROM) Erasable Programmable Read-Only Memory, EPROM ), Electrically Erasable Programmable Read-Only Memory (EEPROM) Electrically Erasable Programmable Read-Only Memory, EEPROM ), magnetic random access memory ( Ferromagnetic Random Access Memory, FRAM )、Flash memory( Flash Memory ), magnetic surface storage, optical disk, or CD-ROM ( Compact Disc Read-Only Memory, CD-ROM ) and other memories; it can also be various terminals including one or any combination of the above memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0100] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0101] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0102] In addition, all functional units in the embodiments of the present application may be integrated into one processing module, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units. A person skilled in the art may understand that all or part of the steps of the above method embodiments may be completed by hardware related to program instructions, and the above program may be stored in a computer-readable storage medium, which, when executed, executes the steps of the above method embodiments; and the above storage medium includes: a mobile storage device, a read-only memory ( Read- Only Memory, ROM ), Random Access Memory ( Random Access Memory, RAM ), magnetic disks, optical disks, and other media that can store program codes.
[0103] The methods disclosed in the several method embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments.
[0104] The features disclosed in several product embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new product embodiments.
[0105] The features disclosed in several method or device embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0106] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0107] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0108] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions and substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the protection scope of the present invention.
Claims
1. A method for generating port information based on a potential diffusion model, characterized in that: The following steps are involved: Step 1: Train the latent diffusion model and the vector quantized variational autoencoder model by using the training samples of the acquired network devices, thereby completing the training of the latent diffusion model and the vector quantized variational autoencoder model; Step 1 is as follows: 1.1 Constructing a latent diffusion model and a vector quantized variational autoencoder model, the latent diffusion model consists of an embedding module and U-Net Module composition: the vector quantized variational autoencoder model consists of an encoder, a decoder and a codebook; 1.2 Obtain training samples, which include n sample port information of n network devices, sample port information of the n network devices IP address, label noise for each of the sample port information, where n is an integer greater than or equal to 1; 1.3 Encode the port information of each network device in the training sample into a sample port matrix, then merge the encoded n sample port matrices into a three-dimensional port matrix tensor, train the vector quantized variational autoencoder model through the three-dimensional port matrix tensor, obtain the potential variable tensor of the three-dimensional port matrix, and complete the training of the vector quantized variational autoencoder model; 1.4 Each sample of the training sample IP The address is digitized, encoded, and dimensioned in turn to obtain each sample. IP The 64*64 tensor of the address, and then the multiple samples obtained IP The 64*64 tensors of the addresses are merged into three dimensions IP Address tensor, 3D IP The dimension of the address tensor is consistent with the dimension of the latent variable tensor of the three-dimensional port matrix in step 1.3; 1.5 Using the latent variable tensor of the three-dimensional port matrix obtained in step 1.3 and the three-dimensional IP Address tensor, train the potential diffusion model, thereby completing the training of the potential diffusion model; Step 2: Get the network device for which port information needs to be generated IP Address, take the noise and time step sampled from the standard normal distribution as initial data; Step 3: Set the IP address of each network device obtained in step 2 IP The addresses and initial data are input into the latent diffusion model for iteration to generate the corresponding latent variables of the port matrix of each network device; Step 4: Decode the latent variables of the port matrix of each network device generated in step 3 using the decoder of the vector quantized variational autoencoder model to obtain the corresponding port matrix of each network device.
2. A method for generating port information based on a potential diffusion model as claimed in claim 1, characterized in that: The step 1.3 is specifically as follows: 1.3.1 The sample port information of each network device in the training sample is encoded into a sample port matrix through the following steps: Initialize the sample port matrix M , sample port matrix M The value of all positions in the sample port matrix is 0.
0. M Each position ( i,j ) is set to 0.0, that is M ( i,j )=0.0, calculate each open port in the sample port information p i In the sample port matrix M The position in , where the row position is , the column position is , and the sample port matrix M The value of the corresponding position is set to 1.0, that is, ,in, i and j Represents the sample port matrix M The row and column positions of 1.3.2 Superimpose the multiple sample port matrices generated in step 1.3.1 along the first dimension to form n *256*256 three-dimensional port matrix tensor; 1.3.3 Training the vector quantized variational autoencoder model: The encoder of the vector quantized variational autoencoder model converts each sample port matrix in the three-dimensional port matrix tensor M All were transformed into continuous latent variables Z e ( M ), and then through the quantization step, each continuous latent variable is mapped to the discrete codebook to obtain each latent variable Z e ( M ) Z q ( M ), the decoder of the vector quantized variational autoencoder model converts each quantized value Z q ( M ) is refactored into , according to each and the corresponding sample port matrix M The corresponding sample port matrix is obtained by calculating the mean square error M The reconstruction loss , according to each continuous latent variable Z e ( M ) and the corresponding quantized value of the latent variable Z q ( M ) Calculate the mean square error to get the corresponding sample port matrix M The quantization error ,according to Calculate the overall error ,in α It is used to control the ratio between the two errors. Repeat the above process until the overall error converges to complete the training of the vector quantized variational autoencoder model. When the overall error converges, the port matrix of each sample is obtained. M Reconstruction is the corresponding sample port matrix M Latent variables , n Sample port matrix M Latent variables A tensor of latent variables that are stacked along the first dimension to form a three-dimensional port matrix.
3. A method for generating port information based on a potential diffusion model as claimed in claim 2, characterized in that: The step 1.4 is specifically as follows: The samples of each network device in the training sample IP The addresses are divided into 4 decimal values, and each decimal value is converted into a binary value; For each sample IP The address constructs a 64*64 tensor with the high 4 bits and low 4 bits of the corresponding binary value as the row index and column index of the encoding structure respectively. Each sample IP The high 4 bits and low 4 bits of the binary value corresponding to the address are set to 1.0 in the corresponding position of the 64*64 tensor, and then the dimension of each 64*64 tensor is adjusted and expanded. Finally, multiple samples are IP The 64*64 tensors of addresses are stacked along the first dimension to form n *64*64 three-dimensional IP address tensor, the dimension of the three-dimensional IP address tensor is consistent with the dimension of the latent variable tensor of the three-dimensional port matrix.
4. The method for generating port information based on a potential diffusion model according to claim 3, characterized in that: The step 1.5 is specifically as follows: For each sample port matrix of the three-dimensional port matrix latent variable tensor, the latent variable Noise is added, and the time step t Step 2, get the latent variables of the sample port matrix after adding noise , will get n The latent variables of the sample port matrix after adding noise Stack along the first dimension to form a three-dimensional latent variable tensor; The three-dimensional latent variable tensor and the three-dimensional IP Address tensor and time step t Input to the latent diffusion model U-Net Processed in the module, n prediction noise; According to the label noise of each sample port information in step 1.2 n The mean square error of the prediction noise is used to obtain the objective function of the potential diffusion model; According to the objective function, the potential diffusion model is trained through back propagation to complete the optimization of the potential diffusion model.
5. A method for generating port information based on a potential diffusion model as claimed in claim 4, characterized in that: Said U-Net The module includes a cross attention layer, an encoder layer, a data processing layer, a decoder layer and a convolution layer; the three-dimensional latent variable tensor, the three-dimensional tensor obtained in step 1.4 IP The address tensor and time step t are input to the latent diffusion model U-Net Processed in the module, n The prediction noise includes the following steps: The three-dimensional IP The address tensor and the three-dimensional latent variable tensor are U-Net The cross attention layer of the module obtains n The first data; Each first data is passed into the U-Net The encoder layer of the module performs encoding processing to obtain the corresponding n Second data; Each second data is passed into the U-Net The data processing layer of the module processes the data to obtain the corresponding n Third data; Each third data is passed into the U-Net The decoding layer of the module performs decoding processing to obtain the corresponding n prediction noise.
6. A method for generating port information based on a potential diffusion model according to claim 5, characterized in that: The data processing layer includes a pooling layer, a convolution layer, and a time embedding layer; each second data is transmitted to the U-Net The data processing layer of the module processes the data to obtain the corresponding n The third data comprises the following steps: Each second data is passed to the pooling layer, and the pooling process is performed to obtain the corresponding n Target feature data; The time step t Input to the time embedding layer, perform time embedding, and obtain the time embedding vector; Each target feature data is XORed with the time embedding vector to obtain the corresponding n associated feature data; Each associated feature data is passed into the convolution layer, and the convolution process is performed to obtain the corresponding n The third data.
7. A method for generating port information based on a potential diffusion model as claimed in claim 6, characterized in that: The step 4 is specifically: using the decoder of the vector quantized variational autoencoder model δ Decode the latent variables of the port matrix of each network device generated in step 3 to obtain the port matrix of the corresponding network device: ; in δ represents the decoder of the vector quantized variational autoencoder model, Z t The latent variable representing the port matrix of the network device generated in step 3, the decoder of the vector quantized variational autoencoder model δ The latent variables of the port matrix of each network device Z t All are converted from low-dimensional latent space back to high-dimensional latent space to obtain the port matrix of the corresponding network device , for each value in the port matrix of the network device ,if , then the port matrix of the network device The middle position is ( a,b ) The corresponding network device port is open. If , then the port matrix of the network device The middle position is ( a,b ) The corresponding network device port is not open, among which, a and b Represent the row and column positions in the matrix respectively.
8. A port information generation device based on a potential diffusion model is used to execute the port information generation method based on a potential diffusion model according to any one of claims 1 to 7, characterized in that: include: Acquisition module: used to obtain network devices IP Address and port information; Training module: used to train the latent diffusion model and vector quantized variational autoencoder model; Generate module: used to obtain IP The address,initial data generates the potential variables of the port matrix of the corresponding,network device; Decoding module: used to input the latent variables of the port matrix of each network device into the vector quantization variational autoencoder model for decoding to obtain the port matrix of the corresponding network device.
Citation Information
Patent Citations
Data processing method, device and equipment and readable storage medium
CN117808906A
Diffusion model training and image processing method and device, equipment and storage medium
CN118470059A