A domain name management method and device
By using vectorization and clustering analysis, and leveraging masked language models and pre-trained models, the problem of inaccurate domain name priority identification was solved, enabling efficient domain name caching and fast response, thereby improving the stability of cyberspace and user trust.
Patent Information
- Application Number
- CN202410904265.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2044-07-05
AI Technical Summary
Existing technologies struggle to accurately identify domain name priorities, resulting in an inability to effectively protect critical domain names and impacting the stability of cyberspace and user trust.
By vectorizing and clustering domain names, using masked language models and pre-trained models, the priority of domain names is identified and classified. The caching strategy is optimized by using the centroid distance of clusters and caching rate, thereby improving the accuracy of domain name identification.
It enables accurate identification and hierarchical response of domain name priorities, improves domain name lookup efficiency and cache storage utilization, and ensures rapid response of key domain names and network stability.
Smart Images

Figure CN118869292B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of network security, and in particular to a domain name management method and device. BACKGROUND
[0002] Domain name protection refers to a series of measures and technologies for the security protection of domain names in the Internet. Domain names are a list of domain names defined by humans, and their security is crucial for maintaining the stability of cyberspace and user trust.
[0003] A relatively effective domain name protection method is to focus on the protection of key domain name caching from the DNS cache level. For example, by optimizing the key domain name caching mechanism, the domain name can achieve faster search efficiency, so that the server can quickly make a preemptive answer. In the existing scheme, on the one hand, there is a method of using a fixed list for key protection, and on the other hand, there is a domain name division method based on statistical characteristics. However, the above-mentioned methods can only capture fixed domain names for protection on the one hand, and cannot accurately identify domain names on the other hand.
[0004] Therefore, how to accurately identify the priority of the domain name is a problem that needs to be solved at present. SUMMARY
[0005] Embodiments of the present application provide a domain name management method and device for judging the semantic similarity between unknown domain names and key domain names by clustering analysis on the vectorized domain names, thereby improving the accuracy of identifying the priority of the domain name.
[0006] In a first aspect, the embodiments of the present application provide a domain name management method, which can be applied to a server (such as a DNS server). The method comprises:
[0007] Obtaining a domain name set, the domain name set comprising a first domain name having a first label and a second domain name not having the first label, the first label indicating domain name priority;
[0008] Vectorizing the first domain name and the second domain name to obtain a vector corresponding to each domain name in the domain name set;
[0009] Clustering the vector corresponding to each domain name in the domain name set to obtain at least two clusters, and determining a first cluster from the at least two clusters, the number of vectors corresponding to the first domain name in the first cluster being greater than the number of vectors corresponding to the second domain name, the at least two clusters comprising the first cluster and at least one second cluster;
[0010] According to the distance between the first cluster and each second cluster, a domain name corresponding to a second cluster satisfying a distance condition is determined; wherein, the response priority of the domain name corresponding to the second cluster satisfying the distance condition is greater than the response priority of the domain name corresponding to the second cluster not satisfying the distance condition.
[0011] In the technical solution, the first label can be understood as a target label, which indicates the priority of the domain name. In the domain name protection scenario, the first label is set according to the importance of the domain name, so the first label can also be called an important label. Therefore, the first domain name can be called an important domain name or a key domain name. The second domain name does not have the first label, so the priority of the second domain name is unknown, and therefore the second domain name can be called an unknown domain name. Then, the first domain name and the second domain name are vectorized to obtain a vector corresponding to each domain name, which can better represent the semantic features of the first domain name and the second domain name. The vector corresponding to each domain name is clustered to obtain at least two clusters, and a first cluster is determined therefrom. Finally, according to the distance between the first cluster and each second cluster, a domain name corresponding to a second cluster satisfying a distance condition is determined, the priority of the domain name is identified, and the accuracy of identifying the priority of the domain name is improved by clustering the vectors.
[0012] Optionally, the vectorization of the first domain name and the second domain name to obtain a vector corresponding to each domain name in the domain name set comprises:
[0013] The first domain name and the second domain name are input into a first model to obtain a vector corresponding to each domain name in the domain name set output by the first model; wherein, the first model is a mask language model, which is used to output a semantic feature vector of a domain name.
[0014] In the technical solution, the domain names in the first domain name and the second domain name are respectively input into the first model to obtain a vector corresponding to each domain name output by the first model, and then a first vector set is obtained. The first model is a mask language model, and the output vector can express the semantic features of the domain name, so that the clustering result of the vector is more accurate, and the accuracy of identifying the priority of the domain name is improved.
[0015] Optionally, the method further comprises:
[0016] Each domain name in the training sample is segmented according to a vocabulary;
[0017] For any domain name, the domain name is input into a pre-training model to obtain a vector of each segmented word of the domain name output by the pre-training model;
[0018] mask vectors of one or more wordpieces of the domain name, and train the pre-training model according to the vectors of the masked domain name to obtain the first model, wherein a loss function of the pre-training model represents a difference between an output of the masked wordpiece and a real vector corresponding to the masked wordpiece.
[0019] Optionally, the determining the first cluster from the at least two clusters comprises:
[0020] determining N clusters from the at least two clusters, wherein a number of vectors corresponding to the first domain name in each of the N clusters is greater than a number of vectors corresponding to the second domain name, and N is an integer greater than or equal to 1;
[0021] if N is greater than 1, merging the N clusters to obtain the first cluster.
[0022] In the above technical solution, the at least two clusters include first vectors with the first label and second vectors without the first label, so that the first cluster can be determined according to the number of vectors corresponding to the first domain name and the number of vectors corresponding to the second domain name in each cluster. The number of vectors corresponding to the first domain name in the first cluster is greater than the number of vectors corresponding to the second domain name. If there are multiple clusters in which the number of vectors corresponding to the first domain name is greater than the number of vectors corresponding to the second domain name, the multiple clusters are merged, and the cluster obtained after the merging is taken as the first cluster.
[0023] Optionally, the number of the at least two clusters is determined according to a preset cache rate, a number of levels of the cache, and a space multiple between adjacent levels of the cache.
[0024] The determining the domain name corresponding to the second cluster that satisfies the distance condition according to distances between the first cluster and each second cluster comprises:
[0025] determining a centroid of the first cluster and a centroid of each second cluster, respectively;
[0026] calculating distances between the centroid of the first cluster and the centroid of each second cluster, respectively, and taking the distances between the centroid of the first cluster and the centroid of each second cluster as distances between the first cluster and each second cluster;
[0027] determining priorities of the second clusters according to the distances between the first cluster and the second clusters in an order from small to large;
[0028] sorting the other clusters according to the priorities of the second clusters in an order from high to low;
[0029] determine a first number according to the number of the at least two clusters and the preset cache rate;
[0030] select the first number of second clusters as the second clusters satisfying the distance condition according to the sorting result of the at least one second cluster in order of priority from high to low.
[0031] In the technical solution, the distance between the centroid of the first cluster and the centroid of each second cluster is taken as the distance between the first cluster and each second cluster. The priority of other clusters is sorted according to the distance between the first cluster and each second cluster, and the priority of the domain name is identified. The priority sorting result of the other clusters represents the degree to which the domain name in the remaining clusters is likely to be a key domain name in the semantic level. The higher the priority of the cluster, the closer the domain name corresponding to the vector in the cluster is to the key domain name in the semantic level. The number of clusters obtained after clustering is determined according to the preset cache rate, the number of levels of cache, and the space multiple between adjacent levels of cache, so as to ensure that the storage space required by the domain name to be written into the cache does not exceed the cache space. The read and write speeds of different levels of cache are different, and the higher the level, the faster the read and write speed. According to the priority sorting of the at least one second cluster, the first number of second clusters is determined as the second clusters satisfying the distance condition according to the sorting result of the at least one second cluster in order of priority from high to low.
[0032] Optionally, after the domain name corresponding to the second cluster satisfying the distance condition is determined, the method further comprises:
[0033] The domain name corresponding to the second cluster satisfying the distance condition is sequentially stored in different levels of cache, the domain name corresponding to the first cluster is recorded in the highest level of cache, and the priority of the second cluster satisfying the distance condition is positively correlated with the level of the cache.
[0034] In the technical solution, the domain name corresponding to each vector in the first cluster is recorded in the highest level of cache. The domain name corresponding to the vector contained in each cluster in the second cluster satisfying the distance condition is sequentially written into different levels of cache according to the priority sorting of the second cluster, so as to ensure that the higher the priority of the domain name, the faster the response speed when responding to the domain name request.
[0035] Optionally, the number of the at least two clusters is determined according to the following formula (1):
[0036]
[0037] wherein K is the number of the at least two clusters, L is the number of levels of cache, R is the preset cache rate, and m is the space multiple between adjacent levels of cache.
[0038] In a second aspect, an embodiment of the present application provides a domain name management apparatus, comprising:
[0039] an acquisition module configured to acquire a domain name set, the domain name set comprising a first domain name having a first label and a second domain name not having the first label, the first label indicating a domain name priority;
[0040] a processing module configured to vectorize the first domain name and the second domain name to obtain a vector corresponding to each domain name in the domain name set;
[0041] cluster the vectors corresponding to each domain name in the domain name set to obtain at least two clusters, and determine a first cluster from the at least two clusters, the number of vectors corresponding to the first domain name in the first cluster being greater than the number of vectors corresponding to the second domain name, the at least two clusters comprising the first cluster and at least one second cluster;
[0042] determine, according to a distance between the first cluster and each second cluster, a domain name corresponding to a second cluster satisfying a distance condition; wherein a response priority of the domain name corresponding to the second cluster satisfying the distance condition is greater than a response priority of a domain name corresponding to a second cluster not satisfying the distance condition.
[0043] Optionally, the processing module is specifically configured to:
[0044] input the first domain name and the second domain name into a first model to obtain a vector corresponding to each domain name in the domain name set output by the first model; wherein the first model is a mask language model configured to output a semantic feature vector of a domain name.
[0045] Optionally, the processing module is further configured to:
[0046] perform word segmentation on each domain name in a training sample according to a vocabulary;
[0047] for any domain name, input the domain name into a pre-training model to obtain a vector of each segmented word of the domain name output by the pre-training model;
[0048] mask the vector of one or more segmented words of the domain name, and train the pre-training model according to the vector of the masked domain name to obtain the first model, a loss function of the pre-training model indicating a difference between an output of a masked segmented word and a real vector corresponding to the masked segmented word.
[0049] Optionally, the processing module is specifically configured to:
[0050] determine N clusters from the at least two clusters, a number of vectors corresponding to the first domain name in each of the N clusters is greater than a number of vectors corresponding to the second domain name, N is an integer greater than or equal to 1;
[0051] if N is greater than 1, merge the N clusters to obtain the first cluster.
[0052] Optionally, the number of the at least two clusters is determined according to a preset cache rate, a number of levels of the cache, and a space multiple between adjacent levels of the cache, and the processing module is specifically configured to:
[0053] respectively determine a centroid of the first cluster and a centroid of each of the at least one second cluster;
[0054] respectively calculate a distance between the centroid of the first cluster and the centroid of each of the at least one second cluster, and take the distance between the centroid of the first cluster and the centroid of each of the at least one second cluster as a distance between the first cluster and each of the at least one second cluster;
[0055] determine a priority of each of the at least one second cluster according to the distance between the first cluster and each of the at least one second cluster in an order from small to large;
[0056] sort the at least one second cluster according to the priority in an order from high to low;
[0057] determine a first number according to the number of the at least two clusters and the preset cache rate;
[0058] select the first number of the at least one second cluster as the second cluster satisfying the distance condition according to the sorting result of the at least one second cluster in the order from high to low.
[0059] Optionally, the processing module is further configured to:
[0060] store domain names corresponding to the second cluster satisfying the distance condition into caches of different levels in sequence, record a domain name corresponding to the first cluster in a cache of a highest level, and the priority of the second cluster satisfying the distance condition is positively correlated with the level of the cache.
[0061] In a third aspect, an embodiment of the present application further provides a computer device, comprising:
[0062] a memory configured to store program instructions;
[0063] a processor configured to invoke the program instructions stored in the memory, and execute the domain name management method according to the obtained program.
[0064] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores computer executable instructions for causing a computer to execute the domain name management method.
[0065] In a fifth aspect, the embodiments of the present application further provide a computer program product, which comprises an executable program for executing the domain name management method by a processor. BRIEF DESCRIPTION OF DRAWINGS
[0066] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art based on these drawings without creative effort are within the protection scope of the present application.
[0067] Figure 1 A system architecture schematic diagram is provided for the embodiments of the present application.
[0068] Figure 2 A flowchart of a domain name management method is provided for the embodiments of the present application.
[0069] Figure 3 A clustering distance schematic diagram is provided for the embodiments of the present application.
[0070] Figure 4 A clustering result schematic diagram is provided for the embodiments of the present application.
[0071] Figure 5 A structure schematic diagram of a domain name management device is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0072] In order to make the objects, technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present application.
[0073] The application scenarios described in the embodiments of the present application are used to more clearly illustrate the technical solutions protected by the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems. The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, and are not used to describe a specific order. In the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0074] Before introducing the domain name management method provided by the embodiments of the present application, in order to facilitate understanding, first introduce the following terms related to the embodiments of the present application.
[0075] DNS server: also known as domain name server (Domain Name System, DNS) is a distributed database that manages the mapping between domain names and IP addresses. DNS server is a host that provides domain name resolution service for users.
[0076] Pre-trained model: an artificial intelligence model in the field of natural language processing (NLP) that performs tasks by analyzing, understanding and generating human language. These models are usually based on deep learning neural networks that learn language patterns and contextual relationships in large-scale text corpora, so as to capture semantic information in text and convert text into vector representation. The results can reflect the semantic clarity and information content of the text to some extent.
[0077] Model pre-training: the first stage in the development process of pre-trained models. In this stage, the model is trained using large-scale and diverse corpora, with the goal of learning the basic structure and patterns of language. The pre-trained model can understand and generate basic language, but has not been optimized for specific tasks or applications.
[0078] Local fine-tuning: the process of applying a pre-trained model to a specific task. In this stage, the model is trained on smaller and more specialized datasets that are usually related to specific tasks or application scenarios. Through local fine-tuning, the model can adapt to specific language use, and can show higher accuracy and efficiency for specific tasks while maintaining the original broad language knowledge.
[0079] Self-supervised learning: A term in the field of machine learning and deep learning, especially when dealing with unlabeled data. In self-supervised learning, algorithms generate labels or supervisory signals from the raw data, and then use these signals to train the model. This approach allows the model to learn from a large amount of unlabeled data, thereby avoiding the dependence on a large amount of manually labeled data in traditional supervised learning. In language models, self-supervised learning can be used to predict the next word in a sentence or to mask (remove) words, providing an effective way to process and understand a large amount of unlabeled language data.
[0080] Figure 1 An exemplary system architecture to which embodiments of the application can be applied is shown, which includes a server 100, which can include a processor 110, a communication interface 120 and a memory 130.
[0081] The communication interface 120 is configured to transmit data.
[0082] The processor 110 is the control center of the server 100, which connects various parts of the server 100 through various interfaces and routes, and performs various functions and processes data of the server 100 by running or executing software programs / modules stored in the memory 130 and calling data stored in the memory 130. Optionally, the processor 110 can include one or more processing units.
[0083] The memory 130 can be used to store software programs and modules, and the processor 110 can execute various functions and data processing by running the software programs and modules stored in the memory 130. The memory 130 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to business processing, etc. In addition, the memory 130 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.
[0084] It should be noted that the structure shown above is only an example, and the server can be a DNS server, and the embodiments of the application are not limited thereto. Figure 1 The structure shown above is only an example, and the server can be a DNS server, and the embodiments of the application are not limited thereto.
[0085] Based on the above description, Figure 2 An exemplary flowchart of a domain name management method provided by an embodiment of the application is shown, which can be executed by a domain name management device.
[0086] As Figure 2 shown, the flow specifically includes:
[0087] In step 210, a domain name set is obtained, the domain name set including a first domain name with a first label and a second domain name without the first label, the first label indicating a domain name priority.
[0088] In an embodiment of the present application, the first label can be understood as a target label, indicating the priority of the domain name. For example, in a domain name protection scenario, the first label is set according to the importance of the domain name, such as the first label being 1, so the first label can also be called an important label, and therefore the first domain name can be called an important domain name or a key domain name. The second domain name does not have the first label, so the priority of the second domain name is unknown, and therefore the second domain name can be called an unknown domain name. In some embodiments, the second domain name has a second label, and the second label indicates that the priority of the domain name is unknown, such as the second label being 0.
[0089] The first domain name in the domain name set can be extracted from a specified domain name request or a preset key domain name. For example, the domain name is extracted from the domain name request collected when accessing a specified protection application or website, and is de-duplicated as a key domain name; or is a key domain name artificially divided. The second domain name can be extracted from a domain name request received when operating other servers. For example, the domain name is extracted from the domain name request of the e-commerce domain backbone export, and the extracted domain name is de-duplicated and the key domain name is removed to obtain the second domain name.
[0090] In step 220, the first domain name and the second domain name are vectorized to obtain a vector corresponding to each domain name in the domain name set.
[0091] In an embodiment of the present application, the first domain name and the second domain name are vectorized to obtain a vector corresponding to each domain name in the domain name set. Because the first domain name has the first label, and the first label is not vectorized when the first domain name is vectorized, the vector obtained after the first domain name is vectorized can also have the first label. Similarly, the vector obtained after the second domain name is vectorized does not have the first label. It can be understood that the first domain name and the second domain name are vectorized, i.e., the semantic features of the first domain name and the second domain name are represented. Specifically, the first domain name and the second domain name are input into a first model to obtain a vector corresponding to each domain name in the domain name set output by the first model. The first model is a masked language model, which is obtained by locally fine-tuning a pre-trained model and is used to output semantic feature vectors of domain names.
[0092] The method for constructing the first model specifically includes: performing word segmentation on each domain name in the training sample according to a vocabulary. For example, the domain name in the training sample can be extracted from a domain name request received during operation of another server. The vocabulary can be preset. The word segmentation operation can be performed by a word segmenter (such as WordPiece, BPE, or SentencePiece) built in a pre-training model, to divide the domain name into the smallest unit present in the vocabulary of the model.
[0093] For any domain name, the domain name is input into the pre-training model to obtain a vector of each wordpiece of the domain name output by the pre-training model. For example, for a domain name d, the pre-training model is used to obtain a vector of each wordpiece of the domain name d, that is, which can be represented as a series of numerical vectors understandable by the model, that is, denoted as a vector value input_ids.t. n wherein token is the token corresponding to each wordpiece, n is the number of wordpieces, and n is an integer greater than or equal to 1. It can be understood that the pre-training model mentioned in the present application includes but is not limited to BERT, including pre-training models such as GPT and RoBERTa, and is not specifically limited herein.
[0094] The vector of one or more wordpieces of the domain name is masked. The masked vector is the labeled data for self-supervised learning of the model. For example, for each domain name, a subset of is randomly selected as the masked position, and for i∈T, t i is replaced with a special mask token MASK. The masked vector is used as the labeled data. The specific masking step includes: generating a probability matrix rand for random sampling of mask, which has the same shape as input_ids and is uniformly distributed in the interval [0, 1). Then a binary vector (Boolean vector) is calculated, wherein the element value of the position is True only when the random probability of the element of input_ids at the corresponding position is less than the preset masking probability p, and the element of input_ids is not equal to 101 (CLS token), 102 (SEP token), or other special values. Otherwise, it is set to False. That is: mask = (rand < p) ∧ (input_ids ≠ CLS) ∧ (input_ids ≠ SEP) ∧ (input_ids ≠ PAD). Finally, the mask array mask is used to select which tokens will be masked, and the input_ids at these positions are replaced with 103 (MASK token).
[0095] Then the pre-training model is trained according to the vector of the masked domain name to obtain a first model. The loss function of the pre-training model represents the difference between the output of the mask tokenization and the real vector corresponding to the mask tokenization. For example, the number of batches and epochs are first set to determine the size of the training data and the number of iteration training. For the specific steps on the i-th iteration training number of epochs, the following steps are performed: first, forward propagation is performed on the model to calculate the loss function of the model. The loss function uses an improved cross entropy (Cross Entropy Loss) loss function to compare the difference between the output of the predicted mask position of the model and the real vector (i.e. the original unmasked token) corresponding to the mask position. It can be understood that the "loss function" in the present patent includes but is not limited to a ternary loss function and other calculation methods that can be used as a model parameter convergence condition.
[0096] Specifically, the loss function predicted by the model is determined by the difference between the predicted value and the real value, which can be represented as:
[0097]
[0098] wherein, is the loss function. P(t i )t1,…,t i-1 ,MASK,t i+1 ,…,t n ;θ) represents the probability that the predicted value of the token is correct t i under the given model parameter θ. In the mask task, only the loss of the masked position is calculated and backpropagated. Therefore, if a token position is not masked, its contribution to the loss function needs to be ignored. In implementation, this can be achieved by setting the labels of these positions to -100, because most deep learning frameworks will automatically ignore the positions with labels of -100.
[0099] Then, the loss function is backpropagated to calculate the gradient . Using the gradient descent algorithm, the loss function is minimized. In the implementation process, the optimizer is used to update the parameters. The parameter update can be represented as:
[0100]
[0101] wherein, η represents the learning rate, is the gradient of the total loss function with respect to the parameter θ, θ new is the new model parameter, and θ old is the old model parameter.
[0102] When the pre-training model is iterated to the preset number of iteration training times, the iteration is stopped, and the model at this time is taken as the first model. The above model training process can be performed on a device or platform with strong computing resources to accelerate the speed of model training. The principle of the above model training is that if the model can predict the original token at the mask position, it means that the model can better complete the vectorization of the target domain name according to the semantic features and context relationship of the domain name.
[0103] In step 230, the vectors corresponding to each domain name in the domain name set are clustered to obtain at least two clusters, and a first cluster is determined from the at least two clusters. The number of vectors corresponding to the first domain name in the first cluster is greater than the number of vectors corresponding to the second domain name. The at least two clusters include the first cluster and at least one second cluster.
[0104] In the embodiments of the present application, the number of at least two clusters is determined according to a preset cache rate, a number of levels of cache, and a space multiple between adjacent levels of cache. Different levels of cache have different read and write speeds, and the higher the level, the faster the read and write speed. For example, the domain name cache space has L levels. The first level cache has the highest level. The value of the cache space and the read and write speed monotonically decrease from the first level to the Lth level. L is the number of levels of cache, which is an integer greater than 1. The space multiple between adjacent levels of cache refers to the space of the M+1th level cache is m times the space of the Mth level cache. m is an integer greater than 1. M is an integer greater than or equal to 1 and less than L.
[0105] The number of at least two clusters is determined according to the following formula (1):
[0106]
[0107] Wherein, K is the number of at least two clusters, L is the number of levels of cache, R is the preset cache rate, and m is the space multiple between adjacent levels of cache. For example, the preset cache rate R has a value range of [0, 1], which is determined by the available space size of the cache and the actual size of the first domain name set. The preset cache rate represents the proportion of adding the second domain name to the cache, or represents the proportion of discarding the domain name in the second domain name.
[0108] After determining the number of clusters, the vectors corresponding to each domain name in the domain name set are clustered based on the number of clusters to obtain at least two clusters. For example, a specified cluster number unsupervised learning algorithm (such as k-means) is used to cluster the vectors corresponding to each domain name in the domain name set.
[0109] After obtaining the at least two clusters, a first cluster is determined from the at least two clusters. The at least two clusters include the first cluster and at least one second cluster. The first cluster has a number of vectors corresponding to the first domain name greater than a number of vectors corresponding to the second domain name. Specifically, N clusters are determined from the at least two clusters. Each of the N clusters has a number of vectors corresponding to the first domain name greater than a number of vectors corresponding to the second domain name. N is an integer greater than or equal to 1. If N is greater than 1, the N clusters are merged to obtain the first cluster. If N is equal to 1, the cluster is taken as the first cluster. Exemplarily, the vectors corresponding to the first domain name are labeled as 1, and the vectors corresponding to the second domain name are labeled as 0. For each cluster S i , the main label (i.e., the label appearing most frequently in the cluster, or the label corresponding to the vector appearing most frequently in the cluster) in the cluster is y i . The cluster with y i = 1 is recorded as the first cluster, marked as S0, and if the clusters with y i = 1 are not unique, the clusters are merged as the first cluster. The second cluster is a cluster other than the first cluster in the at least two clusters, i.e., each cluster other than the first cluster in the at least two clusters can be referred to as the second cluster.
[0110] In step 240, a domain name corresponding to a second cluster satisfying a distance condition is determined according to distances between the first cluster and each second cluster. The response priority of the domain name corresponding to the second cluster satisfying the distance condition is greater than the response priority of a domain name corresponding to a second cluster not satisfying the distance condition.
[0111] In the embodiment of the application, the distances between the first cluster and each second cluster are determined first. Specifically, the centroids of the first cluster and the at least one second cluster are determined respectively. Then, the distances between the centroid of the first cluster and the centroid of each second cluster are calculated respectively, and the distances between the centroid of the first cluster and the centroid of each second cluster are taken as the distances between the first cluster and each second cluster. Then, the priorities of the second clusters are determined according to the distances between the first cluster and each second cluster in descending order of the distances. The at least one second cluster is sorted according to the priorities of the second clusters in descending order of the priorities.
[0112] Exemplarily, as shown in FIG. 2, Figure 3 , Figure 3 a cluster distance diagram provided by the embodiment of the application is shown. The geometric centroids C iThe first cluster S0 corresponds to a centroid C0. The distance between the centroid corresponding to each second cluster and the centroid C0 corresponding to the first cluster S0 is determined respectively (the distance between the centroids includes but is not limited to the Euclidean distance), and then the distances are sorted in ascending order as d = [d1, d2, …, d K ]. Each second cluster and the centroid are labeled according to the distance order. The second cluster corresponding to the distance d1 is labeled as S1, and the centroid is labeled as C1; the second cluster corresponding to the distance d2 is labeled as S2, and the centroid is labeled as C2; …; the second cluster corresponding to the distance d K is labeled as S K , and the centroid is labeled as C K . It can be understood that the second clusters are labeled according to the distance order, that is, the priority of the second clusters is determined, so the sorting result of at least one second cluster is {S1, S2, …, S K}.
[0113] According to the distance between the first cluster and each second cluster, it can be understood that the remaining domain names in the first cluster (that is, the domain names in each second cluster) are more likely to be the focus domain names in the semantic level compared to the focus domain names listed in the first cluster.
[0114] Since the cache is divided into different levels, the domain names corresponding to the second clusters that meet the distance condition are determined according to the distance between the first cluster and each second cluster. That is, according to the priority sorting result, the second clusters that meet the distance condition are determined from the second clusters, and then the domain names corresponding to the vector in the second clusters that meet the distance condition are determined. It can be understood that the response priority of the domain names corresponding to the second clusters that meet the distance condition is higher than the response priority of the domain names corresponding to the second clusters that do not meet the distance condition, and is lower than the priority of the domain names corresponding to the first cluster. The distance condition is that a preset number of second clusters are selected from at least one second cluster in order from small to large (or in order from high to low priority), that is, the second clusters that meet the distance condition. In the present application, the preset number is the first number, and the preset number can also be a value preset according to experience, which is not limited specifically herein. The first number is determined according to the preset cache rate of the number of at least two clusters. It can be understood that the distance condition can also be that when the distance is less than a threshold value, the second cluster is considered to meet the distance condition.
[0115] Specifically, the first number is determined according to the number of the at least two clusters and the preset cache rate. The first number is the number of the second clusters that need to be written into the cache. According to the order of the at least one second cluster, the first number of the second clusters that meet the distance condition are selected as the second clusters that meet the distance condition, in a descending order of priority. In some embodiments, the second clusters that meet the distance condition (i.e., the first number of the second clusters) are sequentially stored in different levels of the cache. The domain name corresponding to the first cluster is stored in the highest level of the cache. The priority of the second cluster that meets the distance condition is positively correlated with the level of the cache, that is, the higher the priority of the cluster, the higher the level of the cache. For example, the number of the clusters that need to be written into the cache is Therefore, the number of the second clusters that need to be written into the cache (i.e., the first number) is The clusters that need to be written into the cache include the first cluster and the second clusters. According to the order of the at least one second cluster {S1, S2, …, S K}, the domain name corresponding to the last cluster is determined as a non-key domain name, and is discarded without being written into the cache. From the first second cluster S1 to the last second cluster , the domain names are sequentially written into the L-level cache in order. The domain name corresponding to the first cluster S0 is written into the highest level of the cache, i.e., the first level of the cache, as a key domain name.
[0116] According to the above method, as Figure 4 described, Figure 4 a clustering result diagram is provided for an embodiment of the present application. For example, for a cache with m=2 and L=2, the preset cache rate R=0.5 is set, and K=4 can be calculated. Therefore, as shown in the figure, four clusters are obtained after clustering. The first cluster is determined, and the priority of the clusters is sorted according to the distance between the first cluster and each second cluster, to obtain the first cluster Cluster0: the listed key domain name; the second cluster Cluster1: the subdomain name of the key domain name with a clear service semantics; the second cluster Cluster2: the general API service or the subdomain of the key domain name with an unclear semantics; and the second cluster Cluster3: some CDN subdomain names of services, which are not high in key degree and can be discarded. Moreover, according to , only the first two clusters are retained, and the last two clusters are discarded. Obviously, in order to protect the services carried by the key domain name, Cluster0 and Cluster1 need to be written into the first and second levels of the cache; and Cluster2 and Cluster3 have less significance, and are non-key domain names and can be discarded.
[0117] In the embodiment of the application, based on a self-supervised learning task, an improved cross-entropy loss function is used in the model training process through a mask language model, the difference between the output result of the mask position predicted by the model and the true label is considered, the prediction accuracy of the model is improved, and the model can perform vectorization processing according to the semantic features of the domain name. Then, the first model obtained by locally fine-tuning the pre-trained model is used to perform vectorization representation on the unlabeled domain name. And through clustering analysis of the semantic similarity with the key domain name, and according to the distribution characteristics of the cache space and the clustering results, the priority of the to-be-tested domain name is graded, and the accuracy of identifying the priority of the domain name is improved.
[0118] Based on the same technical concept, Figure 5 An exemplary structural schematic diagram of a domain name management apparatus provided by the embodiment of the application is shown, which can execute the flow of the domain name management method.
[0119] As Figure 5 shown, the apparatus specifically includes:
[0120] The acquisition module 510 is configured to acquire a domain name set, the domain name set including a first domain name with a first label and a second domain name without the first label, the first label indicating a domain name priority;
[0121] The processing module 520 is configured to vectorize the first domain name and the second domain name to obtain a vector corresponding to each domain name in the domain name set;
[0122] The vectors corresponding to each domain name in the domain name set are clustered to obtain at least two clusters, and a first cluster is determined from the at least two clusters, the number of vectors corresponding to the first domain name in the first cluster being greater than the number of vectors corresponding to the second domain name, the at least two clusters including the first cluster and at least one second cluster;
[0123] According to the distance between the first cluster and each second cluster, a domain name corresponding to a second cluster satisfying a distance condition is determined; wherein the response priority of the domain name corresponding to the second cluster satisfying the distance condition is greater than the response priority of the domain name corresponding to the second cluster not satisfying the distance condition.
[0124] Optionally, the processing module 520 is specifically configured to:
[0125] The first domain name and the second domain name are input into a first model to obtain a vector corresponding to each domain name in the domain name set output by the first model; wherein the first model is a mask language model, and is used to output a semantic feature vector of a domain name.
[0126] Optionally, the processing module 520 is further configured to:
[0127] segmenting each domain name in the training sample according to a vocabulary;
[0128] For any domain name, input the domain name into a pre-training model to obtain a vector of each segmented word of the domain name output by the pre-training model;
[0129] mask the vector of one or more segmented words of the domain name, and train the pre-training model according to the vector of the masked domain name to obtain the first model, wherein a loss function of the pre-training model represents a difference between the output of the masked segmented word and a real vector corresponding to the masked segmented word.
[0130] Optionally, the processing module 520 is specifically configured to:
[0131] determine N clusters from the at least two clusters, wherein the number of vectors corresponding to the first domain name in each cluster of the N clusters is greater than the number of vectors corresponding to the second domain name, and N is an integer greater than or equal to 1;
[0132] if N is greater than 1, merge the N clusters to obtain the first cluster.
[0133] Optionally, the number of the at least two clusters is determined according to a preset cache rate, a number of levels of the cache, and a space multiple between adjacent levels of the cache, and the processing module 520 is specifically configured to:
[0134] determine the centroid of the first cluster and the centroid of each second cluster, respectively;
[0135] calculate the distance between the centroid of the first cluster and the centroid of each second cluster, respectively, and take the distance between the centroid of the first cluster and the centroid of each second cluster as the distance between the first cluster and each second cluster;
[0136] determine the priority of the second cluster according to the distance between the first cluster and the second cluster in order of distance from small to large;
[0137] sort the other clusters according to the priority of the second cluster in order of priority from high to low;
[0138] determine a first number according to the number of the at least two clusters and the preset cache rate;
[0139] select the first number of second clusters as the second clusters satisfying the distance condition according to the sorting result of the at least one second cluster in order of priority from high to low.
[0140] Optionally, the processing module 520 is further configured to:
[0141] The domain name corresponding to the second cluster meeting the distance condition is sequentially stored in different levels of cache, the domain name corresponding to the first cluster is recorded in the highest level of cache, and the priority of the second cluster meeting the distance condition is positively correlated with the level of the cache.
[0142] Based on the same technical concept, the embodiment of the present application also provides a computer device, comprising:
[0143] a memory for storing program instructions;
[0144] a processor for calling the program instructions stored in the memory and executing the above domain name management method according to the obtained program.
[0145] Based on the same technical concept, the embodiment of the present application also provides a computer readable storage medium, the computer readable storage medium stores computer executable instructions, and the computer executable instructions are used for enabling a computer to execute the above domain name management method.
[0146] Based on the same technical concept, the embodiment of the present application also provides a computer program product, characterized in that the computer program product comprises an executable program, and the executable program is used for executing the above domain name management method by a processor.
[0147] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt a computer program product in the form of one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0148] The present application is described with reference to flowcharts and / or block diagrams according to the method, device (system), and computer program product of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one flow or multiple flows and / or blocks Figure 1 The functions specified in one flow or multiple flows and / or blocks
[0149] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flow Figure 1 The flow or flows and / or blocks Figure 1 The flow or flows and / or blocks
[0150] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions that execute on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 The flow or flows and / or blocks Figure 1 The flow or flows and / or blocks
[0151] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.
Claims
1. A domain name management method characterized by comprising: The method comprises: obtaining a domain name set, the domain name set comprising a first domain name with a first label and a second domain name without the first label, the first label indicating domain name priority; vectorizing the first domain name and the second domain name to obtain a vector corresponding to each domain name in the domain name set; clustering the vectors corresponding to each domain name in the domain name set to obtain at least two clusters, and determining a first cluster from the at least two clusters, the number of vectors corresponding to the first domain name in the first cluster being greater than the number of vectors corresponding to the second domain name, the at least two clusters comprising the first cluster and at least one second cluster; determining domain names corresponding to second clusters that meet a distance condition according to the distance between the first cluster and each second cluster, wherein the response priority of the domain names corresponding to the second clusters that meet the distance condition is greater than the response priority of the domain names corresponding to the second clusters that do not meet the distance condition.
2. The method of claim 1, wherein, The vectorization of the first domain name and the second domain name to obtain a vector corresponding to each domain name in the domain name set comprises: inputting the first domain name and the second domain name into a first model to obtain a vector corresponding to each domain name in the domain name set output by the first model; wherein the first model is a masked language model used to output semantic feature vectors of domain names.
3. The method of claim 1, wherein, The method further comprises: segmenting each domain name in the training sample according to a vocabulary; for any domain name, inputting the domain name into a pre-trained model to obtain a vector of each segmented word of the domain name output by the pre-trained model; masking the vector of one or more segmented words of the domain name, and training the pre-trained model according to the vector of the masked domain name to obtain a first model, the loss function of the pre-trained model representing the difference between the output of the masked segmented word and the real vector corresponding to the masked segmented word.
4. The method of claim 1, wherein, The determination of the first cluster from the at least two clusters comprises: determining N clusters from the at least two clusters, the number of vectors corresponding to the first domain name in each cluster of the N clusters being greater than the number of vectors corresponding to the second domain name, N being an integer greater than or equal to 1; if N is greater than 1, merging the N clusters to obtain the first cluster.
5. The method of claim 1, wherein, The number of the at least two clusters is determined according to a preset cache rate, a number of levels of cache, and a space multiple between adjacent levels of cache; The determination of domain names corresponding to second clusters that meet a distance condition according to the distance between the first cluster and each second cluster comprises: determining the centroid of the first cluster and the centroid of each second cluster, respectively; calculating the distance between the centroid of the first cluster and the centroid of each second cluster, and taking the distance between the centroid of the first cluster and the centroid of each second cluster as the distance between the first cluster and each second cluster; determining the priority of the second cluster according to the distance between the first cluster and the second cluster in order from small to large; sorting other clusters according to the priority of the second cluster in order from high to low. determine a first number according to the number of the at least two clusters and the preset cache rate; select the first number of second clusters as the second clusters satisfying the distance condition according to the sorting result of the at least one second cluster in the order from high to low priority.
6. The method of claim 5, wherein, After the domain name corresponding to the second cluster satisfying the distance condition is determined, the method further comprises: store the domain name corresponding to the second cluster satisfying the distance condition into different levels of cache in sequence, the domain name corresponding to the first cluster is recorded in the highest level of cache, and the priority of the second cluster satisfying the distance condition is positively correlated with the level of the cache.
7. A domain name management apparatus characterized by comprising: comprise: an acquisition module, configured to acquire a domain name set, the domain name set comprising a first domain name with a first label and a second domain name without the first label, the first label indicating domain name priority; a processing module, configured to vectorize the first domain name and the second domain name to obtain a vector corresponding to each domain name in the domain name set; cluster the vector corresponding to each domain name in the domain name set to obtain at least two clusters, and determine a first cluster from the at least two clusters, the number of vectors corresponding to the first domain name in the first cluster being greater than the number of vectors corresponding to the second domain name, the at least two clusters comprising the first cluster and at least one second cluster; determine a domain name corresponding to a second cluster satisfying a distance condition according to the distance between the first cluster and each second cluster; wherein the response priority of the domain name corresponding to the second cluster satisfying the distance condition is greater than the response priority of the domain name corresponding to the second cluster not satisfying the distance condition.
8. A computer device, comprising: comprise: a memory, configured to store program instructions; a processor, configured to invoke the program instructions stored in the memory to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer executable instructions for causing a computer to execute the method according to any one of claims 1 to 6.
10. A computer program product, characterised in that, The computer program product comprises an executable program which is executed by a processor to implement the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Threat information generation method, device and system
CN107566376A
Cross-site script vulnerability detection method and system
CN114579979A