Skip to content

Commit 9487e9d

Browse files
Merge branch 'release/1.5.2'
2 parents 3e324a1 + bf93493 commit 9487e9d

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

conf/templates/spamscope.json

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
{
4040
"hashes": {
4141
"mapping": {
42-
"index": "not_analyzed",
4342
"type": "keyword",
4443
"eager_global_ordinals": true
4544
},
@@ -59,8 +58,7 @@
5958
{
6059
"headers": {
6160
"mapping": {
62-
"index": "analyzed",
63-
"type": "string",
61+
"type": "text",
6462
"analyzer": "header"
6563
},
6664
"match_pattern": "regex",
@@ -70,8 +68,7 @@
7068
{
7169
"body": {
7270
"mapping": {
73-
"index": "analyzed",
74-
"type": "string",
71+
"type": "text",
7572
"analyzer": "html_body"
7673
},
7774
"match": "body"
@@ -80,8 +77,7 @@
8077
{
8178
"path_mail": {
8279
"mapping": {
83-
"index": "analyzed",
84-
"type": "string",
80+
"type": "text",
8581
"analyzer": "path_pattern"
8682
},
8783
"match": "path_mail"
@@ -99,7 +95,6 @@
9995
{
10096
"all_not_analyzed": {
10197
"mapping": {
102-
"index": "not_analyzed",
10398
"type": "keyword",
10499
"eager_global_ordinals": true
105100
},
@@ -110,18 +105,16 @@
110105
{
111106
"all_string": {
112107
"mapping": {
113-
"index": "analyzed",
114-
"type": "string",
108+
"type": "text",
115109
"fields": {
116110
"raw": {
117111
"ignore_above": 256,
118-
"index": "not_analyzed",
119112
"type": "keyword",
120113
"eager_global_ordinals": true
121114
}
122115
}
123116
},
124-
"match_mapping_type": "string"
117+
"match_mapping_type": "text"
125118
}
126119
}
127120
],

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject spamscope "1.5.1-SNAPSHOT"
1+
(defproject spamscope "1.5.2-SNAPSHOT"
22
:resource-paths ["_resources"]
33
:target-path "_build"
44
:min-lein-version "2.0.0"

src/modules/attachments/post_processing.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"""
1919

2020
from __future__ import absolute_import, print_function, unicode_literals
21+
import logging
2122

2223
try:
2324
from modules import register
@@ -28,6 +29,9 @@
2829
processors = set()
2930

3031

32+
log = logging.getLogger(__name__)
33+
34+
3135
"""
3236
This module contains all post processors for mail attachments
3337
(i.e.: VirusTotal, Thug, etc.).
@@ -168,20 +172,32 @@ def zemana(conf, attachments):
168172
raise ImportError("Zemana library not found. You should be Zemana "
169173
"customer (https://www.zemana.com/)")
170174

175+
from requests.exceptions import HTTPError
176+
171177
z = Zemana(int(conf["PartnerId"]), conf["UserId"],
172178
conf["ApiKey"], conf["useragent"])
173179

174180
for a in attachments:
175181
if not a.get("is_filtered", False):
176-
result = z.query(a["md5"])
182+
try:
183+
result = z.query(a["md5"])
184+
except HTTPError:
185+
log.exception(
186+
"HTTPError in Zemana query for md5 {!r}".format(
187+
a["md5"]))
177188

178-
if result.json:
189+
if result:
179190
a["zemana"] = result.json
180191
a["zemana"]["type"] = result.type
181192

182193
for i in a.get("files", []):
183-
i_result = z.query(i["md5"])
194+
try:
195+
i_result = z.query(i["md5"])
196+
except HTTPError:
197+
log.exception(
198+
"HTTPError in Zemana query for md5 {!r}".format(
199+
i["md5"]))
184200

185-
if i_result.json:
201+
if i_result:
186202
i["zemana"] = i_result.json
187203
i["zemana"]["type"] = i_result.type

src/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from os.path import join
2121

22-
__version__ = "1.5.1"
22+
__version__ = "1.5.2"
2323
__configuration_path__ = "/etc/spamscope"
2424

2525
__defaults__ = {

0 commit comments

Comments
 (0)