-
Notifications
You must be signed in to change notification settings - Fork 1
/
tool-inify.py
60 lines (52 loc) · 2.21 KB
/
tool-inify.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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import config
from syslog import *
s_pri = {
str(LOG_EMERG): "log_emerg",
str(LOG_ALERT): "log_alert",
str(LOG_CRIT): "log_crit",
str(LOG_ERR): "log_err",
str(LOG_WARNING): "log_warning",
str(LOG_NOTICE): "log_notice",
str(LOG_INFO): "log_info",
str(LOG_DEBUG): "log_debug"
}
s_fac = {
str(LOG_KERN): "log_kern",
str(LOG_USER): "log_user",
str(LOG_MAIL): "log_mail",
str(LOG_DAEMON): "log_daemon",
str(LOG_AUTH): "log_auth",
str(LOG_LPR): "log_lpr",
str(LOG_NEWS): "log_news",
str(LOG_UUCP): "log_uucp",
str(LOG_CRON): "log_cron",
str(LOG_SYSLOG): "log_syslog",
str(LOG_LOCAL0): "log_local0",
str(LOG_LOCAL1): "log_local1",
str(LOG_LOCAL2): "log_local2",
str(LOG_LOCAL3): "log_local3",
str(LOG_LOCAL4): "log_local4",
str(LOG_LOCAL5): "log_local5",
str(LOG_LOCAL6): "log_local6",
str(LOG_LOCAL7): "log_local7"
}
with open('config.ini', 'w') as out:
out.write("[BluRouter]\n")
out.write("# Autogenerated. See config-example.ini for descriptions.\n\n")
out.write("udp_ip = "+config.UDP_IP +"\n")
out.write("udp_subnet = "+config.UDP_SUBNET +"\n")
out.write("udp_broadcast = "+config.UDP_BROADCAST +"\n")
out.write("udp_port = "+str(config.UDP_PORT) +"\n\n")
out.write("allow_ranges = "+", ".join(config.ALLOW_RANGES) +"\n")
out.write("protected_nets = "+", ".join(config.PROTECTED_NETS)+"\n\n")
out.write("syslog_pri = "+s_pri[str(config.syslog_pri)] +"\n")
out.write("syslog_facil = "+s_fac[str(config.syslog_facil)] +"\n\n")
out.write("routefile = "+str(config.routesfile) +"\n")
out.write("pidfile = "+str(config.pidfile) +"\n\n")
out.write("hello_interval = "+str(config.hello_interval) +"\n")
out.write("hello_timeout = "+str(config.hello_timeout) +"\n")
out.write("select_timeout = "+str(config.select_timeout) +"\n")
out.write("max_ttl = "+str(config.max_ttl) +"\n")
out.write("newip_sendnets = "+str(config.newip_sendnets) +"\n")