Skip to content

Commit feeaeab

Browse files
Merge branch 'release/2.2.1'
2 parents 14588b4 + a924373 commit feeaeab

25 files changed

+219
-52
lines changed

.coveragerc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[run]
2+
source = src/modules/
3+
4+
[report]
5+
omit = src/modules/abstracts.py
6+
src/modules/mails/spamassassin_analysis.py
7+
src/modules/rabbitmq_client.py
8+
src/modules/attachments/thug_analysis.py
9+
10+
exclude_lines =
11+
pragma: no cover
12+
def __repr__
13+
raise AssertionError
14+
raise NotImplementedError
15+
if __name__ == .__main__.:

.travis.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ env:
1414
TIKA_APP_JAR=/tmp/tika-app-${TIKA_VER}.jar
1515
FAUP_PATH=/tmp/faup
1616
ZEMANA_PATH=/tmp/zemana
17-
DOCKER_ROOT_PATH=/tmp/docker-root
1817
DOCKER_ELASTICSEARCH_PATH=/tmp/docker-elasticsearch
1918

2019
before_install:
@@ -25,26 +24,22 @@ before_install:
2524
cmake
2625
libfuzzy-dev
2726
unrar
28-
#- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
27+
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
28+
29+
- git clone -b $TRAVIS_BRANCH --single-branch https://github.com/SpamScope/spamscope-dockerfile-elasticsearch.git $DOCKER_ELASTICSEARCH_PATH
2930

3031
# Build latest images spamscope-root, spamscope-elasticsearch
3132
# make images
3233
- if [ "$TRAVIS_BRANCH" == "master" ]; then
33-
git clone -b $TRAVIS_BRANCH --single-branch https://github.com/SpamScope/spamscope-dockerfile-root.git $DOCKER_ROOT_PATH &&
34-
cd $DOCKER_ROOT_PATH && docker build --build-arg SPAMSCOPE_VER=$TRAVIS_BRANCH -t $DOCKER_USERNAME/spamscope-root . && cd - &&
35-
docker run --rm -it $DOCKER_USERNAME/spamscope-root /bin/sh -c 'python -m unittest discover -s tests -f -v' &&
36-
docker run --rm -it $DOCKER_USERNAME/spamscope-root /bin/sh -c 'thug -V && spamscope-topology -v && spamscope-elasticsearch -v' &&
37-
git clone -b $TRAVIS_BRANCH --single-branch https://github.com/SpamScope/spamscope-dockerfile-elasticsearch.git $DOCKER_ELASTICSEARCH_PATH &&
38-
cd $DOCKER_ELASTICSEARCH_PATH && docker build --build-arg SPAMSCOPE_VER=latest -t $DOCKER_USERNAME/spamscope-elasticsearch . && cd -;
34+
cd $DOCKER_ELASTICSEARCH_PATH && docker build --build-arg SPAMSCOPE_VER=master -t $DOCKER_USERNAME/spamscope-elasticsearch . && cd -;
35+
docker run --rm -it $DOCKER_USERNAME/spamscope-elasticsearch /bin/sh -c 'python -m unittest discover -s tests -f -v';
36+
docker run --rm -it $DOCKER_USERNAME/spamscope-elasticsearch /bin/sh -c 'thug -V && spamscope-topology -v && spamscope-elasticsearch -v';
3937
fi
4038

