forked from shad0w008/Scanver
-
Notifications
You must be signed in to change notification settings - Fork 2
/
settings.py
69 lines (59 loc) · 2.17 KB
/
settings.py
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
#!/usr/bin/env python
# encoding=utf-8
#codeby 道长且阻
#email @ydhcui/QQ664284092
#https://github.com/ydhcui/Scanver
import os
import sys
sys.path.append('./lib')
import configparser
DEBUG = True
CONFNAME = 'conf.ini'
#获取脚本文件的当前路径
def cur_file_dir():
path = sys.path[0]
#判断为脚本文件还是编译后的文件,如果是脚本文件,则返回的是脚本的目录,
if os.path.isdir(path):
return path
elif os.path.isfile(path):
return os.path.dirname(path)
config = configparser.ConfigParser()
SELFPATH = cur_file_dir()
print(SELFPATH)
config.read(os.path.join(SELFPATH,CONFNAME))
###
DATAPATH = os.path.join(SELFPATH,config.get('data','datapath'))
LOGSPATH = os.path.join(SELFPATH,config.get('data','logspath'))
UPLOADPATH = os.path.join(SELFPATH,config.get('data','uploadpath'))
REPORTPATH = os.path.join(SELFPATH,config.get('data','reportpath'))
#数据库配置
DATABASE = {
'datatype':config.get('db','datatype'), #'sqlite',#mysql sqlite
'datahost':config.get('db','datahost'), #'127.0.0.1',
'dataport':config.getint('db','dataport'), #3306,
'dataname':config.get('db','dataname'), #'topsecvm',
'username':config.get('db','username'), #'root',
'password':config.get('db','password'), #'sa',
'datapath':config.get('db','datapath'), #'./data/userdata.db'
'charset' :'utf8mb4',
}
#web网站配置
SETTINGS = {
"debug" : DEBUG,
"gzip" : True,
"autoescape" : True,
"xsrf_cookies" : False,
"login_url" : "/#/login",
"cookie_secret" : "e1tuaV1UW3NpXU9bMDFdUFtnZV1TW2RhXUVbc2FdQ1tiaV19",
"template_path" : os.path.join(os.path.dirname(os.path.realpath(__file__)), config.get('web','template_path')),
"static_path" : os.path.join(os.path.dirname(os.path.realpath(__file__)), config.get('web','static_path')),#"./dist"),
}
FILETYPELIST = tuple(config.get('scan','filetype').split('|'))
REDIS = {
'host':config.get('redis','rhost'),
'port':config.get('redis','rport'),
'auth':config.get('redis','rauth'),
}
CLIENTID = config.get('node','nodeid')
if __name__ == '__main__':
print(tuple(config.get('scan','filetype').split('|')))