@@ -62,12 +62,13 @@ def _load_lists(self):
6262 self .log ("Phishing targets keywords reloaded" )
6363
6464 def _search_phishing (self , greedy_data ):
65+ with_urls = False
6566
6667 # If mail is filtered don't check for phishing
6768 is_filtered = greedy_data ["tokenizer" ][2 ]
6869
6970 if is_filtered :
70- return False , False
71+ return False , False , False
7172
7273 # Reset phishing bitmap
7374 self ._pb .reset_score ()
@@ -83,8 +84,9 @@ def _search_phishing(self, greedy_data):
8384 urls_body = greedy_data ["urls-handler-body" ][2 ]
8485 urls_attachments = greedy_data ["urls-handler-attachments" ][2 ]
8586
86- # TODO: if an attachment is filtered the score is not complete
87- # more different mails can have same attachment
87+ # TODO: if an attachment is filtered, the score is not complete
88+ # more different mails can have the same attachment
89+ # more different attachments can have the same mail
8890 attachments = MailAttachments (greedy_data ["attachments" ][2 ])
8991
9092 urls = (
@@ -110,14 +112,15 @@ def _search_phishing(self, greedy_data):
110112 # Target not added because urls come already analyzed text
111113 for k , v in urls :
112114 if k :
115+ with_urls = True
113116 if any (check_urls (k , i ) for i in self ._t_keys .values ()):
114117 self ._pb .set_property_score (v )
115118
116119 # Check subject
117120 if swt (subject , self ._s_keys ):
118121 self ._pb .set_property_score ("mail_subject" )
119122
120- return self ._pb .score , list (targets )
123+ return self ._pb .score , list (targets ), with_urls
121124
122125 def process_tick (self , freq ):
123126 """Every freq seconds you reload the keywords. """
@@ -135,10 +138,15 @@ def process(self, tup):
135138 if not diff :
136139 with_phishing = False
137140
138- score , targets = self ._search_phishing (
141+ score , targets , with_urls = self ._search_phishing (
139142 self ._mails .pop (sha256_random ))
140143
141- if score :
144+ # There is phishing only if there is also urls
145+ # Mail can have target without phishing
146+ if score and with_urls :
142147 with_phishing = True
148+ else :
149+ with_phishing = False
150+ score = 0
143151
144152 self .emit ([sha256_random , with_phishing , score , targets ])
0 commit comments