4139
- if [ "$TRAVIS_BRANCH" == "develop" ]; then
42-
git clone -b $TRAVIS_BRANCH --single-branch https://github.com/SpamScope/spamscope-dockerfile-root.git $DOCKER_ROOT_PATH &&
43-
cd $DOCKER_ROOT_PATH && docker build --build-arg SPAMSCOPE_VER=$TRAVIS_BRANCH -t $DOCKER_USERNAME/spamscope-root:$TRAVIS_BRANCH . && cd - &&
44-
docker run --rm -it $DOCKER_USERNAME/spamscope-root:$TRAVIS_BRANCH /bin/sh -c 'python -m unittest discover -s tests -f -v' &&
45-
docker run --rm -it $DOCKER_USERNAME/spamscope-root:$TRAVIS_BRANCH /bin/sh -c 'thug -V && spamscope-topology -v && spamscope-elasticsearch -v' &&
46-
git clone -b $TRAVIS_BRANCH --single-branch https://github.com/SpamScope/spamscope-dockerfile-elasticsearch.git $DOCKER_ELASTICSEARCH_PATH &&
47-
cd $DOCKER_ELASTICSEARCH_PATH && docker build --build-arg SPAMSCOPE_VER=$TRAVIS_BRANCH -t $DOCKER_USERNAME/spamscope-elasticsearch:$TRAVIS_BRANCH . && cd -;
40+
cd $DOCKER_ELASTICSEARCH_PATH && docker build --build-arg SPAMSCOPE_VER=develop -t $DOCKER_USERNAME/spamscope-elasticsearch:develop . && cd -;
41+
docker run --rm -it $DOCKER_USERNAME/spamscope-elasticsearch:develop /bin/sh -c 'python -m unittest discover -s tests -f -v';
42+
docker run --rm -it $DOCKER_USERNAME/spamscope-elasticsearch:develop /bin/sh -c 'thug -V && spamscope-topology -v && spamscope-elasticsearch -v';
4843
fi
4944

