tanner, snare, deps

This commit is contained in:
Marco Ochse
2018-05-26 23:09:31 +00:00
parent 1b5e39e448
commit 88e252fbfb
12 changed files with 549 additions and 0 deletions

View File

@ -0,0 +1,41 @@
FROM alpine
# Include dist
ADD dist/ /root/dist/
# Setup apt
RUN apk -U --no-cache add \
build-base \
git \
libcap \
linux-headers \
py3-yarl \
python3 \
python3-dev && \
# Setup ConPot
git clone https://github.com/mushorg/tanner /opt/tanner && \
cp /root/dist/config.py /opt/tanner/tanner/ && \
cp /root/dist/requirements.txt /opt/tanner/ && \
cd /opt/tanner/ && \
pip3 install --no-cache-dir --upgrade pip setuptools && \
pip3 install --no-cache-dir -r requirements.txt && \
python3 setup.py install && \
cd / && \
# Get wireshark manuf db for scapy, setup configs, user, groups
addgroup -g 2000 tanner && \
adduser -S -s /bin/ash -u 2000 -D -g 2000 tanner && \
# Clean up
apk del --purge \
build-base \
linux-headers \
python3-dev && \
rm -rf /root/* && \
rm -rf /tmp/* /var/tmp/* && \
rm -rf /var/cache/apk/*
# Start conpot
WORKDIR /opt/tanner
CMD tanner

80
docker/tanner/tanner/dist/config.py vendored Normal file
View File

@ -0,0 +1,80 @@
import configparser
import logging
import os
import sys
LOGGER = logging.getLogger(__name__)
config_template = {'DATA': {'db_config': '/opt/tanner/db/db_config.json', 'dorks': '/opt/tanner/data/dorks.pickle',
'user_dorks': '/opt/tanner/data/user_dorks.pickle'},
'TANNER': {'host': '0.0.0.0', 'port': 8090},
'WEB': {'host': '0.0.0.0', 'port': 8091},
'API': {'host': '0.0.0.0', 'port': 8092},
'PHPOX': {'host': '0.0.0.0', 'port': 8088},
'REDIS': {'host': 'tanner_redis', 'port': 6379, 'poolsize': 80, 'timeout': 1},
'EMULATORS': {'root_dir': '/opt/tanner'},
'EMULATOR_ENABLED': {'sqli': True, 'rfi': True, 'lfi': False, 'xss': True, 'cmd_exec': False,
'php_code_injection': True, "crlf": True},
'SQLI': {'type': 'SQLITE', 'db_name': 'tanner_db', 'host': 'localhost', 'user': 'root',
'password': 'user_pass'},
'DOCKER': {'host_image': 'busybox:latest'},
'LOGGER': {'log_debug': '/opt/tanner/tanner.log', 'log_err': '/opt/tanner/tanner.err'},
'MONGO': {'enabled': False, 'URI': 'mongodb://localhost'},
'HPFEEDS': {'enabled': False, 'HOST': 'localhost', 'PORT': 10000, 'IDENT': '', 'SECRET': '',
'CHANNEL': 'tanner.events'},
'LOCALLOG': {'enabled': True, 'PATH': '/tmp/tanner_report.json'},
'CLEANLOG': {'enabled': False}
}
class TannerConfig():
config = None
@staticmethod
def set_config(config_path):
cfg = configparser.ConfigParser()
if not os.path.exists(config_path):
print("Config file {} doesn't exist. Check the config path or use default".format(config_path))
sys.exit(1)
cfg.read(config_path)
TannerConfig.config = cfg
@staticmethod
def get(section, value):
res = None
if TannerConfig.config is not None:
try:
convert_type = type(config_template[section][value])
if convert_type is bool:
res = TannerConfig.config.getboolean(section, value)
else:
res = convert_type(TannerConfig.config.get(section, value))
except (configparser.NoOptionError, configparser.NoSectionError):
LOGGER.warning("Error in config, default value will be used. Section: %s Value: %s", section, value)
res = config_template[section][value]
else:
res = config_template[section][value]
return res
@staticmethod
def get_section(section):
res = {}
if TannerConfig.config is not None:
try:
sec = TannerConfig.config[section]
for k, v in sec.items():
convert_type = type(config_template[section][k])
if convert_type is bool:
res[k] = TannerConfig.config[section].getboolean(k)
else:
res[k] = convert_type(v)
except (configparser.NoOptionError, configparser.NoSectionError):
LOGGER.warning("Error in config, default value will be used. Section: %s Value: %s", section)
res = config_template[section]
else:
res = config_template[section]
return res

View File

@ -0,0 +1,13 @@
aiohttp==2.2
aiomysql
aiohttp_jinja2==0.14.0
docker<2.6
elizabeth==0.3.27
yarl<0.11
redis
asyncio_redis
uvloop
pymongo
pylibinjection
jinja2
pycodestyle

View File

@ -0,0 +1,59 @@
version: '2.3'
networks:
tanner_local:
services:
# Tanner Redis Service
tanner_redis:
container_name: tanner_redis
restart: always
stop_signal: SIGKILL
tty: true
networks:
- tanner_local
image: "dtagdevsec/redis:1804"
# Tanner API Service
tanner_api:
build: .
container_name: tanner_api
restart: always
stop_signal: SIGKILL
tty: true
networks:
- tanner_local
image: "dtagdevsec/tanner:1804"
command: tannerapi
depends_on:
- redis
# Tanner WEB Service
tanner_web:
build: .
container_name: tanner_web
restart: always
stop_signal: SIGKILL
tty: true
networks:
- tanner_local
image: "dtagdevsec/tanner:1804"
command: tannerweb
depends_on:
- redis
# Tanner Service
tanner:
build: .
container_name: tanner
restart: always
stop_signal: SIGKILL
tty: true
networks:
- tanner_local
image: "dtagdevsec/tanner:1804"
command: tanner
depends_on:
- tanner_api
- tanner_web