Added dev config scripts
parent
88146a5690
commit
567af997d7
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""Enable dev default config"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
conf = json.load(open('static-data/default_config.json', 'r'))
|
||||||
|
|
||||||
|
conf['tor']['use_existing_tor'] = False
|
||||||
|
conf['tor']['existing_control_port'] = 0
|
||||||
|
conf['tor']['existing_control_password'] = ""
|
||||||
|
conf['tor']['existing_socks_port'] = 0
|
||||||
|
|
||||||
|
conf['general']['dev_mode'] = False
|
||||||
|
conf['general']['insert_deniable_blocks'] = True
|
||||||
|
conf['general']['random_bind_ip'] = True
|
||||||
|
|
||||||
|
json.dump(conf, open('static-data/default_config.json', 'w'), sort_keys=True, indent=4)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""Enable dev default config"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
conf = json.load(open('static-data/default_config.json', 'r'))
|
||||||
|
|
||||||
|
if input("Reuse Tor? y/n:").lower() == 'y':
|
||||||
|
conf['tor']['use_existing_tor'] = True
|
||||||
|
conf['tor']['existing_control_port'] = int(input("Enter existing control port:"))
|
||||||
|
conf['tor']['existing_control_password'] = input("Tor pass:")
|
||||||
|
conf['tor']['existing_socks_port'] = int(input("Existing socks port:"))
|
||||||
|
|
||||||
|
conf['general']['dev_mode'] = True
|
||||||
|
conf['general']['insert_deniable_blocks'] = False
|
||||||
|
conf['general']['general.random_bind_ip'] = False
|
||||||
|
|
||||||
|
json.dump(conf, open('static-data/default_config.json', 'w'), sort_keys=True, indent=4)
|
||||||
|
|
|
@ -9,6 +9,7 @@ import sqlite3
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from gevent import time
|
from gevent import time
|
||||||
from gevent import spawn
|
from gevent import spawn
|
||||||
|
from stem.connection import IncorrectPassword
|
||||||
|
|
||||||
import toomanyobjs
|
import toomanyobjs
|
||||||
|
|
||||||
|
@ -114,8 +115,15 @@ def daemon():
|
||||||
|
|
||||||
if use_existing_tor:
|
if use_existing_tor:
|
||||||
net.socksPort = config.get('tor.existing_socks_port')
|
net.socksPort = config.get('tor.existing_socks_port')
|
||||||
|
try:
|
||||||
net.myID = create_onion_service(
|
net.myID = create_onion_service(
|
||||||
port=net.apiServerIP + ':' + str(net.hsPort))[0]
|
port=net.apiServerIP + ':' + str(net.hsPort))[0]
|
||||||
|
except IncorrectPassword:
|
||||||
|
logger.error('Invalid Tor control password', terminal=True)
|
||||||
|
localcommand.local_command('shutdown')
|
||||||
|
cleanup.delete_run_files()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if not net.myID.endswith('.onion'):
|
if not net.myID.endswith('.onion'):
|
||||||
net.myID += '.onion'
|
net.myID += '.onion'
|
||||||
with open(filepaths.tor_hs_address_file, 'w') as tor_file:
|
with open(filepaths.tor_hs_address_file, 'w') as tor_file:
|
||||||
|
|
Loading…
Reference in New Issue