Score mixed unicode as a percentage (mixed_unicode.py)

This commit is contained in:
jesopo 2018-11-20 13:08:47 +00:00
parent 727ade4022
commit c59a5600a8

View file

@ -13,6 +13,8 @@ class Script(enum.Enum):
TaiLe = 8
WORD_SEPERATORS = [",", " ", "\t", "."]
SCORE_LENGTH = 100
class Module(ModuleManager.BaseModule):
def _detect_script(self, char):
point = ord(char)
@ -63,5 +65,6 @@ class Module(ModuleManager.BaseModule):
last_was_separator = False
score = score/(len(event["message"])/SCORE_LENGTH)
if score > 0:
self.log.trace("Message given a mixed-unicode score of %d", [score])