Skip to content

Commit 059a690

Browse files
Merge branch 'release/2.8.0'
2 parents 4eb0bbb + 424a33f commit 059a690

18 files changed

+534
-25
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,12 @@ dist: clean ## builds source and wheel package
8080

8181
install: clean ## install the package to the active Python's site-packages
8282
python setup.py install
83+
84+
debug-iter-topology:
85+
mkdir /tmp/logs/ 2>/dev/null || echo /tmp/logs/ already exist
86+
sparse run \
87+
-n spamscope_debug_iter \
88+
-e debug \
89+
-o topology.max.spout.pending=1 \
90+
-o "topology.sleep.spout.wait.strategy.time.ms=10" \
91+
-o "topology.tick.tuple.freq.secs=10"

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,13 @@ You can use:
177177
* [Ansible](./ansible/README.md): to install and run SpamScope on server
178178

179179
# Topologies
180-
SpamScope comes with three topologies:
180+
SpamScope comes with six topologies:
181181
- [spamscope_debug](./topologies/spamscope_debug.py): the output are JSON files on file system.
182182
- [spamscope_elasticsearch](./topologies/spamscope_elasticsearch.py): the output are stored in Elasticsearch indexes.
183183
- [spamscope_redis](./topologies/spamscope_redis.py): the output are stored in Redis.
184+
- [spamscope_debug_iter](./topologies/spamscope_debug_iter.py): It uses generator to send mails in topology. The output are JSON files on file system.
185+
- [spamscope_elasticsearch_iter](./topologies/spamscope_elasticsearch_iter.py): It uses generator to send mails in topology. The output are stored in Elasticsearch indexes.
186+
- [spamscope_redis_iter](./topologies/spamscope_redis_iter.py): It uses generator to send mails in topology. The output are stored in Redis.
184187

185188
If you want submit SpamScope topology use `spamscope-topology submit` tool. For more details [see SpamScope cli tools](src/cli/README.md):
186189

README.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,21 @@ run SpamScope on server
291291
Topologies
292292
==========
293293

294-
SpamScope comes with three topologies: -
294+
SpamScope comes with six topologies: -
295295
`spamscope_debug <./topologies/spamscope_debug.py>`__: the output are
296296
JSON files on file system. -
297297
`spamscope_elasticsearch <./topologies/spamscope_elasticsearch.py>`__:
298298
the output are stored in Elasticsearch indexes. -
299299
`spamscope_redis <./topologies/spamscope_redis.py>`__: the output are
300-
stored in Redis.
300+
stored in Redis. -
301+
`spamscope_debug_iter <./topologies/spamscope_debug_iter.py>`__: It uses
302+
generator to send mails in topology. The output are JSON files on file
303+
system. -
304+
`spamscope_elasticsearch_iter <./topologies/spamscope_elasticsearch_iter.py>`__:
305+
It uses generator to send mails in topology. The output are stored in
306+
Elasticsearch indexes. -
307+
`spamscope_redis_iter <./topologies/spamscope_redis_iter.py>`__: It uses
308+
generator to send mails in topology. The output are stored in Redis.
301309

302310
If you want submit SpamScope topology use ``spamscope-topology submit``
303311
tool. For more details `see SpamScope cli tools <src/cli/README.md>`__:

conf/spamscope.example.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,50 @@ files-mails:
4949
path_mails: /path/mails2
5050

5151

52+
# Spout file on file system
53+
# Use an iterator. Safe for RAM
54+
iter-files-mails:
55+
56+
# The mails in processing older that fail.after.seconds will be failed
57+
fail.after.seconds: 60
58+
59+
# Post processing
60+
post_processing:
61+
62+
# move or remove mails analyzed, default remove
63+
what: remove
64+
65+
# Where you want move the analyzed mails, default /tmp/moved
66+
where: /tmp/moved
67+
68+
# Where you want move the failed mails, default /tmp/failed
69+
where.failed: /tmp/failed
70+
71+
# Mailboxes
72+
mailboxes:
73+
test:
74+
mail_server: hostname
75+
# Trust string is used to get sender IP address from mail server.
76+
# More details:
77+
# https://github.com/SpamScope/mail-parser/blob/v0.4.6/mailparser/__init__.py#L221
78+
trust_string: "test_trust_string"
79+
files_pattern: "*untroubled*"
80+
path_mails: /path/mails1
81+
82+
# This flag enables Outlook msg parsing for every mails in mailbox
83+
# Default value is false
84+
outlook: false
85+
86+
# List of others headers to get
87+
headers:
88+
- custom_one
89+
- custom_two
90+
test1:
91+
mail_server: hostname
92+
trust_string: "test1_trust_string"
93+
files_pattern: "*"
94+
path_mails: /path/mails2
95+
5296
# Bolts configurations
5397
# Phishing bolt configuration
5498
phishing:

project.clj

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

src/bolts/tokenizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import random
2525
import six
2626
from collections import deque
27-
from cPickle import BadPickleGet
27+
from cPickle import PickleError
2828

2929
from streamparse import Stream
3030
import mailparser
@@ -85,7 +85,7 @@ def load_filters(self):
8585
try:
8686
obj = load_obj(path)
8787
setattr(self, "analyzed_" + i, obj)
88-
except (IOError, EOFError, ValueError, BadPickleGet):
88+
except (IOError, EOFError, ValueError, PickleError):
8989
setattr(self, "analyzed_" + i, deque(
9090
maxlen=getattr(self, "maxlen_" + i)))
9191

src/cli/spamscope_topology.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ def get_args():
5757
submit.add_argument(
5858
"-g",
5959
"--topology",
60-
choices=["spamscope_debug", "spamscope_elasticsearch",
61-
"spamscope_redis"],
60+
choices=[
61+
"spamscope_debug_iter",
62+
"spamscope_debug",
63+
"spamscope_elasticsearch_iter",
64+
"spamscope_elasticsearch",
65+
"spamscope_redis_iter",
66+
"spamscope_redis",
67+
],
6268
default="debug",
6369
help="SpamScope topology.",
6470
dest="topology")

src/modules/attachments/attachments.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,11 @@ def withhashes(cls, attachments=[]):
353353
try:
354354
payload = base64.b64decode(i["payload"])
355355
except TypeError, e:
356-
payload = base64.b64decode(i["payload"] + "===")
357-
i.setdefault("errors", []).append(repr(e))
358-
356+
try:
357+
payload = base64.b64decode(i["payload"] + "===")
358+
i.setdefault("errors", []).append(repr(e))
359+
except TypeError:
360+
continue
359361
else:
360362
payload = i["payload"]
361363

src/modules/attachments/thug_analysis.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ def generate_json_report():
5858
if m is None:
5959
return
6060

61-
report = json.loads(m(tempfile.gettempdir()))
62-
return report
61+
try:
62+
report = json.loads(m(tempfile.gettempdir()))
63+
except TypeError:
64+
return
65+
else:
66+
return report
6367

6468

6569
class CustomWatchdog(Watchdog):

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__ = "2.7.0"
22+
__version__ = "2.8.0"
2323
__configuration_path__ = "/etc/spamscope"
2424

2525
__defaults__ = {

0 commit comments

Comments
 (0)