CN103188268B - A kind of method and apparatus identifying aggressivity message - Google Patents
A kind of method and apparatus identifying aggressivity message Download PDFInfo
- Publication number
- CN103188268B CN103188268B CN201310109601.1A CN201310109601A CN103188268B CN 103188268 B CN103188268 B CN 103188268B CN 201310109601 A CN201310109601 A CN 201310109601A CN 103188268 B CN103188268 B CN 103188268B
- Authority
- CN
- China
- Prior art keywords
- enumerator
- character
- message
- flag bit
- count value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 33
- 238000009958 sewing Methods 0.000 claims description 2
- 238000005516 engineering process Methods 0.000 abstract description 4
- 230000006855 networking Effects 0.000 abstract description 2
- 230000008878 coupling Effects 0.000 description 11
- 238000010168 coupling process Methods 0.000 description 11
- 238000005859 coupling reaction Methods 0.000 description 11
- 230000007423 decrease Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 206010048669 Terminal state Diseases 0.000 description 2
- 230000009191 jumping Effects 0.000 description 2
- 230000007704 transition Effects 0.000 description 2
- 230000006872 improvement Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Landscapes
- Mobile Radio Communication Systems (AREA)
- User Interface Of Digital Computer (AREA)
- Controls And Circuits For Display Device (AREA)
Abstract
The invention discloses a kind of method and apparatus identifying aggressivity message, belong to networking technology area.Described method includes: receive message, and the character included by this message is input in train out report system DFA one by one;Obtain DFA current state, when the current state of DFA be prefix accept state time, for this prefix accept state arrange correspondence an initial value be the enumerator of default value;Continuing to be input in DFA the character that this message includes, will enter into the character in DFA simultaneously and be input to character judgement unit, whether character judgement unit is preset characters for judging the character of input;Output result according to character judgement unit arranges this enumerator;Obtain the current state of DFA, if the current state of DFA is suffix accepts state, then accepts, according to the prefix arranged, the enumerator that state is corresponding, determine whether this message is aggressivity message.The present invention can reduce resource consumption, reduces memory space, and improves the speed identifying aggressivity message.
Description
Technical field
The present invention relates to networking technology area, particularly to a kind of method and apparatus identifying aggressivity message.
Background technology
Along with the deep development of network technology, the range of application of network is more and more extensive, and it is right that network occurs in that
There is the message threatened in the safety of network, this message is aggressivity message, and the form of aggressivity message
Also become increasingly complex with kind.In order to ensure the safety of network, it would be desirable to identify on network rapidly
Which message be aggressivity message.
At present, it is provided that a kind of method identifying aggressivity message, particularly as follows: terminal receives message, and will
The character that this message includes is input to what prefix DFA(Deterministic Finite Automaton determined one by one
Finite automata) in, obtain the current state of prefix DFA, if the current state of prefix DFA is prefix
The terminal state of DFA, then show this message and the prefix character rule match preset, and acquisition is currently entered
The character in prefix DFA primary importance in this message;Judge after the primary importance of this message
Default value continuous print character is the most identical with default character, if after the primary importance of this message
Default value continuous print character is identical with the character preset, then obtain in default value continuous print character
Last character second position in this message;And the character started from the second position is input to one by one
In suffix DFA, obtain the current state of suffix DFA, if the current state of suffix DFA is suffix DFA
Terminal state, it is determined that the message of reception is aggressivity message.
During realizing the present invention, inventor finds that prior art at least there is problems in that
Needing prefix DFA and a suffix DFA in prior art, resource consumption is relatively big, and identifies
The speed of aggressivity message is slower.
Summary of the invention
In order to solve problem of the prior art, embodiments provide a kind of side identifying aggressivity message
Method and device.Described technical scheme is as follows:
First aspect, it is provided that a kind of method identifying aggressivity message, described method includes:
Receive message, and the character included by described message is input in train out report system DFA one by one;
Obtain the current state of described DFA, when the current state of described DFA be prefix accept state time, for institute
Stating prefix and accept state arranging a corresponding initial value is the enumerator of default value;
Continue to be input in described DFA the character that described message includes, will enter in described DFA simultaneously
Character be input to character judgement unit, whether described character judgement unit for judging the character of described input
For preset characters;
Output result according to described character judgement unit arranges described enumerator;
Obtain the current state of described DFA, if the current state of described DFA is suffix accepts state, then root
Accept, according to the prefix arranged, the enumerator that state is corresponding, determine whether described message is aggressivity message.
In conjunction with first aspect, in the first possible implementation of above-mentioned first aspect, described enumerator
Including the first flag bit and the second flag bit, described first flag bit is used for illustrating that whether described enumerator is in fortune
OK, described second flag bit is for illustrating whether the count value of described enumerator is kept to zero;
Correspondingly, described for described prefix accept state arrange correspondence an initial value be the enumerator of default value,
Including:
Arranging described first flag bit is 1, and described first flag bit is 1 for illustrating that described enumerator is transported
OK, arranging described second flag bit is 0, and described second flag bit is 0 for the counting of described enumerator is described
Value is not kept to zero, and the initial value arranging described enumerator is default value.
In conjunction with the first possible implementation of first aspect, possible at the second of above-mentioned first aspect
In implementation, the described output result according to described character judgement unit arranges described enumerator, including:
If the character that output result is described input of described character judgement unit is preset characters and described meter
Second flag bit of number device is 0, then reduce the count value of described enumerator;
If the character that output result is described input of described character judgement unit is not preset characters and described
Second flag bit of enumerator is 0, then close described enumerator and arrange the first flag bit of described enumerator and be
0, described first flag bit 0 is turned off described enumerator for explanation;
If the second flag bit of described enumerator is 1, then increase the count value of described enumerator.
In conjunction with the implementation that the second of first aspect is possible, possible at the third of above-mentioned first aspect
In implementation, after the count value of the described enumerator of described minimizing, also include:
If the count value of the described enumerator after Jian Shaoing is zero, then the second flag bit of described enumerator is set
It is 1.
In conjunction with the implementation that the second of first aspect is possible, possible the 4th kind of above-mentioned first aspect
In implementation, after the count value of the described enumerator of described increase, also include:
If add after described enumerator count value more than preset suffix lengths, then close described enumerator
And the first flag bit arranging described enumerator is 0.
The first possible implementation to the 4th kind of first aspect in conjunction with first aspect or first aspect can
Any one possible implementation in the implementation of energy, in the 5th kind of possible realization of above-mentioned first aspect
In mode, the prefix that described basis has been arranged accepts the enumerator that state is corresponding, determines that whether described message is for attacking
Hitting property message, including:
Judge the prefix that arranged accept whether the enumerator that state is corresponding exists described second flag bit be 1 and
Described count value reaches to preset the enumerator of suffix lengths, if it is, determine that described message is aggressivity report
Literary composition, otherwise, it is determined that described message is non-attacking message.
In conjunction with first aspect, in the 6th kind of possible implementation of above-mentioned first aspect, described enumerator
Including the first flag bit, the second flag bit, the first count value, the second count value and prefix position,
Correspondingly, described for described prefix accept state arrange correspondence an initial value be the enumerator of default value,
Including:
Obtain the character being currently entered position in described message;
Arranging described first flag bit is 1, and arranging described second flag bit is 0, arranges described first count value
For the minimum number of preset characters needed for identification aggressivity message, arranging described second count value is 0, Yi Jishe
Put described prefix bit and be set to the character being currently entered of acquisition position in described message.
In conjunction with the 6th kind of possible implementation of first aspect, possible the 7th kind of above-mentioned first aspect
In implementation, the described output result according to described character judgement unit arranges described enumerator, including:
If the character that output result is described input of described character judgement unit is preset characters and described meter
Second flag bit of number device is 0, then reduce the first count value of described enumerator;
If the character that output result is described input of described character judgement unit is not preset characters and described
Second flag bit of enumerator is 0, then close described enumerator and arrange the first flag bit of described enumerator and be
0, described first flag bit 0 is turned off described enumerator for explanation;
If the second flag bit of described enumerator is 1, then increase according to the output result of described character judgement unit
Add the count value of described enumerator.
In conjunction with the 7th kind of possible implementation of first aspect, possible the 8th kind of above-mentioned first aspect
In implementation, the described output result according to described character judgement unit increases the count value of described enumerator,
Including:
Judge the output result of described character judgement unit be whether the character of described input be preset characters, with
And judge whether the second count value of described enumerator is 0, if the output result of described character judgement unit is
The character of described input be the second count value of preset characters and described enumerator be 0, then increase described enumerator
The first count value, otherwise, then increase the second count value of described enumerator.
In conjunction with the 8th kind of possible implementation of first aspect, possible the 9th kind of above-mentioned first aspect
In implementation, after the first count value of the described enumerator of described increase, also include:
Preset needed for the minimum number of preset characters, identification aggressivity message according to needed for identifying aggressivity message
Most numbers of character and default suffix lengths, calculating character number;
If add after the first count value of described enumerator more than described character number, then close described meter
Number device and the first flag bit arranging described enumerator are 0.
In conjunction with the 8th kind of possible implementation of first aspect, possible the tenth kind of above-mentioned first aspect
In implementation, after the second count value of the described enumerator of described increase, also include:
If add after described enumerator the second count value more than preset suffix lengths, then close described meter
Number device and the first flag bit arranging described enumerator are 0.
In conjunction with the 6th kind of possible implementation of first aspect to the tenth kind of possible realization side of first aspect
The implementation that any one in formula is possible, in the 11st kind of possible implementation of above-mentioned first aspect,
The prefix that described basis has been arranged accepts the enumerator that state is corresponding, determines whether described message is aggressivity message,
Including:
Obtain the character being currently entered position in described message, and by the described character being currently entered in institute
State the position in message and be defined as suffix position;
Suffix position according to obtaining accepts, with the prefix arranged, the enumerator that state is corresponding, determines described message
Whether it is aggressivity message.
Second aspect, it is provided that a kind of device identifying aggressivity message, described device includes:
Receiver module, is used for receiving message, and the character included by described message having of being input to one by one to determine
In limit automat DFA;
First arranges module, for obtaining the current state of described DFA, when the current state of described DFA is
When prefix accepts state, accept state arranging a corresponding initial value for described prefix is the enumerator of default value;
Input module, is input to described for continuation by the character that the message that described receiver module receives includes
In DFA, will enter into the character in described DFA simultaneously and be input to character judgement unit, described character differentiates
Whether unit is preset characters for judging the character of described input;
Second arranges module, for arranging described enumerator according to the output result of described character judgement unit;
Determine module, for obtaining the current state of described DFA, if after the current state of described DFA is
Sew and accept state, then accept, according to the prefix arranged, the enumerator that state is corresponding, determine that whether described message is for attacking
Hitting property message.
In conjunction with second aspect, in the first possible implementation of above-mentioned second aspect, described enumerator
Including the first flag bit and the second flag bit, described first flag bit is used for illustrating that whether described enumerator is in fortune
OK, described second flag bit is for illustrating whether the count value of described enumerator is kept to zero;
Correspondingly, described first module be set include:
First acquiring unit, for obtaining the current state of described DFA;
First arranges unit, and the current state of the described DFA for obtaining when described first acquiring unit is front
Sewing when accepting state, arranging described first flag bit is 1, and described first flag bit is 1 for described counting is described
Device is currently running, and arranging described second flag bit is 0, and described second flag bit is 0 for described counting is described
The count value of device is not kept to zero, and the initial value arranging described enumerator is default value.
In conjunction with the first possible implementation of second aspect, possible at the second of above-mentioned second aspect
In implementation, described second arranges module includes:
First reduces unit, if for the character that output result is described input of described character judgement unit
The second flag bit for preset characters and described enumerator is 0, then reduce the count value of described enumerator;
First closing unit, if for the character that output result is described input of described character judgement unit
Be not the second flag bit of preset characters and described enumerator be 0, then close described enumerator and described meter be set
First flag bit of number device is 0, and described first flag bit 0 is turned off described enumerator for explanation;
First increases unit, if the second flag bit for described enumerator is 1, then increases described enumerator
Count value.
In conjunction with the implementation that the second of second aspect is possible, possible at the third of above-mentioned second aspect
In implementation, described second arranges module also includes:
Second arranges unit, if the count value of the described enumerator after reducing is zero, then arranges described
Second flag bit of enumerator is 1.
In conjunction with the implementation that the second of second aspect is possible, possible the 4th kind of above-mentioned second aspect
In implementation, described second arranges module also includes:
Second closing unit, for if add after described enumerator count value more than preset suffix lengths,
Then close described enumerator and to arrange the first flag bit of described enumerator be 0.
The first possible implementation to the 4th kind of second aspect in conjunction with second aspect or second aspect can
Any one possible implementation in the implementation of energy, in the 5th kind of possible realization of above-mentioned second aspect
In mode, described determine that module includes:
Second acquisition unit, for obtaining the current state of described DFA;
First determines unit, if the current state for the described DFA of described second acquisition unit acquisition is
Suffix accepts state, then judge the prefix arranged to accept in the enumerator that state is corresponding and whether there is described second mark
Will position is 1 and described count value reaches to preset the enumerator of suffix lengths, if it is, determine described message
It is aggressivity message, otherwise, it is determined that described message is non-attacking message.
In conjunction with second aspect, in the 6th kind of possible implementation of above-mentioned second aspect, described enumerator
Including the first flag bit, the second flag bit, the first count value, the second count value and prefix position,
Correspondingly, described first module be set include:
3rd acquiring unit, for obtaining the current state of described DFA;
4th acquiring unit, for obtaining the character being currently entered position in described message;
3rd arranges unit, and being used for arranging described first flag bit is 1, and arranging described second flag bit is 0,
Arranging described first count value is to identify the minimum number of preset characters needed for aggressivity message, arranges described the
Two count values are 0, and arrange described prefix bit be set to obtain the character being currently entered in described message
Position.
In conjunction with the 6th kind of possible implementation of second aspect, possible the 7th kind of above-mentioned second aspect
In implementation, described second arranges module includes:
Second reduces unit, if for the character that output result is described input of described character judgement unit
The second flag bit for preset characters and described enumerator is 0, then reduce the first count value of described enumerator;
3rd closing unit, if for the character that output result is described input of described character judgement unit
Be not the second flag bit of preset characters and described enumerator be 0, then close described enumerator and described meter be set
First flag bit of number device is 0, and described first flag bit 0 is turned off described enumerator for explanation;
Second increases unit, if the second flag bit for described enumerator is 1, then sentences according to described character
The output result of other unit increases the count value of described enumerator.
In conjunction with the 7th kind of possible implementation of second aspect, possible the 8th kind of above-mentioned second aspect
In implementation, described second arranges module includes:
Whether the 3rd increases unit, be described input for judging the output result of described character judgement unit
Character is preset characters, and judges whether the second count value of described enumerator is 0, if described character is sentenced
The output result of other unit be the character of described input be that the second count value of preset characters and described enumerator is
0, then increase the first count value of described enumerator, otherwise, then increase the second count value of described enumerator.
In conjunction with the 8th kind of possible implementation of second aspect, possible the 9th kind of above-mentioned second aspect
In implementation, described second arranges module also includes:
Computing unit, for attacking according to the minimum number of preset characters, identification needed for identifying aggressivity message
Most numbers of preset characters and default suffix lengths, calculating character number needed for property message;
4th closing unit, for if add after the first count value of described enumerator more than described character
Number, then close described enumerator and to arrange the first flag bit of described enumerator be 0.
In conjunction with the 8th kind of possible implementation of second aspect, possible the tenth kind of above-mentioned second aspect
In implementation, described second arranges module also includes:
5th closing unit, for if add after described enumerator the second count value more than preset suffix
Length, then close described enumerator and to arrange the first flag bit of described enumerator be 0.
In conjunction with the 6th kind of possible implementation of first aspect to the tenth kind of possible realization side of first aspect
The implementation that any one in formula is possible, in the 11st kind of possible implementation of above-mentioned first aspect,
Described determine that module includes:
5th acquiring unit, for obtaining the current state of described DFA;
6th acquiring unit, if the current state for the described DFA of described 5th acquiring unit acquisition is
Suffix accepts state, then obtain the character being currently entered position in described message, and be currently entered described
Character position in described message be defined as suffix position;
Second determines unit, by accept with the prefix arranged according to the suffix position obtained state corresponding based on
Number device, determines that described message is aggressivity message, otherwise, it is determined that described message is non-attacking message.
The third aspect, it is provided that a kind of device identifying aggressivity message, described device includes memorizer and place
Reason device, for performing a kind of described method identifying aggressivity message.
In embodiments of the present invention, receiving message, the character included by this message is input in DFA one by one,
When the current state of this DFA be prefix accept state time, for this prefix accept state arrange correspondence an initial value be
The enumerator of default value;Now, the character continuing to include this message is input in DFA, simultaneously one by one
Will enter into the character in DFA and be input to character judgement unit, set according to the output result of character judgement unit
Count this enumerator;When the current state of this DFA be suffix accept state time, the prefix according to having arranged accepts state
Corresponding enumerator determines whether this message is aggressivity message, so, utilizes a DFA coupling to preset
Matched rule, decreases resource consumption, reduces memory space, and improves identification aggressivity message
Speed.
Accompanying drawing explanation
For the technical scheme being illustrated more clearly that in the embodiment of the present invention, institute in embodiment being described below
The accompanying drawing used is needed to be briefly described, it should be apparent that, the accompanying drawing in describing below is only the present invention
Some embodiments, for those of ordinary skill in the art, on the premise of not paying creative work,
Other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is a kind of method flow diagram identifying aggressivity message that the embodiment of the present invention one provides;
Fig. 2 is a kind of method flow diagram identifying aggressivity message that the embodiment of the present invention two provides;
Fig. 3 is a kind of apparatus structure schematic diagram identifying aggressivity message that the embodiment of the present invention three provides;
Fig. 4 is a kind of apparatus structure schematic diagram identifying aggressivity message that the embodiment of the present invention four provides;
Fig. 5 is a kind of apparatus structure schematic diagram identifying aggressivity message that the embodiment of the present invention five provides.
Detailed description of the invention
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to the present invention
Embodiment is described in further detail.
Embodiment one
Embodiments providing a kind of method identifying aggressivity message, see Fig. 1, the method includes:
Step 101: receive message, and the character included by this message is input to train out report system one by one
In DFA;
Step 102: obtain the current state of this DFA, when the current state of this DFA be prefix accept state time,
Accept state arranging a corresponding initial value for this prefix is the enumerator of default value;
Step 103: continue to be input in this DFA the character that this message includes, will enter into this DFA simultaneously
In character be input to character judgement unit, character judgement unit for judge input character whether be default
Character;
Step 104: this enumerator is set according to the output result of character judgement unit;
Step 105: obtain the current state of this DFA, if the current state of this DFA is suffix accepts state,
Then accept, according to the prefix arranged, the enumerator that state is corresponding, determine whether this message is aggressivity message.
In embodiments of the present invention, receiving message, the character included by this message is input in DFA one by one,
When the current state of this DFA be prefix accept state time, for this prefix accept state arrange correspondence an initial value be
The enumerator of default value;Now, the character continuing to include this message is input in DFA, simultaneously one by one
Will enter into the character in DFA and be input to character judgement unit, set according to the output result of character judgement unit
Count this enumerator;When the current state of this DFA be suffix accept state time, the prefix according to having arranged accepts state
Corresponding enumerator determines whether this message is aggressivity message, so, utilizes a DFA coupling to preset
Matched rule, decreases resource consumption, reduces memory space, and improves identification aggressivity message
Speed.
Embodiment two
Embodiments providing a kind of method identifying aggressivity message, see Fig. 2, the method includes:
Step 201: receive message, and the character included by this message is input in DFA one by one;
Specifically, message, from the beginning of the first character that this message includes, the word included by this message are received
Symbol is input in DFA one by one.
Wherein, when DFA receives a character, this DFA carries out state jumping according to the default rule that redirects
Turn.
Wherein, DFA includes that 2 accept state in the present embodiment, and i.e. prefix accepts state and suffix accepts state,
When DFA jump to prefix accept state time, then show receive message in exist with preset matching rule prefix
The character string that character string is identical, when DFA jump to suffix accept state time, then show receive message in exist
The character string identical with the character string of preset matching rule, i.e. this message is aggressivity message.
Wherein, preset matching rule includes prefix character string, default value preset characters and suffix character string,
The a length of default suffix lengths of this suffix character string.
Step 202: obtain the current state of this DFA, when the current state of this DFA be prefix accept state time,
Accept state arranging a corresponding initial value for this prefix is the enumerator of default value;
Specifically, this enumerator includes the first flag bit and the second flag bit, and the first flag bit is used for this is described
Whether enumerator is running, and the second flag bit is for illustrating whether the count value of this enumerator is kept to zero;Obtain
The current state of this DFA, when the current state of this DFA be prefix accept state time, obtain an idle meter
Number device, and start this enumerator;The first flag bit arranging this enumerator is 1, the first flag bit be 1 for
Illustrating that this enumerator is currently running, the second flag bit arranging this enumerator is 0, the second flag bit be 0 for
Illustrate that the count value of this enumerator is not kept to zero, and the initial value arranging this enumerator is default value.
Wherein, it is also possible to the initial value of the count value of this enumerator is set to 0.
Wherein, when this DFA jump to prefix accept state time, terminal will accept state for this prefix and arrange one
Enumerator, if this DFA jumps to prefix when accepting state, does not has the enumerator of free time, then exports in terminal
One information, carries the character being currently inputted in DFA position in this message in this information,
And this information exhausts for explanation enumerator during character match, cause and cannot start new counting
Device, and there is the character of leakage coupling.
Wherein, in embodiments of the present invention, only need character judgement unit that the character received is judged, root
According to the value of the result refresh counter of this character judgement unit output, so, it is not necessary to store this message and include
Default value character, save memory space.
Step 203: continue to be input in this DFA the character that this message includes, will enter into this DFA simultaneously
In character be input to character judgement unit, character judgement unit for judge input character whether be default
Character;
Wherein, will enter into the character in this DFA and be input to character judgement unit one by one, this character differentiates single
Character and the preset characters of input are compared by unit one by one, it is judged that whether the character of input is preset characters.
Step 204: if the character that the output result of character judgement unit is input is preset characters and this counting
Second flag bit of device is 0, then reduce the count value of this enumerator;
Specifically, character and the preset characters of reception are compared by character judgement unit, if the word received
According with identical with preset characters and this enumerator the second flag bit is 0, then the count value of this enumerator is reduced 1.
Step 205: if the count value of this enumerator is zero after Jian Shaoing, then arrange the second mark of this enumerator
Position is 1;
Wherein, the second flag bit of this enumerator is set to 1 and shows this message exists default value word
Symbol.
Step 206: if the character that the output result of character judgement unit is input is not preset characters and this meter
Second flag bit of number devices is 0, then close this enumerator and to arrange the first flag bit of this enumerator be 0, the
One flag bit 0 is turned off this enumerator for explanation;
Specifically, the character and the preset characters that are received by character judgement unit compare, if character differentiates
The output result of unit be input character be not preset characters, then judge that the second flag bit of this enumerator is
No is 0, if this second flag bit is 0, then closes this enumerator and arranges the first flag bit of this enumerator
Being 0, the first flag bit 0 is turned off this enumerator for explanation.
Wherein, close this enumerator and to arrange the first flag bit of this enumerator be 0, show in coupling present count
During value character, occur in that in the character different from preset characters, i.e. this message and there is not continuous print present count
Value preset characters, so closing this enumerator.
Step 207: if the second flag bit of this enumerator is 1, then increase the count value of this enumerator;
Specifically, if the second flag bit of this enumerator is 1, then the count value of this enumerator is increased by 1.
Wherein, in this step the result of no matter character judgement unit output be the character of input be preset characters also
Be the character of input not for preset characters, as long as the second flag bit of this enumerator is 1, then by this enumerator
Count value increases by 1, so the character that can will enter in DFA in this step is input to character judgement unit,
The character in DFA can not also be will enter into and be input to character judgement unit.
Wherein, the count value of the enumerator that the second flag bit is 1 is increased by 1, show the message received exists
Default value preset characters, now increases the count value of this enumerator to mate preset matching rule
Suffix character string.
Step 208: if add after enumerator count value more than preset suffix lengths, then close this counting
Device and the first flag bit arranging this enumerator are 0;
Specifically, count value and the default suffix lengths of the enumerator after increasing compare, if increased
After the count value of enumerator more than presetting suffix lengths, then close this enumerator and the of this enumerator be set
One flag bit is 0.
Wherein, when the count value of the enumerator that the second flag bit is 1 is for presetting suffix lengths, this DFA is obtained
Current state, if the current state of this DFA is non-suffix accepts state, the most now can close this counting
Device and the first flag bit arranging this enumerator are 0, it is also possible to do not close this enumerator, when the second flag bit is
The count value of the enumerator of 1, more than when presetting suffix lengths, closes this enumerator.
Step 209: obtain the current state of this DFA, if the current state of this DFA is suffix accepts state,
Then accept, according to the prefix arranged, the enumerator that state is corresponding, determine whether this message is aggressivity message.
Specifically, obtain the current state of this DFA, if the current state of this DFA is suffix accepts state,
Then judge the prefix arranged to accept in the enumerator that state is corresponding whether there is the second flag bit is 1 and count value
Reach to preset the enumerator of suffix lengths, if the second flag bit is 1 and count value reaches to preset suffix lengths
Enumerator, it is determined that this message is aggressivity message, otherwise, it is determined that this message is not aggressivity message.
Wherein, it is, after prefix accepts state, the character that this message includes to be continued with when the current state of DFA
To this DFA, will enter into the character in DFA simultaneously and be input to character judgement unit, now DFA and word
Symbol judgement unit is carried out simultaneously, so, saves the time, improves the efficiency identifying aggressivity message.
In embodiments of the present invention, receiving message, the character included by this message is input in DFA one by one,
When the current state of this DFA be prefix accept state time, for this prefix accept state arrange correspondence an initial value be
The enumerator of default value;Now, the character continuing to include this message is input in DFA, simultaneously one by one
Will enter into the character in DFA and be input to character judgement unit, set according to the output result of character judgement unit
Count this enumerator;When the current state of this DFA be suffix accept state time, the prefix according to having arranged accepts state
Corresponding enumerator determines whether this message is aggressivity message, so, utilizes a DFA coupling to preset
Matched rule, decreases resource consumption, reduces memory space, and improves identification aggressivity message
Speed.
Embodiment three
Embodiments providing a kind of method identifying aggressivity message, see Fig. 3, the method includes:
Step 301: receive message, and the character included by this message is input in DFA one by one;
Specifically, message, from the beginning of the first character that this message includes, the word included by this message are received
Symbol is input in DFA one by one.
Wherein, when DFA receives a character, this DFA carries out state jumping according to the default rule that redirects
Turn.
Wherein, DFA includes that 2 accept state in the present embodiment, and i.e. prefix accepts state and suffix accepts state,
When DFA jump to prefix accept state time, then show receive message in exist with preset matching rule prefix
The character string that character string is identical, when DFA jump to suffix accept state time, then show receive message in exist
The character string identical with the character string of preset matching rule, i.e. this message is aggressivity message.
Wherein, preset matching rule includes prefix character string, preset characters, preset range and suffix character string,
The lower limit of this preset range is to identify the minimum number of preset characters needed for aggressivity message, this preset range
The upper limit is to identify most numbers of preset characters needed for aggressivity message, wherein, in this preset matching rule,
The number of preset characters only need to be the most permissible within this preset range, so, is equivalent to preset matching rule
Extended, such as in preset matching rule
Basic s* x20 [a-zA-Z0-9 x2b x2f] in 1300-2000}end, and prefix character string be Basic s* x20,
Preset characters is [a-zA-Z0-9 x2b x2f], preset range be 1300-2000}, suffix character string is end,
When receive message and preset matching rule prefix Basic s* x20 coupling time, the state transition of this DFA
State is accepted, when the message received and whole piece preset matching rule to prefix
Basic s* x20 [a-zA-Z0-9 x2b x2f] { during 1300-2000}end coupling, after the state transition of this DFA arrives
Sew and accept state.
Step 302: obtain the current state of this DFA, when the current state of this DFA be prefix accept state time,
Accept state arranging an initial value of correspondence for this prefix is to identify needed for aggressivity message minimum of preset characters
The enumerator of number;
Specifically, this enumerator includes the first flag bit, the second flag bit, the first count value, the second counting
Value and prefix position, the first flag bit is used for illustrating whether this enumerator is running, and the second flag bit is used for
Whether the count value of this enumerator bright is kept to zero;Prefix position makes this DFA jump to prefix acceptance for record
The character of state position in this message;Obtain the current state of this DFA, when the current state of this DFA is
When prefix accepts state, obtain an idle enumerator, and start this enumerator;Arrange the of this enumerator
One flag bit is 1, and the first flag bit is 1 for illustrating that this enumerator is currently running, and arranges the of this enumerator
Two flag bits are 0, and the second flag bit is 0 for illustrating that the count value of this enumerator is not kept to zero, and arranging should
The initial value of the first count value of enumerator is to identify the minimum number of preset characters needed for aggressivity message, arranges
The initial value of the second count value of this enumerator is 0, and obtains the character being currently entered position in this message
Putting, the prefix bit arranging this enumerator is set to the character being currently entered of acquisition position in this message.
Wherein, when this DFA jump to prefix accept state time, terminal will accept state for this prefix and arrange one
Enumerator, if this DFA jumps to prefix when accepting state, does not has the enumerator of free time, then exports in terminal
One information, carries the character being currently inputted in DFA position in this message in this information,
And this information exhausts for explanation enumerator during character match, cause and cannot start new counting
Device, and there is the character of leakage coupling.
Wherein, in embodiments of the present invention, only need character judgement unit that the character received is judged, root
According to the value of the result refresh counter of this character judgement unit output, so, it is not necessary to store this message and include
Identify minimum number the character of preset characters needed for aggressivity message, save memory space.
Step 303: continue to be input in this DFA the character that this message includes, will enter into this DFA simultaneously
In character be input to character judgement unit, character judgement unit for judge input character whether be default
Character;
Wherein, will enter into the character in this DFA and be input to character judgement unit one by one, this character differentiates single
Character and the preset characters of input are compared by unit one by one, it is judged that whether the character of input is preset characters.
Step 304: if the character that the output result of character judgement unit is input is preset characters and this counting
Second flag bit of device is 0, then reduce the first count value of this enumerator;
Specifically, character and the preset characters of reception are compared by character judgement unit, if the word received
According with identical with preset characters and this enumerator the second flag bit is 0, then the first count value of this enumerator subtracted
Few 1.
Step 305: if the count value of this enumerator is zero after Jian Shaoing, then arrange the second mark of this enumerator
Position is 1;
Wherein, the second flag bit of this enumerator is set to 1 show this message exists to identify aggressivity report
Minimum number the character of the required preset characters of literary composition.
Step 306: if the character that the output result of character judgement unit is input is not preset characters and this meter
Second flag bit of number devices is 0, then close this enumerator and to arrange the first flag bit of this enumerator be 0, the
One flag bit 0 is turned off this enumerator for explanation;
Specifically, the character and the preset characters that are received by character judgement unit compare, if character differentiates
The output result of unit be input character be not preset characters, then judge that the second flag bit of this enumerator is
No is 0, if this second flag bit is 0, then closes this enumerator and arranges the first flag bit of this enumerator
Being 0, the first flag bit 0 is turned off this enumerator for explanation.
Wherein, close this enumerator and to arrange the first flag bit of this enumerator be 0, show to attack at match cognization
Needed for hitting property message during minimum number the character of preset characters, occur in that the character different from preset characters,
This message does not i.e. exist minimum number the predetermined word of preset characters needed for continuous print identification aggressivity message
Symbol, so closing this enumerator.
Step 307: if the character that the output result of character judgement unit is input is preset characters and this counting
Second flag bit of device is 1 and the second count value of this enumerator is 0, then increase the first meter of this enumerator
Numerical value;
Specifically, the character and the preset characters that are received by character judgement unit compare, if character differentiates
The output result of unit is that second flag bit that character is preset characters and this enumerator of input is 1 and is somebody's turn to do
Second count value of enumerator is 0, then the first count value of this enumerator is increased by 1.
Step 308: according to the first count value of this enumerator after increasing, it may be judged whether close this enumerator;
Specifically, this step can be divided into (1) and the step of (2) as follows, including:
(1), according to the minimum number of preset characters, identification aggressivity message institute needed for identification aggressivity message
Need most numbers of preset characters and default suffix lengths, calculating character number;
Specifically, according to the minimum number of preset characters, identification aggressivity message needed for identification aggressivity message
Most numbers of required preset characters and default suffix lengths, according to equation below (1) calculating character number;
K=n-m+len (1)
Wherein, in formula (1), k is character number, and n is preset characters needed for identification aggressivity message
Minimum number, m is to identify most numbers of preset characters needed for aggressivity message, and len is long for presetting suffix
Degree.
(2), if add after the first count value of enumerator more than character number, then close this enumerator
And the first flag bit arranging this enumerator is 0.
Specifically, the first count value and the character number of this enumerator after increasing compare, if increased
First count value of this enumerator after adding is more than character number, then close this enumerator and arrange this enumerator
The first flag bit be 0,
Wherein, if the first count value of this enumerator is less than or equal to this character number, then show the most defeated
The character entered does not mates with the suffix character in preset matching rule.
Step 309: if the character that the output result of character judgement unit is input is preset characters and this counting
Second flag bit of device is 1 and the second count value of this enumerator is not 0, then increase the second of this enumerator
Count value;
Specifically, the character and the preset characters that are received by character judgement unit compare, if character differentiates
The output result of unit is that second flag bit that character is preset characters and this enumerator of input is 1 and is somebody's turn to do
Second count value of enumerator is not 0, then the second count value of this enumerator is increased by 1.
Step 310: if add after this enumerator the second count value more than preset suffix lengths, then close
This enumerator and the first flag bit arranging this enumerator are 0;
Wherein, when the count value of the enumerator that the second flag bit is 1 is for presetting suffix lengths, this DFA is obtained
Current state, if the current state of this DFA is non-suffix accepts state, the most now can close this counting
Device and the first flag bit arranging this enumerator are 0, it is also possible to do not close this enumerator, when the second flag bit is
The count value of the enumerator of 1, more than when presetting suffix lengths, closes this enumerator.
Step 311: if the character that the output result of character judgement unit is input is not preset characters and this meter
Second flag bit of number device is 1, then increase the second count value of this enumerator;
Specifically, if the character that the output result of character judgement unit is input is not preset characters and this meter
Second flag bit of number device is 1, then the second count value of this enumerator is increased by 1.
Wherein, the count value of the enumerator that the second flag bit is 1 is increased by 1, show the message received exists
Needed for identification aggressivity message, minimum number the preset characters of preset characters, now increases the meter of this enumerator
Numerical value is the suffix character string in order to mate preset matching rule.
Step 312: if add after this enumerator the second count value more than preset suffix lengths, then close
This enumerator and the first flag bit arranging this enumerator are 0;
Wherein, when the count value of the enumerator that the second flag bit is 1 is for presetting suffix lengths, this DFA is obtained
Current state, if the current state of this DFA is non-suffix accepts state, the most now can close this counting
Device and the first flag bit arranging this enumerator are 0, it is also possible to do not close this enumerator, when the second flag bit is
The count value of the enumerator of 1, more than when presetting suffix lengths, closes this enumerator.
Step 313: obtain the current state of this DFA, if the current state of this DFA is suffix accepts state,
Then accept, according to the prefix arranged, the enumerator that state is corresponding, determine whether this message is aggressivity message.
Specifically, this step can be divided into the step of (1)-(2) as follows, including:
(1), obtain DFA current state, if the current state of DFA is suffix accepts state, then obtain
The character being currently entered position in this message, and by true for the character that the is currently entered position in this message
It is set to suffix position;
(2), accept, with the prefix arranged, the enumerator that state is corresponding according to suffix position, determine that this message is
No for aggressivity message.
Specifically, accept what enumerator corresponding to state included according to the suffix position obtained with the prefix arranged
Prefix position and the first count value, it is judged that the prefix arranged accepts whether to have in the enumerator that state is corresponding
One count value meets the enumerator of following inequality (2), meets inequality (2) if there is the first count value
Enumerator, it is determined that this message is aggressivity message, otherwise, it is determined that this message is not aggressivity message,
Offset1+m≤offset2-len≤offset1+value1+m (2)
Wherein, in inequality (2), offset1 is that the enumerator that the prefix arranged accepts state corresponding includes
Prefix position, offset2 is suffix position, and value1 is the enumerator that the prefix arranged accepts that state is corresponding
The first count value.
Wherein, it is, after prefix accepts state, the character that this message includes to be continued with when the current state of DFA
To this DFA, will enter into the character in DFA simultaneously and be input to character judgement unit, now DFA and word
Symbol judgement unit is carried out simultaneously, so, saves the time, improves the efficiency identifying aggressivity message.
In embodiments of the present invention, receiving message, the character included by this message is input in DFA one by one,
When the current state of this DFA be prefix accept state time, for this prefix accept state arrange correspondence an initial value be
The enumerator of default value;Now, the character continuing to include this message is input in DFA, simultaneously one by one
Will enter into the character in DFA and be input to character judgement unit, set according to the output result of character judgement unit
Count this enumerator;When the current state of this DFA be suffix accept state time, the prefix according to having arranged accepts state
Corresponding enumerator determines whether this message is aggressivity message, so, utilizes a DFA coupling to preset
Matched rule, decreases resource consumption, reduces memory space, and improves identification aggressivity message
Speed.
Embodiment four
Embodiments providing a kind of device identifying aggressivity message, see Fig. 4, this device includes:
Receiver module 401, is used for receiving message, and the character included by this message having of being input to one by one to determine
In limit automat DFA;
First arranges module 402, for obtaining the current state of this DFA, when the current state of this DFA is
When prefix accepts state, accept state arranging a corresponding initial value for this prefix is the enumerator of default value;
Input module 403, is input to this for continuation by the character that the message that receiver module 401 receives includes
In DFA, will enter into the character in this DFA simultaneously and be input to character judgement unit, character judgement unit is used
Whether it is preset characters in judging the character inputted;
Second arranges module 404, for arranging this enumerator according to the output result of character judgement unit;
Determine module 405, for obtaining the current state of this DFA, if after the current state of this DFA is
Sew and accept state, then accept, according to the prefix arranged, the enumerator that state is corresponding, determine whether this message is attack
Property message.
Wherein, this enumerator includes the first flag bit and the second flag bit, and the first flag bit is by illustrating based on this
Whether number device is running, and the second flag bit is for illustrating whether the count value of this enumerator is kept to zero;
Correspondingly, first module 402 be set include:
First acquiring unit, for obtaining the current state of this DFA;
First arranges unit, and the current state of this DFA for obtaining when the first acquiring unit is that prefix accepts
During state, arranging the first flag bit is 1, and the first flag bit is 1 for illustrating that this enumerator is currently running, and arranges
Second flag bit is 0, and the second flag bit is 0 for illustrating that the count value of this enumerator is not kept to zero, and
The initial value arranging this enumerator is default value.
Wherein, second module 404 be set include:
First reduces unit, if the character that output result is input for character judgement unit is predetermined word
Second flag bit of symbol and this enumerator is 0, then reduce the count value of this enumerator;
First closing unit, if the character that output result is input for character judgement unit is not default
Second flag bit of character and this enumerator is 0, then close this enumerator and arrange the first mark of this enumerator
Position is 0, and the first flag bit 0 is turned off this enumerator for explanation;
First increases unit, if the second flag bit for this enumerator is 1, then increases the meter of this enumerator
Numerical value.
Further, second module 404 be set also include:
Second arranges unit, if the count value of this enumerator after reducing is zero, then arranges this counting
Second flag bit of device is 1.
Further, second module 404 be set also include:
Second closing unit, for if add after this enumerator count value more than preset suffix lengths,
Then close this enumerator and to arrange the first flag bit of this enumerator be 0.
Wherein it is determined that module 405 includes:
Second acquisition unit, for obtaining the current state of this DFA;
First determines unit, if the current state for this DFA of second acquisition unit acquisition is that suffix connects
By state, then judge the prefix arranged to accept in the enumerator that state is corresponding whether to exist the second flag bit be 1 and
This count value reaches to preset the enumerator of suffix lengths, if it is, determine that this message is aggressivity message,
Otherwise, it is determined that this message is non-attacking message.
Wherein, this enumerator includes the first flag bit, the second flag bit, the first count value, the second count value
With prefix position,
Correspondingly, first module 402 be set include:
3rd acquiring unit, for obtaining the current state of this DFA;
4th acquiring unit, for obtaining the character being currently entered position in this message;
3rd arranges unit, and being used for arranging the first flag bit is 1, and arranging the second flag bit is 0, arrange this
One count value is to identify the minimum number of preset characters needed for aggressivity message, and arranging this second count value is 0,
And the character the being currently entered position in this message that this prefix bit is set to obtain is set.
Wherein, second module 404 be set include:
Second reduces unit, if the character that output result is input for character judgement unit is predetermined word
Second flag bit of symbol and this enumerator is 0, then reduce the first count value of this enumerator;
3rd closing unit, if the character that output result is input for character judgement unit is not default
Second flag bit of character and this enumerator is 0, then close this enumerator and arrange the first mark of this enumerator
Position is 0, and the first flag bit 0 is turned off this enumerator for explanation;
Second increases unit, if the second flag bit for this enumerator is 1, then according to character judgement unit
Output result increase the count value of this enumerator.
Further, second module 404 be set include:
3rd increases unit, for judging that whether the output result of character judgement unit is that the character of this input is
Preset characters, and judge whether the second count value of this enumerator is 0, if the output of character judgement unit
Result be input the second count value that character is preset characters and this enumerator be 0, then increase this enumerator
First count value, otherwise, then increases the second count value of this enumerator.
Further, second module 404 be set also include:
Computing unit, for according to the minimum number of preset characters, identification needed for described identification aggressivity message
Most numbers of preset characters and default suffix lengths, calculating character number needed for aggressivity message;
4th closing unit, for if add after the first count value of this enumerator more than described character
Number, then close this enumerator and to arrange the first flag bit of this enumerator be 0.
Further, second module 404 be set also include:
5th closing unit, for if add after this enumerator the second count value more than preset suffix long
Degree, then close this enumerator and to arrange the first flag bit of this enumerator be 0.
Wherein it is determined that module 405 includes:
5th acquiring unit, for obtaining the current state of this DFA;
6th acquiring unit, if the current state for this DFA of the 5th acquiring unit acquisition is that suffix connects
By state, then obtain the character being currently entered position in this message, and by the character that is currently entered at this report
Position in literary composition is defined as suffix position;
Second determines unit, by accept with the prefix arranged according to the suffix position obtained state corresponding based on
Number device, determines whether this message is aggressivity message.
In embodiments of the present invention, receiving message, the character included by this message is input in DFA one by one,
When the current state of this DFA be prefix accept state time, for this prefix accept state arrange correspondence an initial value be
The enumerator of default value;Now, the character continuing to include this message is input in DFA, simultaneously one by one
Will enter into the character in DFA and be input to character judgement unit, set according to the output result of character judgement unit
Count this enumerator;When the current state of this DFA be suffix accept state time, the prefix according to having arranged accepts state
Corresponding enumerator determines whether this message is aggressivity message, so, utilizes a DFA coupling to preset
Matched rule, decreases resource consumption, reduces memory space, and improves identification aggressivity message
Speed.
Embodiment five
Seeing Fig. 5, embodiments provide a kind of device identifying aggressivity message, this device includes:
Memorizer 501 and processor 502, the method for performing to identify aggressivity message as follows:
Receive message, and the character included by described message is input in train out report system DFA one by one;
Obtain the current state of described DFA, when the current state of described DFA be prefix accept state time, for institute
Stating prefix and accept state arranging a corresponding initial value is the enumerator of default value;
Continue to be input in described DFA the character that described message includes, will enter in described DFA simultaneously
Character be input to character judgement unit, whether described character judgement unit for judging the character of described input
For preset characters;
Output result according to described character judgement unit arranges described enumerator;
Obtain the current state of described DFA, if the current state of described DFA is suffix accepts state, then root
Accept, according to the prefix arranged, the enumerator that state is corresponding, determine whether described message is aggressivity message.
Wherein, described enumerator includes that the first flag bit and the second flag bit, described first flag bit are used for
Whether bright described enumerator is running, and whether described second flag bit for illustrating the count value of described enumerator
It is kept to zero;
Correspondingly, described for described prefix accept state arrange correspondence an initial value be the enumerator of default value,
Including:
Arranging described first flag bit is 1, and described first flag bit is 1 for illustrating that described enumerator is transported
OK, arranging described second flag bit is 0, and described second flag bit is 0 for the counting of described enumerator is described
Value is not kept to zero, and the initial value arranging described enumerator is default value.
Wherein, the described output result according to described character judgement unit arranges described enumerator, including:
If the character that output result is described input of described character judgement unit is preset characters and described meter
Second flag bit of number device is 0, then reduce the count value of described enumerator;
If the character that output result is described input of described character judgement unit is not preset characters and described
Second flag bit of enumerator is 0, then close described enumerator and arrange the first flag bit of described enumerator and be
0, described first flag bit 0 is turned off described enumerator for explanation;
If the second flag bit of described enumerator is 1, then increase the count value of described enumerator.
Further, after the count value of the described enumerator of described minimizing, also include:
If the count value of the described enumerator after Jian Shaoing is zero, then the second flag bit of described enumerator is set
It is 1.
Further, after the count value of the described enumerator of described increase, also include:
If add after described enumerator count value more than preset suffix lengths, then close described enumerator
And the first flag bit arranging described enumerator is 0.
Wherein, the prefix that described basis has been arranged accepts the enumerator that state is corresponding, determines that whether described message is
Aggressivity message, including:
Judge the prefix that arranged accept whether the enumerator that state is corresponding exists described second flag bit be 1 and
Described count value reaches to preset the enumerator of suffix lengths, if it is, determine that described message is aggressivity report
Literary composition, otherwise, it is determined that described message is non-attacking message.
Wherein, described enumerator includes the first flag bit, the second flag bit, the first count value, the second counting
Value and prefix position,
Correspondingly, described for described prefix accept state arrange correspondence an initial value be the enumerator of default value,
Including:
Obtain the character being currently entered position in described message;
Arranging described first flag bit is 1, and arranging described second flag bit is 0, arranges described first count value
For the minimum number of preset characters needed for identification aggressivity message, arranging described second count value is 0, Yi Jishe
Put described prefix bit and be set to the character being currently entered of acquisition position in described message.
Wherein, the described output result according to described character judgement unit arranges described enumerator, including:
If the character that output result is described input of described character judgement unit is preset characters and described meter
Second flag bit of number device is 0, then reduce the first count value of described enumerator;
If the character that output result is described input of described character judgement unit is not preset characters and described
Second flag bit of enumerator is 0, then close described enumerator and arrange the first flag bit of described enumerator and be
0, described first flag bit 0 is turned off described enumerator for explanation;
If the second flag bit of described enumerator is 1, then increase according to the output result of described character judgement unit
Add the count value of described enumerator.
Wherein, the described output result according to described character judgement unit increases the count value of described enumerator,
Including:
Judge the output result of described character judgement unit be whether the character of described input be preset characters, with
And judge whether the second count value of described enumerator is 0, if the output result of described character judgement unit is
The character of described input be the second count value of preset characters and described enumerator be 0, then increase described enumerator
The first count value, otherwise, then increase the second count value of described enumerator.
Further, after the first count value of the described enumerator of described increase, also include:
Needed for the minimum number of preset characters, identification aggressivity message needed for described identification aggressivity message
Most numbers of preset characters and default suffix lengths, calculating character number;
If add after the first count value of described enumerator more than described character number, then close described meter
Number device and the first flag bit arranging described enumerator are 0.
Further, after the second count value of the described enumerator of described increase, also include:
If add after described enumerator the second count value more than preset suffix lengths, then close described meter
Number device and the first flag bit arranging described enumerator are 0.
Wherein, the prefix that described basis has been arranged accepts the enumerator that state is corresponding, determines that whether described message is
Aggressivity message, including:
Obtain the character being currently entered position in described message, and by the described character being currently entered in institute
State the position in message and be defined as suffix position;
Suffix position according to obtaining accepts, with the prefix arranged, the enumerator that state is corresponding, determines described message
Whether it is aggressivity message.
In embodiments of the present invention, receiving message, the character included by this message is input in DFA one by one,
When the current state of this DFA be prefix accept state time, for this prefix accept state arrange correspondence an initial value be
The enumerator of default value;Now, the character continuing to include this message is input in DFA, simultaneously one by one
Will enter into the character in DFA and be input to character judgement unit, set according to the output result of character judgement unit
Count this enumerator;When the current state of this DFA be suffix accept state time, the prefix according to having arranged accepts state
Corresponding enumerator determines whether this message is aggressivity message, so, utilizes a DFA coupling to preset
Matched rule, decreases resource consumption, reduces memory space, and improves identification aggressivity message
Speed.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can be passed through
Hardware completes, it is also possible to instructing relevant hardware by program and complete, described program can be stored in
In a kind of computer-readable recording medium, storage medium mentioned above can be read only memory, disk or
CD etc..
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all the present invention's
Within spirit and principle, any modification, equivalent substitution and improvement etc. made, should be included in the present invention's
Within protection domain.
Claims (25)
1. the method identifying aggressivity message, it is characterised in that described method includes:
Receive message, and the character included by described message is input in train out report system DFA one by one;
Obtain the current state of described DFA, when the current state of described DFA be prefix accept state time, for institute
Stating prefix and accept state arranging a corresponding initial value is the enumerator of default value;
Continue to be input in described DFA the character that described message includes, will enter in described DFA simultaneously
Character be input to character judgement unit, whether described character judgement unit for judging the character of described input
For preset characters;
Output result according to described character judgement unit arranges described enumerator;
Obtain the current state of described DFA, if the current state of described DFA is suffix accepts state, then root
Accept, according to the prefix arranged, the enumerator that state is corresponding, determine whether described message is aggressivity message.
Method the most according to claim 1, it is characterised in that described enumerator includes the first flag bit
With the second flag bit, described first flag bit is used for illustrating whether described enumerator is running, described second mark
Will position is for illustrating whether the count value of described enumerator is kept to zero;
Correspondingly, described for described prefix accept state arrange correspondence an initial value be the enumerator of default value,
Including:
Arranging described first flag bit is 1, and described first flag bit is 1 for illustrating that described enumerator is transported
OK, arranging described second flag bit is 0, and described second flag bit is 0 for the counting of described enumerator is described
Value is not kept to zero, and the initial value arranging described enumerator is default value.
Method the most according to claim 2, it is characterised in that described according to described character judgement unit
Output result described enumerator is set, including:
If the character that output result is described input of described character judgement unit is preset characters and described meter
Second flag bit of number device is 0, then reduce the count value of described enumerator;
If the character that output result is described input of described character judgement unit is not preset characters and described
Second flag bit of enumerator is 0, then close described enumerator and arrange the first flag bit of described enumerator and be
0, described first flag bit 0 is turned off described enumerator for explanation;
If the second flag bit of described enumerator is 1, then increase the count value of described enumerator.
Method the most according to claim 3, it is characterised in that the counting of the described enumerator of described minimizing
After value, also include:
If the count value of the described enumerator after Jian Shaoing is zero, then the second flag bit of described enumerator is set
It is 1.
Method the most according to claim 3, it is characterised in that the counting of the described enumerator of described increase
After value, also include:
If add after described enumerator count value more than preset suffix lengths, then close described enumerator
And the first flag bit arranging described enumerator is 0.
6. according to the method described in claim 2 to 5 any claim, it is characterised in that described basis
The prefix arranged accepts the enumerator that state is corresponding, determines whether described message is aggressivity message, including:
Judge the prefix that arranged accept whether the enumerator that state is corresponding exists described second flag bit be 1 and
Described count value reaches to preset the enumerator of suffix lengths, if it is, determine that described message is aggressivity report
Literary composition, otherwise, it is determined that described message is non-attacking message.
Method the most according to claim 1, it is characterised in that described enumerator include the first flag bit,
Second flag bit, the first count value, the second count value and prefix position,
Correspondingly, described for described prefix accept state arrange correspondence an initial value be the enumerator of default value,
Including:
Obtain the character being currently entered position in described message;
Arranging described first flag bit is 1, and arranging described second flag bit is 0, arranges described first count value
Initial value be to identify the minimum number of preset characters needed for aggressivity message, arrange at the beginning of described second count value
Value is 0, and arranges the character the being currently entered position in described message that described prefix bit is set to obtain.
Method the most according to claim 7, it is characterised in that described according to described character judgement unit
Output result described enumerator is set, including:
If the character that output result is described input of described character judgement unit is preset characters and described meter
Second flag bit of number device is 0, then reduce the first count value of described enumerator;
If the character that output result is described input of described character judgement unit is not preset characters and described
Second flag bit of enumerator is 0, then close described enumerator and arrange the first flag bit of described enumerator and be
0, described first flag bit 0 is turned off described enumerator for explanation;
If the second flag bit of described enumerator is 1, then increase according to the output result of described character judgement unit
Add the count value of described enumerator.
Method the most according to claim 8, it is characterised in that described according to described character judgement unit
Output result increase described enumerator count value, including:
Judge the output result of described character judgement unit be whether the character of described input be preset characters, with
And judge whether the second count value of described enumerator is 0, if the output result of described character judgement unit is
The character of described input be the second count value of preset characters and described enumerator be 0, then increase described enumerator
The first count value, otherwise, then increase the second count value of described enumerator.
Method the most according to claim 9, it is characterised in that the of the described enumerator of described increase
After one count value, also include:
Preset needed for the minimum number of preset characters, identification aggressivity message according to needed for identifying aggressivity message
Most numbers of character and default suffix lengths, calculating character number;
If add after the first count value of described enumerator more than described character number, then close described meter
Number device and the first flag bit arranging described enumerator are 0.
11. methods according to claim 9, it is characterised in that the of the described enumerator of described increase
After two count values, also include:
If add after described enumerator the second count value more than preset suffix lengths, then close described meter
Number device and the first flag bit arranging described enumerator are 0.
12. according to the method described in claim 7 to 11 any claim, it is characterised in that described
Accept, according to the prefix arranged, the enumerator that state is corresponding, determine whether described message is aggressivity message, including:
Obtain the character being currently entered position in described message, and by the described character being currently entered in institute
State the position in message and be defined as suffix position;
Suffix position according to obtaining accepts, with the prefix arranged, the enumerator that state is corresponding, determines described message
Whether it is aggressivity message.
13. 1 kinds of devices identifying aggressivity message, it is characterised in that described device includes:
Receiver module, is used for receiving message, and the character included by described message having of being input to one by one to determine
In limit automat DFA;
First arranges module, for obtaining the current state of described DFA, when the current state of described DFA is
When prefix accepts state, accept state arranging a corresponding initial value for described prefix is the enumerator of default value;
Input module, is input to described for continuation by the character that the message that described receiver module receives includes
In DFA, will enter into the character in described DFA simultaneously and be input to character judgement unit, described character differentiates
Whether unit is preset characters for judging the character of described input;
Second arranges module, for arranging described enumerator according to the output result of described character judgement unit;
Determine module, for obtaining the current state of described DFA, if after the current state of described DFA is
Sew and accept state, then accept, according to the prefix arranged, the enumerator that state is corresponding, determine that whether described message is for attacking
Hitting property message.
14. devices according to claim 13, it is characterised in that described enumerator includes the first mark
Position and the second flag bit, described first flag bit is used for illustrating whether described enumerator is running, described second
Flag bit is for illustrating whether the count value of described enumerator is kept to zero;
Correspondingly, described first module be set include:
First acquiring unit, for obtaining the current state of described DFA;
First arranges unit, and the current state of the described DFA for obtaining when described first acquiring unit is front
Sewing when accepting state, arranging described first flag bit is 1, and described first flag bit is 1 for described counting is described
Device is currently running, and arranging described second flag bit is 0, and described second flag bit is 0 for described counting is described
The count value of device is not kept to zero, and the initial value arranging described enumerator is default value.
15. devices according to claim 14, it is characterised in that described second arranges module includes:
First reduces unit, if for the character that output result is described input of described character judgement unit
The second flag bit for preset characters and described enumerator is 0, then reduce the count value of described enumerator;
First closing unit, if for the character that output result is described input of described character judgement unit
Be not the second flag bit of preset characters and described enumerator be 0, then close described enumerator and described meter be set
First flag bit of number device is 0, and described first flag bit 0 is turned off described enumerator for explanation;
First increases unit, if the second flag bit for described enumerator is 1, then increases described enumerator
Count value.
16. devices according to claim 15, it is characterised in that described second arranges module also includes:
Second arranges unit, if the count value of the described enumerator after reducing is zero, then arranges described
Second flag bit of enumerator is 1.
17. devices according to claim 15, it is characterised in that described second arranges module also includes:
Second closing unit, for if add after described enumerator count value more than preset suffix lengths,
Then close described enumerator and to arrange the first flag bit of described enumerator be 0.
18. according to the device described in claim 14 to 17 any claim, it is characterised in that described
Determine that module includes:
Second acquisition unit, for obtaining the current state of described DFA;
First determines unit, if the current state for the described DFA of described second acquisition unit acquisition is
Suffix accepts state, then judge the prefix arranged to accept in the enumerator that state is corresponding and whether there is described second mark
Will position is 1 and described count value reaches to preset the enumerator of suffix lengths, if it is, determine described message
It is aggressivity message, otherwise, it is determined that described message is non-attacking message.
19. devices according to claim 13, it is characterised in that described enumerator includes the first mark
Position, the second flag bit, the first count value, the second count value and prefix position,
Correspondingly, described first module be set include:
3rd acquiring unit, for obtaining the current state of described DFA;
4th acquiring unit, for obtaining the character being currently entered position in described message;
3rd arranges unit, and being used for arranging described first flag bit is 1, and arranging described second flag bit is 0,
Arranging described first count value is to identify the minimum number of preset characters needed for aggressivity message, arranges described the
Two count values are 0, and arrange described prefix bit be set to obtain the character being currently entered in described message
Position.
20. devices according to claim 19, it is characterised in that described second arranges module includes:
Second reduces unit, if for the character that output result is described input of described character judgement unit
The second flag bit for preset characters and described enumerator is 0, then reduce the first count value of described enumerator;
3rd closing unit, if for the character that output result is described input of described character judgement unit
Be not the second flag bit of preset characters and described enumerator be 0, then close described enumerator and described meter be set
First flag bit of number device is 0, and described first flag bit 0 is turned off described enumerator for explanation;
Second increases unit, if the second flag bit for described enumerator is 1, then sentences according to described character
The output result of other unit increases the count value of described enumerator.
21. devices according to claim 20, it is characterised in that described second arranges module includes:
Whether the 3rd increases unit, be described input for judging the output result of described character judgement unit
Character is preset characters, and judges whether the second count value of described enumerator is 0, if described character is sentenced
The output result of other unit be the character of described input be that the second count value of preset characters and described enumerator is
0, then increase the first count value of described enumerator, otherwise, then increase the second count value of described enumerator.
22. devices according to claim 21, it is characterised in that described second arranges module also includes:
Computing unit, for attacking according to the minimum number of preset characters, identification needed for identifying aggressivity message
Most numbers of preset characters and default suffix lengths, calculating character number needed for property message;
4th closing unit, for if add after the first count value of described enumerator more than described character
Number, then close described enumerator and to arrange the first flag bit of described enumerator be 0.
23. devices according to claim 21, it is characterised in that described second arranges module also includes:
5th closing unit, for if add after described enumerator the second count value more than preset suffix
Length, then close described enumerator and to arrange the first flag bit of described enumerator be 0.
24. according to the device described in claim 19 to 23 any claim, it is characterised in that described
Determine that module includes:
5th acquiring unit, for obtaining the current state of described DFA;
6th acquiring unit, if the current state for the described DFA of described 5th acquiring unit acquisition is
Suffix accepts state, then obtain the character being currently entered position in described message, and be currently entered described
Character position in described message be defined as suffix position;
Second determines unit, by accept with the prefix arranged according to the suffix position obtained state corresponding based on
Number device, determines whether described message is aggressivity message.
25. 1 kinds of devices identifying aggressivity message, it is characterised in that described device includes memorizer and place
Reason device, described memorizer and described processor are for performing as described in claim 1 to 12 any claim
A kind of method identifying aggressivity message.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310109601.1A CN103188268B (en) | 2013-03-29 | 2013-03-29 | A kind of method and apparatus identifying aggressivity message |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310109601.1A CN103188268B (en) | 2013-03-29 | 2013-03-29 | A kind of method and apparatus identifying aggressivity message |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103188268A CN103188268A (en) | 2013-07-03 |
CN103188268B true CN103188268B (en) | 2016-08-10 |
Family
ID=48679233
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310109601.1A Active CN103188268B (en) | 2013-03-29 | 2013-03-29 | A kind of method and apparatus identifying aggressivity message |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103188268B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103729452B (en) * | 2013-12-31 | 2017-05-10 | 杭州华为数字技术有限公司 | Rule matching method and device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101414914A (en) * | 2008-11-26 | 2009-04-22 | 北京星网锐捷网络技术有限公司 | Method and apparatus for filtrating data content, finite state automata and conformation apparatus |
CN101707601A (en) * | 2009-11-23 | 2010-05-12 | 成都市华为赛门铁克科技有限公司 | Invasion defence detection method and device and gateway equipment |
CN101841546A (en) * | 2010-05-17 | 2010-09-22 | 华为技术有限公司 | Rule matching method, device and system |
CN101901268A (en) * | 2010-08-02 | 2010-12-01 | 华为技术有限公司 | Rule matching method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2441351B (en) * | 2006-09-01 | 2010-12-08 | 3Com Corp | Positionally dependent pattern checking in character strings using deterministic finite automata |
-
2013
- 2013-03-29 CN CN201310109601.1A patent/CN103188268B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101414914A (en) * | 2008-11-26 | 2009-04-22 | 北京星网锐捷网络技术有限公司 | Method and apparatus for filtrating data content, finite state automata and conformation apparatus |
CN101707601A (en) * | 2009-11-23 | 2010-05-12 | 成都市华为赛门铁克科技有限公司 | Invasion defence detection method and device and gateway equipment |
CN101841546A (en) * | 2010-05-17 | 2010-09-22 | 华为技术有限公司 | Rule matching method, device and system |
CN101901268A (en) * | 2010-08-02 | 2010-12-01 | 华为技术有限公司 | Rule matching method and device |
Also Published As
Publication number | Publication date |
---|---|
CN103188268A (en) | 2013-07-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9304768B2 (en) | Cache prefetch for deterministic finite automaton instructions | |
CN109582833B (en) | Abnormal text detection method and device | |
CN104484407B (en) | A kind of method and system for identifying fraud information | |
CN110324210A (en) | The detection method and device of private communication channel communication are carried out based on ICMP agreement | |
CN103036730A (en) | Method and device for achieving safety testing on protocol implementation | |
CN110427754A (en) | Network application attack detection method, device, equipment and storage medium | |
CN103324745A (en) | Text garbage identifying method and system based on Bayesian model | |
CN109933980A (en) | A kind of vulnerability scanning method, apparatus and electronic equipment | |
CN112905184B (en) | Pile-inserting-based reverse analysis method for industrial control protocol grammar under basic block granularity | |
CN109992936A (en) | Data source tracing method, device, equipment and medium based on data watermark | |
CN111414402A (en) | Log threat analysis rule generation method and device | |
CN106255082A (en) | The recognition methods of a kind of refuse messages and system | |
CN107423171A (en) | The detection method and device of insertion slot type function expansion card based on PCIE standards | |
CN106776179A (en) | The automatic testing method and device of electronic device failure | |
CN103188268B (en) | A kind of method and apparatus identifying aggressivity message | |
CN106027284A (en) | Network fault diagnosis method and device | |
CN115827610A (en) | Method and device for detecting effective load | |
CN108960836A (en) | Voice payment method, apparatus and system | |
CN111125704B (en) | Webpage Trojan horse recognition method and system | |
CN111324892B (en) | Method, device and medium for generating software genes and script detection of script file | |
CN106462749A (en) | Method for automatically establishing a data record characterizing two technical drawings | |
CN109120603A (en) | A kind of injection loophole detection method and device | |
CN209690900U (en) | MIPI data processing circuit | |
CN109147643A (en) | Method and device for identifying rising/falling edge, display panel and storage medium | |
CN103560878B (en) | DFA operation method and system based on DPI signature features |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20211223 Address after: 450046 Floor 9, building 1, Zhengshang Boya Plaza, Longzihu wisdom Island, Zhengdong New Area, Zhengzhou City, Henan Province Patentee after: xFusion Digital Technologies Co., Ltd. Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd. |
|
TR01 | Transfer of patent right |