diff --git a/oml/tor.py b/oml/tor.py index 8ce89de..d43df76 100644 --- a/oml/tor.py +++ b/oml/tor.py @@ -1,4 +1,5 @@ import os +import re import sys import subprocess from threading import Thread @@ -45,6 +46,15 @@ CookieAuthentication 1 DataDirectory {base}/TorData DirReqStatistics 0 '''.strip().format(base=settings.data_path)) + else: + with open(torrc, 'r') as fd: + data = fd.read() + modified_data = re.sub('DataDirectory.*?/TorData', + 'DataDirectory {base}/TorData'.format(base=settings.data_path), data) + if data != modified_data: + with open(torrc, 'w') as fd: + fd.write(modified_data) + return defaults, torrc def run(self):