5045
# command to install dependencies
@@ -62,7 +57,7 @@ before_script:
6257
# command to run tests
6358
script:
6459
# Unittests and coverage
65-
- coverage run --include=src/modules/* --omit=src/modules/abstracts.py,src/modules/mails/spamassassin_analysis.py -m unittest discover -s tests -f -v
60+
- coverage run -m unittest discover -s tests -f -v
6661

6762
# timing
6863
- python tests/timing_test_search_keywords.py
@@ -73,19 +68,27 @@ script:
7368
- spamscope-elasticsearch -v
7469
- spamscope-topology -v
7570

71+
deploy:
72+
provider: pypi
73+
user: fmantuano
74+
password:
75+
secure: "lPuvh9if9jZrtgk/i9++D7v1BGfyEj9kalJy52yfjOARZ3xskrvHLjJMIxu9wFndYYdUAz8J1Y2WsKLDyYyfMwiAFadU2xmsobNunGO95CNUadbfJojaH7LartWQN+gnw98svJTms9GLHLmO8eH2j5BsH2mubOaWm8T0lF3Pjs0NncXdi6HzSQ63qGj6ctjFzAmTqoK14EzbGVAu1KRBzO6hdu41/nhWx1ufRZYBNeEjtNCZfIl74ALdCpEEQfqTl5hgMA9ybuXvcAmZMOWVjBQiXjSeAUoz+u2FYBkzSxx0Sst1MkKoC3iG6p+Z2E4WHya63ew1GQyyug7XSmq8JpaKRFtktU2b5g+AcqKmLsf0nw+2x/pjGxJIyy69OnX7oGr9fQTGGMHg36OU8vdyhOX+40nHEXC+M45rS/ma+tYSrL+j2Mn1kKreOjoC6kV1g+bgX2eSVFicFonB++ySFSt8D5b7zQibIx0BCxzN/WpNu99/0DTFpA0n9ox7+4F4Jzrn3a8IM56I/RyqBqh8ce7TjhOwsF6n8Egjk9ywVuZW8OuohBTxdosU+TAntlNCmGgECcdXzSGqTXLPWjfe2U7C4qtBVwHMlptYxZNs8XvlJksysM8Cyp+dUjXJCLqPH2n55aK9+x6Pzq/cSM1ldzXg+iZcO9XXoEDJ1bLXVDE="
76+
on:
77+
tags: true
78+
repo: SpamScope/spamscope
79+
branch: master
80+
7681
after_success:
7782
- coveralls
7883

7984
- if [ "$TRAVIS_BRANCH" == "master" ]; then
8085
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
81-
docker push $DOCKER_USERNAME/spamscope-root;
8286
docker push $DOCKER_USERNAME/spamscope-elasticsearch;
8387
fi
8488

8589
- if [ "$TRAVIS_BRANCH" == "develop" ]; then
8690
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
87-
docker push $DOCKER_USERNAME/spamscope-root:$TRAVIS_BRANCH;
88-
docker push $DOCKER_USERNAME/spamscope-elasticsearch:$TRAVIS_BRANCH;
91+
docker push $DOCKER_USERNAME/spamscope-elasticsearch:develop;
8992
fi
9093

9194
notifications:

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[![Build Status](https://travis-ci.org/SpamScope/spamscope.svg?branch=master)](https://travis-ci.org/SpamScope/spamscope)
33
[![Coverage Status](https://coveralls.io/repos/github/SpamScope/spamscope/badge.svg?branch=develop)](https://coveralls.io/github/SpamScope/spamscope?branch=develop)
44
[![BCH compliance](https://bettercodehub.com/edge/badge/SpamScope/spamscope?branch=develop)](https://bettercodehub.com/)
5+
[![](https://images.microbadger.com/badges/image/fmantuano/spamscope-elasticsearch.svg)](https://microbadger.com/images/fmantuano/spamscope-elasticsearch "Get your own image badge on microbadger.com")
56

67
![SpamScope](https://raw.githubusercontent.com/SpamScope/spamscope/develop/docs/logo/spamscope.png)
78

@@ -225,11 +226,8 @@ $ export SPAMASSASSIN_ENABLED=True
225226
## Docker images
226227
It's possible to use complete Docker images with Apache Storm and SpamScope. Take the following images:
227228

228-
- [Root](https://hub.docker.com/r/fmantuano/spamscope-root/)
229-
- [Elasticsearch](https://hub.docker.com/r/fmantuano/spamscope-elasticsearch/)
230-
231-
For each image there are two tags: **develop** and **latest**.
232-
229+
- [Deps](https://hub.docker.com/r/fmantuano/spamscope-deps/): to use as base image
230+
- [Elasticsearch](https://hub.docker.com/r/fmantuano/spamscope-elasticsearch/): integrated with Elasticsearch
233231

234232

235233
## Screenshots

README.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
|PyPI version| |Build Status| |Coverage Status| |BCH compliance|
2+
|image4|
23

34
.. figure:: https://raw.githubusercontent.com/SpamScope/spamscope/develop/docs/logo/spamscope.png
45
:alt: SpamScope
@@ -314,10 +315,10 @@ Docker images
314315
It's possible to use complete Docker images with Apache Storm and
315316
SpamScope. Take the following images:
316317

317-
- `Root <https://hub.docker.com/r/fmantuano/spamscope-root/>`__
318-
- `Elasticsearch <https://hub.docker.com/r/fmantuano/spamscope-elasticsearch/>`__
319-
320-
For each image there are two tags: **develop** and **latest**.
318+
- `Deps <https://hub.docker.com/r/fmantuano/spamscope-deps/>`__: to use
319+
as base image
320+
- `Elasticsearch <https://hub.docker.com/r/fmantuano/spamscope-elasticsearch/>`__:
321+
integrated with Elasticsearch
321322

322323
Screenshots
323324
-----------
@@ -350,5 +351,7 @@ Screenshots
350351
:target: https://coveralls.io/github/SpamScope/spamscope?branch=develop
351352
.. |BCH compliance| image:: https://bettercodehub.com/edge/badge/SpamScope/spamscope?branch=develop
352353
:target: https://bettercodehub.com/
354+
.. |image4| image:: https://images.microbadger.com/badges/image/fmantuano/spamscope-elasticsearch.svg
355+
:target: https://microbadger.com/images/fmantuano/spamscope-elasticsearch
353356
.. |Donate| image:: https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif
354357
:target: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VEPXYP745KJF2

conf/templates/spamscope.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"order": 0,
3-
"version": 4,
3+
"version": 5,
44
"index_patterns": "spamscope_*-*",
55
"settings": {
66
"analysis": {
@@ -31,7 +31,8 @@
3131
"index.codec": "best_compression",
3232
"index.number_of_shards": 2,
3333
"index.number_of_replicas": 0,
34-
"index.refresh_interval": "5s"
34+
"index.refresh_interval": "5s",
35+
"index.mapping.ignore_malformed": true
3536
},
3637
"mappings": {
3738
"analysis": {

docker/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM fmantuano/spamscope-deps
2+
3+
MAINTAINER Fedele Mantuano "mantuano.fedele@gmail.com"
4+
5+
# environment variables
6+
ARG SPAMSCOPE_VER="develop"
7+
8+
ENV SPAMASSASSIN_ENABLED="True" \
9+
SPAMSCOPE_CONF_FILE="/etc/spamscope/spamscope.yml" \
10+
SPAMSCOPE_PATH="/opt/spamscope" \
11+
THUG_ENABLED="True"
12+
13+
# labels
14+
LABEL description="Spamscope: Advanced Spam Analysis" \
15+
spamscope_version=${SPAMSCOPE_VER}
16+
17+
# install SpamScope
18+
RUN set -ex; \
19+
mkdir -p "/var/log/spamscope" "/etc/spamscope"; \
20+
git clone -b ${SPAMSCOPE_VER} --single-branch https://github.com/SpamScope/spamscope.git ${SPAMSCOPE_PATH}; \
21+
cd $SPAMSCOPE_PATH; \
22+
pip install -r requirements_optional.txt; \
23+
python setup.py install; \
24+
sparse jar -s; \
25+
pip install -U thug;
26+
27+
WORKDIR ${SPAMSCOPE_PATH}

docker/docker-compose.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,22 @@ version: '2.1'
44
services:
55

66
# SpamScope
7-
spamscope:
8-
image: ${SPAMSCOPE_IMAGE_NAME}
7+
spamscope-debug:
8+
image: spamscope-debug
9+
build: .
910
container_name: spamscope
10-
mem_limit: ${SPAMSCOPE_MEM_LIMIT}
11-
dns:
12-
- 8.8.8.8
13-
- 8.8.4.4
11+
mem_limit: 4g
1412
ports:
15-
- "${SPAMSCOPE_BIND_IP}:8080:8080"
16-
- "${SPAMSCOPE_BIND_IP}:8000:8000"
13+
- "127.0.0.1:8080:8080"
14+
- "127.0.0.1:8000:8000"
1715
volumes:
1816
- ${HOST_SPAMSCOPE_CONF}:/etc/spamscope
1917
- ${HOST_MAILS_FOLDER}:${DOCKER_MAILS_FOLDER}
2018
healthcheck:
2119
test: curl -fs http://localhost:8080/
2220
networks:
23-
- ${NET_NAME}
24-
25-
volumes:
26-
esdata:
27-
driver: local
21+
- spamscope
2822

2923
networks:
30-
esnet:
24+
spamscope:
3125
driver: bridge

project.clj

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

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ astropy>=1.3.3
33
backports.functools-lru-cache>=1.3
44
chainmap
55
lxml
6-
mail-parser>=3
6+
mail-parser>=3.2.6
77
patool
88
pyparsing
99
python-magic
1010
simplejson
1111
six
1212
ssdeep
13-
streamparse==3.13.0
13+
streamparse==3.13.1

src/bolts/tokenizer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def _make_mail(self, tup):
8484
mail["mailbox"] = tup.values[2]
8585
mail["priority"] = tup.values[3]
8686
mail["sender_ip"] = self.parser.get_server_ipaddress(tup.values[4])
87+
mail["to_domains"] = self.parser.to_domains
8788

8889
# Fingerprints of body mail
8990
(mail["md5"], mail["sha1"], mail["sha256"], mail["sha512"],

0 commit comments

Comments
 (0)