forked from ivre/ivre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
121 lines (109 loc) · 5.8 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# This file is part of IVRE.
# Copyright 2011 - 2018 Pierre LALET <[email protected]>
#
# IVRE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IVRE is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.
sudo: required
dist: trusty
env:
# PostgreSQL 10.1, 9.6.6, 9.5.10
- DB=postgres POSTGRES_VERSION=9.5.10
- DB=postgres POSTGRES_VERSION=9.6.6
- DB=postgres POSTGRES_VERSION=10.1
# MongoDB
## Previous releases
- DB=mongo MONGODB_VERSION=2.6.12
- DB=mongo MONGODB_VERSION=3.0.15
- DB=mongo MONGODB_VERSION=3.2.18
- DB=mongo MONGODB_VERSION=3.4.10
## Current stable
- DB=mongo MONGODB_VERSION=3.6.2
## Development release
- DB=mongo MONGODB_VERSION=3.7.1
# Sqlite
- DB=sqlite
language: python
cache: pip
python:
- 2.6
- 2.7
- 3.3
- 3.4
- 3.5
- 3.6
# PhantomJS is supposed to be installed
# (https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-PhantomJS),
# but we need tesseract
addons:
apt:
packages:
- tesseract-ocr
- tesseract-ocr-osd
- tesseract-ocr-eng
install:
- source ./.travis/install_${DB}.sh
- pip install -U $PIP_INSTALL_OPTIONS .
- pip install -U flake8
- PYVERS=`python -c 'import sys;print("%d%d" % sys.version_info[:2])'`; if [ -f "requirements-$DB-$PYVERS.txt" ]; then pip install -U $PIP_INSTALL_OPTIONS -r "requirements-$DB-$PYVERS.txt"; else pip install -U $PIP_INSTALL_OPTIONS -r "requirements-$DB.txt"; fi
- test "$TRAVIS_PYTHON_VERSION" = 2.6 && pip install -U unittest2 || true
- pip install -U $PIP_INSTALL_OPTIONS coverage codecov
# cleanup
- rm -rf ivre/
# We need MongoDB 2.6
# https://github.com/travis-ci/travis-ci/issues/2246
#services: mongodb
before_script:
# display version
- ivre version
# init DB
- ivre ipinfo --init < /dev/null || echo "ERROR failed to init passive database."
- ivre scancli --init < /dev/null || echo "ERROR failed to init nmap database."
- ivre view --init < /dev/null || echo "ERROR failed to init view database."
- cat .travis/ivre.conf >> ~/.ivre.conf
- echo "NMAP_SHARE_PATH = '`pwd`/usr/local/nmap/share/nmap'" >> ~/.ivre.conf
# install p0f, Bro & Nmap (.tar files)
# for some reason, wget on travis-ci won't accept letsencrypt certificate
- for archive in tools-travis-ivre bro-2.5.2_ubuntu-14.04 nmap-7.60_ubuntu-precise; do wget --no-check-certificate https://ivre.rocks/data/tests/${archive}.tar.bz2 -O - | tar jxf - ; done
# get GeoIP CSV files -- we are supposed to build them, but that's
# disabled in Travis since that's too slow
- wget --no-check-certificate -P `python -c 'from ivre import config; print(config.GEOIP_PATH)'` https://ivre.rocks/data/tests/db/GeoLite2-{ASN,City}.dump-IPv4.csv.bz2; bunzip2 "/`python -c 'from ivre import config; print(config.GEOIP_PATH)'`/"GeoLite2-{ASN,City}.dump-IPv4.csv.bz2
- export PATH="`pwd`/tools/bin:`pwd`/usr/local/bro/bin:`pwd`/usr/local/nmap/bin:$PATH"
- export LD_LIBRARY_PATH="`pwd`/tools/lib:`pwd`/usr/local/bro/lib"
- export BROPATH=".:`pwd`/usr/local/bro/share/bro:`pwd`/usr/local/bro/share/bro/policy:`pwd`/usr/local/bro/share/bro/site"
- cp tools/etc/p0f/* tests/
# install IVRE's Nmap scripts.
- cp `python -c "import ivre.config; print(ivre.config.guess_prefix('nmap_scripts'))"`/*.nse `pwd`/usr/local/nmap/share/nmap/scripts/
- for patch in `python -c "import ivre.config; print(ivre.config.guess_prefix('nmap_scripts'))"`/patches/*; do (cd `pwd`/usr/local/nmap/share/nmap && patch -p0 < $patch); done
- nmap --script-updatedb
# get samples
- mkdir tests/samples
- cp tests/results-public-samples tests/samples/results
- cp tests/iptables-samples tests/samples/iptables.log
## Nmap Internet-wide Modbus scan (JSON format, shortened)
- wget --no-check-certificate -O tests/samples/Nmap-Modbus-IPv4.json.bz2 https://ivre.rocks/data/tests/Nmap-Modbus-IPv4-partial.json.bz2 # JSON files w/ Nmap scan results
## Masscan sample scans (XML format)
- for file in test-probe-ike-ipsec-nat-t-probe-U4500.xml.bz2 test-probe-ike-probe-U500.xml.bz2 test-T22.xml.bz2 test-T443.xml.bz2 test-T102-s7comm.xml.bz2; do wget --no-check-certificate "https://ivre.rocks/data/tests/$file" -O "tests/samples/$file" ; done
## PCAP files from the Wireshark project
- wget -O - "https://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=get&target=imap.cap.gz" | zcat > tests/samples/imap.pcap
- for file in http.cap telnet-raw.pcap nb6-startup.pcap nb6-http.pcap nb6-telephone.pcap nb6-hotspot.pcap ; do wget "https://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=get&target=$file" -O "tests/samples/$file"; done
- for file in SSHv2.cap; do wget "http://packetlife.net/captures/$file" -O "tests/samples/$file"; done
- wget 'https://www.cloudshark.org/captures/616566f75f0c/download' -O tests/samples/gre-sample.pcap
- wget --no-check-certificate -O tests/samples/banners.pcap https://ivre.rocks/data/tests/banners.pcap
- for file in tests/samples/*.cap; do mv "$file" "${file/.cap/.pcap}"; done
- export BRO_SAMPLES=`pwd`/usr/local/bro/testing
- ivre --version; echo; bro --version
script: (test "$TRAVIS_PYTHON_VERSION" = 2.6 || (flake8 setup.py && flake8 bin/ivre && flake8 ivre/ --ignore=E266,E731,W504 && echo "flake8 OK (except E266,E731,W504)")) && cd tests/ && coverage erase && coverage run --parallel-mode tests.py --coverage && coverage combine && coverage report
after_success:
- codecov
after_failure:
- cat /tmp/webserver.log