The present invention relates to detection of complex strings in a data stream.
Fast search techniques are needed in many computing and network applications such as search engines and network addressing. Regular search of a string in a dictionary of strings of fixed sizes is rather simple, using for example binary search. With a dictionary of variable-size strings, the matching process becomes more intricate. A string of arbitrary size in which each character is uniquely defined in an alphabet is colloquially called an “exact string”. A string of arbitrary size in which at least one character may be replaced without changing the purpose of the string is colloquially called an “inexact string”. The search for an inexact string is complicated. For example searching for a name such as “John Winston Armstrong” in a dictionary of names is much simpler than searching for any name in the dictionary that contains a string such as “J . . . ton.Arm”, where ‘.’ may represent any of a subset of characters in the alphabet. In the latter, each of a large number of strings such as “Jane Clinton-Armbruster” and “Jack Newton Armstrong” is considered a successful match.
Numerous software-based techniques, suitable for implementation in a general-purpose computer, for fast matching of exact strings in which each character is uniquely defined and corresponds to a pre-defined alphabet are known. The Aho-Corasick algorithm, for example, is known to be computationally efficient and may be used in real-time applications, see, e.g., a paper by Alfred V. Aho and Margaret J. Corasick “Efficient String Matching: An Aid to Bibliographic Search” published in the Communications of the ACM, June 1975, Volume 18, Number 06, p. 333-340. Software-based techniques for matching “inexact strings” are also known, but are too slow for certain real-time applications such as network security applications which require fast execution, see, e.g., a paper by Ricardo A. Baeza-Yates and Gaston H. Connet “A New Approach to Text Searching” published in Communications of the ACM, 35, October 1992, p. 74-82.
Regular Expressions, as described, for example, in the paper written by Ken Thompson “Regular Expression Search Algorithm” published in Communications of the ACM, Vol. 11, Number 6, June 1968, p. 419-422 are commonly used for representing inexact strings. Regular expressions can be implemented efficiently using special-purpose hardware. However methods for efficient implementation of regular expressions in a general-purpose computer are yet to be developed. Software implementations of regular expressions either require a memory of extremely large size or execute in a non-bounded time which is a function of the number of such inexact strings to be considered, the complexity of the individual inexact strings, and input data to be examined.
One solution adopted in prior art is to use a two-stage algorithm where an algorithm for simple search, such as the Aho-Corasick algorithm, is used to efficiently find parts of packet data, which contain some part of the patterns of interest, and then a slower regular-expression-based algorithm is applied to a potentially lesser number of patterns to detect inexact patterns. Such a solution can handle a large variety of inexact patterns but has significant drawbacks including: (a) unpredictable computation effort to determine the existence, or otherwise, of a matching inexact string, the processing time being a function both of the data content and of the size and complexity of the patterns; (b) incomplete pattern identification where only a part of a pattern may be found without readily defining the boundaries of the pattern in an examined data stream—verifying a match with regular expressions may require access to a large amount of preceding data up to the possible start point, and may require waiting for data that has not yet been received; c) a requirement for post-processing to detect patterns in order of occurrence as neither the start nor end points may be known in advance, forcing ensemble matching and sorting.
Network intrusion detection and prevention is concerned with protecting computer systems from unintended or undesired network communications. A fundamental problem is in determining if packets in a data stream contain data strings of specific patterns (also called signatures) which are known to exploit software vulnerabilities in the computer systems. The number of such signatures of practical concern is very large and their structure is rapidly changing. Many of these signatures cannot practically be expressed as ordinary sequences of characters. For example a credit-card number uniquely identifies a specific credit card while a string comprising common digits of the numbers of all credit cards issued by one bank does not uniquely identify a specific credit card.
A string inserted in a data stream may be harmful to a recipient of the data stream and, hence, the need to locate the string to enable further corrective actions. Clearly, any means for detecting strings of special interest in a continuous data stream has to be sufficiently fast. One approach for fast detection is to devise special-purpose hardware circuitry with concurrent processing. However, considering the fast pace of network changes, a solution based on special-purpose hardware may be impractical.
A software solution is highly desirable because of its low cost, ease of deployment, and ease of adapting to the changing communications environment. There is therefore a need for a software-based algorithm that can detect a large set of strings under execution-time constraints and memory limitations in order to enhance Intrusion prevention systems (IPS) and intrusion detection systems (IDS).
In accordance with one aspect, the present invention provides a method of examining a data stream to detect presence of at least one complex string belonging to a predefined complex dictionary. The method comprises steps of: associating an array of state variables and an array of reference states with the complex dictionary with one-to-one correspondence between entries of the complex dictionary, the array of state variables, and the array of reference states; detecting a simple string in the data stream, the simple string being a constituent simple string in each of at least one complex string in the complex dictionary; updating a state variable associated with the each of at least one complex string according to all relative positions of the simple string within the each of at least one complex string; and determining that the each of at least one complex string is present in the data stream when the state variable attains a corresponding reference state.
In one realization of the method, a multi-bit Boolean state variable is used. Consequently, the step of updating the state variable comprises steps of: (1) shifting bits of the Boolean state variable a number of positions determined according to a position of the simple string in the data stream and a previous position of any simple string detected in the data stream and belonging to the each of at least one complex string; (2) setting an end bit of the Boolean state to indicate logical TRUE; and (3) performing a logical AND of the state variable and a bitmask associated with the simple string, the bitmask indicating the all relative positions of the simple string within the each of at least one complex string.
The bitmask may originate at the rightmost bit and, consequently, the Boolean state variable is shifted in the direction from right to left with the rightmost bit of the Boolean variable set to equal TRUE. Alternatively, the bitmask may originate at the leftmost bit and, consequently, the Boolean state variable may be shifted in the direction from left to right with the leftmost bit of the Boolean variable set to equal TRUE.
The corresponding reference state indicates a specific relative position of a last character of a last simple string in each of the at least one complex string. In an exemplary realization, the corresponding reference state is a multi-bit Boolean constant having a bit corresponding to the specific relative position set to logical TRUE, and the presence of each of the at least one complex string in the data stream is determined by performing a logical AND of the state variable and the corresponding reference state, with the outcome overwriting a current value of the state variable. The bit in the state variable at a position corresponding to the specific relative position is then examined and if its state is TRUE, detection of a respective complex string may be ascertained subject to congruence of a suffix of the respective complex string to a corresponding portion of the data stream.
In accordance with another aspect, the present invention provides a method of detecting the presence of a selected complex string from a predefined complex dictionary in a data stream. The selected complex string comprises a predefined number χ>1 of simple strings with each simple string having a prefix of indefinite characters. The last simple string of the complex string has a suffix of indefinite characters, which is considered a suffix of the complex string. The prefix of the first simple string may be a NULL string, and the suffix may be a NULL string. A NULL string is an empty string with zero characters. The method comprises steps of: locating a first portion of the data stream where the first portion is identical to a first simple string of the selected complex string; ascertaining congruence of an adjacent portion of the data stream, preceding the first portion, to a prefix of the first simple string; locating a second portion of the data stream where the second portion is identical to a second simple string of the selected complex string; and ascertaining congruence of an intervening portion between the first portion and the second portion to a prefix of the second simple string. Notably, congruence of a NULL string to any other NULL string is, by definition, ascertained.
The method includes a further step of ascertaining congruence of the suffix to a corresponding portion of the data stream determined according to a length of the complex string. Where the number of simple strings in a complex string exceeds 2, i.e., χ>2, the method comprises further steps of locating an mth portion of the data stream is the mth portion being identical to an mth simple string of the selected complex string; and ascertaining congruence of an intervening portion, of the data stream, preceding the mth portion and a prefix of an mth simple string, the intervening portion following an (m−1)th portion of the data stream found to be identical to an (m−1)th simple string in the selected complex string.
In accordance with another aspect, the present invention provides a method of identifying a complex string in a data stream, the method comprising steps of: segmenting the complex string into a suffix and a set of string segments, each string segment comprising a prefix and a simple string, where the prefix comprises indefinite characters and the suffix comprises indefinite characters; generating an array of bitmasks each bitmask associated with a string segment in the set of string segments, the bitmask indicating a location index of an end character of the each string segment; associating a Boolean state variable with the complex string; locating a current simple-matching position in the data stream at which at least one simple-string belonging to the complex string terminates; initializing a current mask as an opaque mask; performing a logical OR operation of the current mask with selected bitmasks corresponding to the at least one simple string to produce a composite current mask; determining a gap between the current simple-matching position and a previous simple-matching position; left-shifting each entry of the state variable by the gap, replacing each shifted entry by “0” and setting the rightmost entry to “1”; and updating the state variable according to a logical AND operation with the composite current mask.
The method comprises a step of determining that a portion of the data stream terminating at the current simple-matching position contains the complex string when a bit in a target position of the state variable represents a logical TRUE, where the target position corresponds to a last location index of an end character of a last string segment within the complex string.
The method comprises a further step of associating a segment descriptor with each string segment. The segment descriptor indicates a length of the string segment and a length of a prefix of the string segment. A last string segment within the complex string further comprises indications of a length of the suffix and a target position corresponding to a last location index of an end character of a last string segment within the complex string. Each selected bitmask associated with a specific simple string satisfies a condition of congruence of a prefix of the specific simple string and a corresponding portion of the data stream. When the suffix includes at least one character, the method comprises a step of determining that a portion of the data stream terminating at a position of index equal to an index of the current simple-matching position plus a length of the suffix when the state variable contains a logical TRUE at the target position and the suffix is congruent with a portion of the data stream succeeding the current simple-matching position.
In accordance with a further aspect, the present invention provides a method of screening a data stream to detect presence of any complex string from a predefined complex dictionary. The method comprises a preprocessing step of transforming the complex dictionary into a segmented dictionary, an array of segment descriptors, and an array of bitmasks. The segmented dictionary comprises string segments of each complex string in the complex dictionary, each string segment comprising a prefix and a simple string. Each segment descriptor defines a content of a corresponding string segment in the segmented dictionary, and each bitmask indicates a location of a string segment in the segmented dictionary within a respective complex string in the complex dictionary. Steps for detecting and locating complex strings in the data stream include: performing a simple search to produce detected simple strings in the data stream, where the simple strings are defined in the segmented dictionary; selecting candidate string segments from among specific string segments containing the detected simple strings; and identifying candidate complex strings for the at least one complex string in the complex dictionary, where the candidate complex strings contain the candidate string segments, using the array of segment descriptors and the array of bitmasks.
The method further comprises: (1) associating a state variable with each complex string in the complex dictionary; (2) updating the state variable according to gauged spans between successive positions in the data stream, at which positions simple strings belonging to the each complex string terminate; (3) determining, at each position, a subset of the candidate string segments belonging to the each complex string; and (4) correlating the state variable with locations, within the each complex string, of candidate string segments of the subset. The step of correlating further comprises formulating a composite current mask as a logical OR function of bitmasks of candidate string segments of the subset, and performing a logical AND operation of the composite current mask and the state variable to produce an updated state variable. The step of selecting comprises a further step of ascertaining congruence of a portion of the data stream preceding each detected simple string to a prefix of a corresponding string segment from among the specific string segments.
In an exemplary embodiment, the present invention provides an article of manufacture comprising at least one processor-readable medium and instructions carried on the at least one medium. The instructions are devised to cause a processor to transform the complex dictionary into a structure which enables computationally efficient search. The structure comprises a segmented dictionary, an array of segment descriptors, and an array of bitmasks. The segmented dictionary comprises string segments of each complex string in the complex dictionary, and a suffix. Each string segment comprises a prefix and a simple string. Each segment descriptor defines content of a corresponding string segment in the segmented dictionary. Each bitmask indicates a location of a string segment in the segmented dictionary said string segment being within a respective complex string in the complex dictionary. The instructions are further devised to cause the processor to perform simple search to produce detected simple strings defined in the segmented dictionary, select candidate string segments from among specific string segments containing the detected simple strings, and identify candidate complex strings in the complex dictionary containing the candidate string segments using the array of segment descriptors, and the array of bitmasks. The instructions further causes the processor to ascertain congruence of the prefix of each string segment with a corresponding portion of the data stream and congruence of the suffix of each complex string with a corresponding portion of the data stream. Where the prefix is a NULL prefix, having zero characters, and where the suffix is a NULL suffix, congruence is inherently ascertained.
In an alternate realization of the article of manufacture, the segmented dictionary comprises a prefix and string segments of each complex string in the complex dictionary, with each string segment comprising a simple string and a suffix. The instructions cause the processor to operate to ascertain congruence of the prefix with a respective portion of the data stream and congruence of the suffix of the each string segment with a corresponding portion of the data stream.
Embodiments of the present invention will be further described with reference to the accompanying exemplary drawings, in which:
Alphabet: The term alphabet refers to a set of characters which may include punctuation marks and spaces.
Class: A subset of characters may be selected to form an alphabet class. The selected subset of characters may be arranged in an arbitrary order. For brevity, the term “class” will be consistently used herein to refer to an alphabet class. Several classes may be formulated.
Indefinite character: An indefinite character is an ordinary character of the alphabet which derives the indefinite status from its position in a predefined string of characters. An indefinite character belongs to one of predefined classes and possibly to more than one class. One of the classes may encompass the entire alphabet, and a character belonging to such class is treated as a character with a “don't care” attribute.
Coherent word: A coherent word comprises a sequence of characters. It is a character-defined word in which each character is an ordinary character uniquely defined in the alphabet. If the alphabet includes punctuation marks and spaces, a group of coherent words may also be treated as a single coherent word.
Ambiguous word: An ambiguous word is a class-defined word in which each character is defined according to class association.
Simple string: A simple string comprises a coherent word. As described above, several coherent words separated by spaces may also constitute a single coherent word.
Ambiguous string: The term “ambiguous string” is herein used synonymously with the term “ambiguous word”.
Complex string: A complex string comprises at least two words, of which at least one word is an ambiguous word and at least one ambiguous word is subject to at least one restriction such as a predefined number of characters or membership of constituent characters in specific classes.
Prefix: An ambiguous word preceding a simple string within a complex string is called a prefix.
Suffix: An ambiguous word succeeding a simple string within a complex string is called a suffix.
String segment: A string segment may comprise a prefix and immediately following simple string or a simple string and an immediately following suffix. Either of the two definitions may be adopted as long as it is used consistently.
String equality: Two strings are said to be equal, or equivalent, if they are identical.
String congruence: Two strings are said to be congruent if they have the same number of characters and if likewise positioned characters in the two strings belong to the same class. This applies to a pair of ambiguous strings or to a pair of complex strings.
String matching: Two simple strings (coherent strings) are said to be matching strings if they are equal. Two complex strings are said to be matching strings if there is one-to-one equality of their constituent coherent strings and one-to-one congruence of their constituent ambiguous strings.
Simple dictionary: A simple dictionary may be devised to include a set of simple strings of special interest. The simple dictionary may expand or shrink as the need arises.
Complex dictionary: A complex dictionary comprises a set of complex strings. A simple string may be treated as a reduced complex string and, therefore, the method of the invention will focus on complex strings. The set of complex strings may be updated to add new complex strings or delete existing complex strings.
Text: A text is a sequence of characters extracted from a data stream and may include ordinary characters and indefinite characters. A text may be examined to ascertain the existence of any of complex string from among a predefined set of reference complex strings forming a complex dictionary.
Mask: A mask is a sequence of bits, each bit assuming either of the two states “false” or “true”. When a mask is ANDed with a first Boolean variable of equal length to produce a second Boolean variable, each bit of the second Boolean-variable at a position corresponding to a mask bit of false state (binary 0) is also of false state. Each bit of the second Boolean-variable at a position corresponding to a mask bit of true state (binary 1) has the same state of the corresponding bit of the first Boolean variable.
Opaque mask: A mask in which each bit represents logical FALSE, binary 0 for example, is an opaque mask.
State: The state of an n-bit Boolean state variable is indicated by bits set to represent logical TRUE (binary 1) and may be denoted {p0, p1, . . . , pn}, where pj, 0≤j≤n, are positions in the state variable each having a value of binary 1. For example, a 32-bit Boolean state variable having a value of [00000000001000010000000000000001] may be represented as {0,16,21}, with the rightmost bit being the origin of index 0. A state variable having a null value, where all its bits are set to binary 0, is denoted { }.
String Length: The length of any string is the number of characters of the string, including indefinite characters.
The method of the present invention, which applies to complex strings, is devised to reduce memory consumption, minimize the computation effort, reduce computation-time variance, and present detected complex strings in the order in which they are encountered in an examined data stream.
It is noted that a complex dictionary preferably includes only mutually distinct complex strings. However, as will be described below with reference to
In one realization of complex string 220, each character “*” may indicate a logical “don't care” (a term used extensively in the art). Accordingly, a character “*” may correspond to any recognizable character in a recognized alphabet-list. With 24 such characters in the exemplary complex string 220, and considering a recognizable alphabet of 80 unique characters (comprising, for example, the upper-case and lower-case English characters, 10 single decimal digits, and 18 auxiliary symbols and punctuation marks), the number of simple strings that can be manufactured to be congruent with the exemplary complex string 220 is the astronomical 8024. Of course, considering grammatical constraints in both natural languages and computer-tailored languages, the number of likely encounters in a data stream of complex strings, congruent to the exemplary complex string 220, may be reduced significantly. However, the number would still be too large to list the likely congruent strings in a simple dictionary adapted for use with a conventional simple-search method.
In general, individual indefinite characters “*” in complex string 220 may belong to different classes each class being defined by a corresponding subset of the alphabet. Two complex strings 222 and 224, which may be encountered in a data stream contain identical simple strings in corresponding positions. The two complex strings, however, have different indefinite characters and the congruence, or otherwise, of the two strings is determined according to the class definition of the indefinite characters.
According to the method of the invention, a complex string is divided into string segments. By definition, a complex string contains a number of simple strings with intervening indefinite characters. The first constituent simple string may be preceded by indefinite characters, and the last constituent simple string may be succeeded by indefinite characters. The indefinite strings preceding a simple string is referenced as a “prefix” and the indefinite strings succeeding a simple string is referenced as a suffix. A prefix may have an arbitrary number, including zero, of characters. Likewise, a suffix may have an arbitrary number, including zero, of characters. A string segment may be defined as a concatenation of a prefix and a succeeding simple string or a concatenation of a simple string and succeeding suffix.
A string-search module 528 receives input data 570 in data units and uses the segmented complex strings together with their associated data stored in memory 526 to determine the occurrence, or otherwise, of any of the complex strings of the basic complex dictionary 520 in the input data. When the occurrence of a complex string is determined, the position of the found complex string in the input data 570 is submitted to a decision module 580 which may take some corrective actions such as deleting the complex string from the input data 570 to produce a processed text 590, or simply identifying the detected complex string in the processed text 590. The string-search module 528 is a time-critical component of the mechanism 530 and, therefore, optimizing the string-search process is of paramount importance. However, even if the execution time is rendered negligibly small, a block of the input data 570 need be retained for possible modification if a specific reference complex string is found in the input data. The retained data block, which may comprise multiple data packets, a single data packet, or a fraction of a packet, is held in a buffer 578. An upper bound of the size of a held data block, and hence a required storage capacity of buffer 578, depends largely on the method of search.
Considering one detected simple string at a time, step 630 identifies all complex strings in the complex dictionary, which contain the simple string. Step 630 may employ any of well-established simple-search methods, such as the Aho-Corasick method. Up to this point, each of the identified complex strings is treated as a candidate complex string. In step 640, the state variable associated with each candidate complex string is updated according to successive positions, in the data stream, at which any simple string belonging to the candidate complex strings is detected. In step 650, the updated state variable of each candidate complex string is compared with a corresponding reference state to determine the existence, or otherwise, of the candidate complex string in the data stream. Step 660 examines the results of the comparison for each candidate complex strings individually. If detection is ascertained for an individual candidate complex string, step 670 indicates detection of the candidate complex string then determines its location in the data stream and reports all relevant information to the decision module 580. The process then proceeds to step 620. If detection of the individual complex string is not yet determined, step 660 directs the process to step 620. Preferable, the execution of step 620 is performed after all candidate complex strings are examined in step 650.
A segment descriptor associated with each string segment 420 or 430 defines the composition of the string segment. If the first segmentation scheme of
A bitmask is also associated with each string segment 420 or 430 in order to bind the string segment to its parent complex string.
In a preferred embodiment of the present invention, an Aho-Corasick automaton is created and used in the simple-search module 820. The Aho-Corasick method detects simple strings in the order of their occurrence in the input data stream. The method also detects all overlapping simple strings that end at a single position in the data stream. Such overlapping simple strings would have at least one common end character. For example the two simple-strings chief and editor-in-chief would be reported if the simple-string editor-in-chief is encountered in the data stream 812 and if the two simple strings are placed in separate entries in a corresponding simple dictionary. The main desirable properties of a real-time string-search method include efficient memory utilization, predictable computation effort, and orderly listing where strings are detected in the order in which they occur in an examined data stream. Notably, the Aho-Corasick method, which is applicable to detection of simple strings, possesses such properties and is therefore a preferred method for incorporation in the simple-search module 820.
In step 928, the intermediate Boolean variable MASK is used to update the Boolean variable STATE in a STATE-array memory 860.
In step 930, the index, κ, of the last simple string in the specific complex string C, is selected from segment-descriptor set 752, and the bit in Boolean variable STATE in position κ is examined. If the value of the bit is “false” (logical “0”), it is determined that the portion of the input data terminating in position p does not contain the specific complex string C and step 940 is then executed. If the value of the bit is “true” (logical “1”), it is then determined that the portion of the input data terminating in position p contains all the string segments 420 of the complex string C, and the occurrence of the entire complex string C in the input data is then decided in step 934 according to the co indefinite characters of the suffix of complex string C. If ω=0, indicating a NULL suffix, an occurrence of complex string C is ascertained and step 934 reports, to the decision module 580, an occurrence of the specific complex string C in the portion of the input data terminating in position p. If ω>0 and the suffix is incongruent with corresponding characters spanning positions (p+1) to (p+ω), it is determined in step 934 that the input data received so far does not contained the specific complex string C. Otherwise, step 934 reports, to the decision module 580, an occurrence of the specific complex string C in the portion of the input data terminating in position (p+ω) and step 940 is executed next.
Step 940 determines if all strings in set Σ have been processed. If the set Σ is not yet exhausted, another subset is processed (step 924). Otherwise, a new simple-string matching position p, as determined in step 920, is considered.
The span between a current position p and a previous position π associated with a specific complex string is determined as [p−π]modulo Γ, Γ being determined according to either of the two schemes described above. In step 1120, the Boolean variable STATE is shifted to the left a number of positions equal to the span associated with the complex string C. Each position in STATE, from which a bit is shifted, is assigned a value of “0”, except the right-most position which is always assigned a value of “1” after a shift operation. In step 1122, a bit-wise logical ANDing is performed and the result overwrites the variable STATE.
As described, the bitmask used in step 1122 is considered to originate at the rightmost bit and, consequently, the Boolean state variable is shifted a number of bits equal to (p−π)modulo Γ, where F equals 2W, W being the word length assigned to the position indices p and π, in the direction from right to left with the rightmost bit of the Boolean variable set to equal TRUE (binary 1). Alternatively, the bitmask may originate at the leftmost bit and, consequently, the Boolean state variable may be shifted in the direction from left to right with the leftmost bit of the Boolean variable set to equal TRUE as illustrated in
In an alternate realization of the mechanism illustrated in
A ruler 1202 is used to indicate a position of each character of the input data 1250 and each character of the complex string 1220. The input data extracted from a data stream may continue ad infinitum and, therefore, a position in the input data is indexed as a cyclic number. The ruler 1202 is a cyclic ruler having a range dictated by a number of factors including the hardware platform on which the method is realized into an article of manufacture.
In general, the simple search module 820 may detect several simple strings ending in one position of the input data.
As described earlier, the preprocessing module 524 produces an array of bitmasks 754, each bitmask indicating the relative positions of each simple string within its parent complex string. Three bitmasks 1240, individually identified as 1240-0, 1240-1, and 1240-2, respectively indicate the relative positions of simple strings “DE”, “KL”, and “MPQST” in complex string 1220. A Boolean state variable 1260 having 32 bits is associated with complex string 1220. A current MASK is created in step 926 which is further detailed in
The current MASK is an outcome of bitwise OR operations of bitmasks of all simple strings detected at a given position in the input data 1250 subject to congruence of a prefix of each of simple strings to a corresponding portion of the input data as indicated in step 1022. Notably, the state variable 1260 is initialized in step 1012 as an opaque mask in the process of creating a current mask detailed in
As indicated in step 1120, the state variable 1260 is shifted (p−π) bits (modulo Λ) and the rightmost bit of the shifted state variable is set to equal logical TRUE, which is equated to binary 1. With π=0 at position p=06, and starting with an opaque state { }, the state variable is shifted 6 bits to the left with the bit in position 0 set to equal binary 1 to attain a state of {0}. The shifted state variable is bitwise ANDed with bitmask 1240-0 corresponding to simple string “DE”. The result is a state of {0}, i.e., the rightmost bit of the state variable is set to binary 1 and each other bit is set to binary 0. There are two states corresponding to each detected simple string in the input data 1250; a first state resulting from executing step 1120 and a second state resulting from executing step 1122 of
At position 7 (according to ruler 1202) of the input data 1950, the simple-search module 820 detects a set Σ(0) of six simple strings “ABCD”, “BCD”, “CD”, “CD”, “CD”, “CD”, out of the eight simple strings of the segmented dictionary 750, and associates each of the detected simple strings with a parent complex string. A subset σ0 of Σ(0), referenced as 1925-0, contains detected simple strings (only one in this example) belonging to complex string 1920-0. A subset σ1 of Σ(0), referenced as 1925-1, contains detected simple strings (three in this example) belonging to complex-string 1920-1. A subset σ2 of Σ(0), referenced as 1925-2, contains detected simple strings (two in this example) belonging to complex-string 1920-2. The simple string “CD” further appears separately in two portions of input data 1950 to be detected later by the simple-search module 820. Each of the simple strings in set Σ(0) belongs to at least one string segment in at least one complex string in the set of reference complex strings 1920. String segments in the set of reference complex strings 1920 are candidate string segments. Their presence in the input data 1950 may be ascertained only after satisfying congruence conditions as described earlier with reference to
Assuming congruence of all the indefinite characters in the reference complex strings 1920 to corresponding characters of input data 1950, based on the prefix and suffix definitions, the current masks corresponding to subsets σ0, σ1, σ2 of Σ(0) are determined according to the bitwise OR operation of step 1026. Thus, the bitmask for subset σ0 of Σ(0) has only one bit in position 9 set to binary 1. The position of the set bit corresponds to the displacement (19-10) of the end character “D” of the detected simple string “ABCD” from the end character “Y” of the first simple string “UVWXY” of complex-string 1920-0. The bitmask for subset σ1 of Σ(0) has three bits in positions 0,4, and 12 set to binary 1, the positions being determined by the displacement of each of the simple strings in σ1 from the end character “D” of the first simple string “BCD” in complex string 1920-1. The bitmask for subset σ2 of Σ(0) has two bits in positions 10 and 17 set to binary 1, the positions being determined by the displacement of each of the simple strings in σ2 from the end character “C” of the first simple string “DC” in complex string 1920-2.
As illustrated in
At position 19 (according to ruler 1202) of the input data 1950, the simple-search module 820 detects a set Σ(2) identical to Σ(1) and the same composite current masks 2080-1 and 2080-2 also apply.
The 16 complex strings 2510 are distinct. However, the method described with reference to
Each bitmask corresponds to a string segment in the segmented dictionary 2650 and has a bit in a position corresponding to the end character of the string segment set to “true” (binary 1). The position is relative to the end character of the first simple string of the complex string.
The invention thus provides a computationally efficient method for screening a data stream to detect and locate complex strings belonging to a basic complex dictionary. The basic complex dictionary may comprise a very large number of complex strings, each including coherent strings and ambiguous strings. The method is partly based on establishing equality of coherent strings and congruence of ambiguous strings, where congruence of any two characters is based on their joint membership to one of predefined character classes.
The method is well adapted to software realization in a single-processor or multi-processor computing environments. The segmentation process of the basic complex dictionary into a segmented dictionary and associated segment descriptor and bitmasks, as illustrated in
Furthermore, in a multi-processor environment, the processes implemented by the two basic components 820 and 840 of the string-search module 528, may be pipelined to increase the rate at which complex strings can be detected and, hence, enable handling data streams of high flow rates.
Although specific embodiments of the invention have been described in detail, it should be understood that the described embodiments are intended to be illustrative and not restrictive. Various changes and modifications of the embodiments shown in the drawings and described in the specification may be made within the scope of the following claims without departing from the scope of the invention in its broader aspect.
The present application is a Continuation of U.S. patent application Ser. No. 13/862,849 filed on Apr. 15, 2013; which in turn is a Continuation of U.S. patent application Ser. No. 13/371,455 filed on Feb. 12, 2012, which has issued as a U.S. Pat. No. 8,423,572 on Apr. 16, 2013; which in turn is a Continuation of application Ser. No. 13/270,632 filed on Oct. 11, 2011, which has issued as a U.S. Pat. No. 8,117,229 on Feb. 14, 2012; which in turn is a Continuation of application Ser. No. 13/155,212 filed on Jun. 7, 2011, which has issued as a U.S. Pat. No. 8,069,183 on Nov. 29, 2011; which in turn is a Continuation of U.S. patent application Ser. No. 13/011,395 filed on Jan. 21, 2011, which has issued as a U.S. Pat. No. 7,987,196 on Jul. 26, 2011; which in turn is a Continuation of U.S. patent application Ser. No. 12/605,357 filed on Oct. 25, 2009, which has issued as a U.S. Pat. No. 7,899,842 on Mar. 1, 2011; which in turn is a Divisional from the parent U.S. application Ser. No. 11/678,587 filed on Feb. 24, 2007 to Boyce entitled “Fast identification of Complex Strings in a Data Stream”, which has issued as a U.S. Pat. No. 7,630,982 on Dec. 8, 2009; the entire contents of the above noted applications and issued patents being incorporated herein by reference.
Number | Name | Date | Kind |
---|---|---|---|
5299206 | Beaverson | Mar 1994 | A |
5388234 | Kanno | Feb 1995 | A |
5471610 | Kawaguchi | Nov 1995 | A |
5712971 | Stanfill et al. | Jan 1998 | A |
6131092 | Masand | Oct 2000 | A |
6263333 | Houchin | Jul 2001 | B1 |
6278992 | Curtis | Aug 2001 | B1 |
6282532 | Sandell | Aug 2001 | B1 |
6338061 | Shimomura | Jan 2002 | B1 |
6741985 | Green | May 2004 | B2 |
6785677 | Fritchman | Aug 2004 | B1 |
6856981 | Wyschogrod et al. | Feb 2005 | B2 |
6892237 | Gai et al. | May 2005 | B1 |
6952694 | Mathur et al. | Oct 2005 | B2 |
7082044 | Gould et al. | Jul 2006 | B2 |
7134143 | Stellenberg et al. | Nov 2006 | B2 |
7225188 | Gai | May 2007 | B1 |
7240040 | Wyschogrod | Jul 2007 | B2 |
7254632 | Zeira et al. | Aug 2007 | B2 |
7260558 | Cheng | Aug 2007 | B1 |
7308561 | Cornet et al. | Dec 2007 | B2 |
7325013 | Caruso | Jan 2008 | B2 |
7356663 | Jain | Apr 2008 | B2 |
7383268 | Krokosz | Jun 2008 | B2 |
7406470 | Mathur et al. | Jul 2008 | B2 |
7454418 | Wang | Nov 2008 | B1 |
7508985 | Van Lunteren | Mar 2009 | B2 |
7529746 | Ichiriu et al. | May 2009 | B2 |
7689530 | Williams, Jr. | Mar 2010 | B1 |
7702629 | Cytron et al. | Apr 2010 | B2 |
7711719 | Waldin | May 2010 | B1 |
7725510 | Alicherry | May 2010 | B2 |
7783654 | Sreenath | Aug 2010 | B1 |
7784094 | Balakrishnan et al. | Aug 2010 | B2 |
7818311 | Michailov | Oct 2010 | B2 |
7860881 | Haselden et al. | Dec 2010 | B2 |
7861304 | Nachenberg | Dec 2010 | B1 |
7872890 | Starovoitov et al. | Jan 2011 | B1 |
7945527 | Michelin | May 2011 | B2 |
7958164 | Ivanov et al. | Jun 2011 | B2 |
8032479 | Kori | Oct 2011 | B2 |
8326819 | Indeck et al. | Dec 2012 | B2 |
20010010722 | Enari | Aug 2001 | A1 |
20020123995 | Shibuya | Sep 2002 | A1 |
20030051043 | Wyschogrod | Mar 2003 | A1 |
20040073550 | Meirovitz | Apr 2004 | A1 |
20050120017 | Motoki | Jun 2005 | A1 |
20050132107 | Cornet | Jun 2005 | A1 |
20050273450 | McMillen et al. | Dec 2005 | A1 |
20060020595 | Norton | Jan 2006 | A1 |
20060173831 | Basso et al. | Aug 2006 | A1 |
20060235845 | Argentar | Oct 2006 | A1 |
20070011734 | Balakrishnan | Jan 2007 | A1 |
20070127482 | Harris | Jun 2007 | A1 |
20070192863 | Kapoor | Aug 2007 | A1 |
20070214134 | Haselden | Sep 2007 | A1 |
20080036630 | Lee | Feb 2008 | A1 |
20080040345 | Cameron | Feb 2008 | A1 |
20080071780 | Ichiriu et al. | Mar 2008 | A1 |
20080071781 | Ninan | Mar 2008 | A1 |
20080111716 | Artan | May 2008 | A1 |
20080114725 | Indeck et al. | May 2008 | A1 |
Entry |
---|
Fang Yu Randy H. Katz, “Gigabit Rate Packet Pattern-Matching Using TCAM”, Oct. 5-8, 2004, 12th IEEE Proceedings of the Network Protocols (ICNP'04), p. 174-183. |
Martin C. Herbordt Josh Model Yongfeng Gu Bharat Sukhwani Tom VanCourt “Single Pass, BLAST-Like, Approximate String Matching on FPGAs”, IEEE 2006. |
Efficient String Matching: An Aid to Bibliographic Search, by A.V. Aho and M.J. Corasick, Communication of the ACM, Jun. 1975, v.18, No. 6, p. 333-340. |
A New Approach to Text Searching, by R.A. Baeza-Yates and G.H. Connet, Communication of the ACM, 35, Oct. 1992, p. 74-82. |
Regular Expression Search Algorithm, by Ken Thompaon, Communications of the ACM, Jun. 1968, v.11, No. 6, p. 419-422. |
Gonzalo Navarro, Mathieu Raffinot Practical and flexible pattern matching over Ziv-Lempel compressed text Journal of Discrete Algorithms 2 (2004) 347-371 www.elsevier.com/locate/jda2 Feb. 2004. |
Gonzalo Navarro, Takuya Kida, Masayuki Takeda, Ayumi Shinohara, Setsuo Arikawa Faster Approximate String Matching over Compressed Text IEEE 2001. |
Xu Kefu, Qi Deyu, Qian Zhengping, Zheng Weiping “Fast Dynamic Pattern Matching for Deep Packet Inspection” 2007 IEEE. |
Alicherry M., Muthuprasanna M., Kumar V. “High Speed Pattern Matching for Network IDS/IPS” Lucent Bell Laboratories; IEEE, 2006. |
Eugene Agichtein, Venkatesh Ganti “Mining Reference Tables for Automatic Text Segmentation”, Aug. 22-25, 2004 ACM. |
Ricardo Baeza-Yates, Gonzalo Navarro “New and Faster Filters for Multiple Approximate String Matching” Random Structures and Algorithms (RSA), vol. 20, No. 1, Jan. 2002, pp. 23-49. |
Number | Date | Country | |
---|---|---|---|
20140330861 A1 | Nov 2014 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 11678587 | Feb 2007 | US |
Child | 12605357 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 13862849 | Apr 2013 | US |
Child | 14333838 | US | |
Parent | 13371455 | Feb 2012 | US |
Child | 13862849 | US | |
Parent | 13270632 | Oct 2011 | US |
Child | 13371455 | US | |
Parent | 13155212 | Jun 2011 | US |
Child | 13270632 | US | |
Parent | 13011395 | Jan 2011 | US |
Child | 13155212 | US | |
Parent | 12605357 | Oct 2009 | US |
Child | 13011395 | US |