Skip to content

Commit 3d5c2ff

Browse files
committed
add postgres as optional database mushorg#322
1 parent de1b5ed commit 3d5c2ff

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

tanner/config.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
},
1616
'TANNER': {'host': '0.0.0.0', 'port': 8090},
1717
'WEB': {'host': '0.0.0.0', 'port': 8091},
18-
'API': {'host': '0.0.0.0', 'port': 8092, 'auth': False, 'auth_signature': 'tanner_api_auth'},
18+
'API': {'host': '0.0.0.0', 'port': 8092},
1919
'PHPOX': {'host': '0.0.0.0', 'port': 8088},
2020
'REDIS': {'host': 'localhost', 'port': 6379, 'poolsize': 80, 'timeout': 1},
21+
'POSTGRES': {'host': 'localhost', 'port': 6379, 'poolsize': 80, 'timeout': 1, 'db_name':'tanner_db', 'user':'postgres', 'password':''},
2122
'EMULATORS': {'root_dir': '/opt/tanner'},
2223
'EMULATOR_ENABLED': {'sqli': True, 'rfi': True, 'lfi': True, 'xss': True, 'cmd_exec': True,
2324
'php_code_injection': True, 'php_object_injection': True, "crlf": True,
@@ -33,8 +34,7 @@
3334
'LOCALLOG': {'enabled': False, 'PATH': '/tmp/tanner_report.json'},
3435
'CLEANLOG': {'enabled': False},
3536
'REMOTE_DOCKERFILE': {'GITHUB': "https://raw.githubusercontent.com/mushorg/tanner/master/docker/"
36-
"tanner/template_injection/Dockerfile"},
37-
'SESSIONS': {"delete_timeout": 300}
37+
"tanner/template_injection/Dockerfile"}
3838
}
3939

4040

tanner/postgres_client.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import sqlalchemy import create_engine
2+
from tanner.config import TannerConfig
3+
4+
class Postgressclient:
5+
host=TannerConfig.get('POSTGRES', 'host')
6+
port=TannerConfig.get('POSTGRES', 'port')
7+
dbname=TannerConfig.get('POSTGRES', 'db_name')
8+
user=TannerConfig.get('POSTGRES', 'user')
9+
password=TannerConfig.get('POSTGRES', 'password')
10+
db_string="postgresql://{}:{}@{}:{}/{}".format(user, password, host, port, dbname)
11+
db = create_engine(db_string)

0 commit comments

Comments
 (0)