Changeset - a3e0d30e6906
[Not reviewed]
default
0 1 0
Dennis Fink - 11 years ago 2014-07-16 19:57:17
dennis.fink@c3l.lu
Fix flashproxy in update script
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
Scripts/update_server.py
Show inline comments
 
import subprocess
 
import configparser
 
import re
 
import json
 

	
 
import requests
 

	
 
from ast import literal_eval
 

	
 
OBFS_REGEX = re.compile(r'^ServerTransportPlugin (obfs\d+|scramblesuit)')
 
FTEPROXY_REGEX = re.compile(r'^ServerTransportPlugin fte')
 
FLASHPROXY_REGEX = re.compile(r'^ServerTransportPlugin webproxy')
 
FLASHPROXY_REGEX = re.compile(r'^ServerTransportPlugin websocket')
 
MEEKPROXY_REGEX = re.compile(r'^ServerTransportPlugin meek')
 

	
 
IP_REGEX = re.compile(r'^(OutboundBindAddress)\ (\d{1,3}\.\d{1,3}\.\d{1,3}\.'
 
                      r'\d{1,3})')
 

	
 

	
 
def read_tor_config(configfile='/etc/tor/torrc'):
 

	
 
    with open(configfile) as fb:
 
        lines = {line[:-1] for line in fb if not line.startswith('#')}
 

	
 
    lines = {line for line in filter(None, lines)}
 
    return lines
 

	
 

	
 
def get_tor_status(name='tor'):
 

	
 
    try:
 
        pids = subprocess.check_output(['pidof', 'tor']).decode('utf-8')[:-1]
 
        pids = pids.split(' ')
 
        pid_file = '.'.join([name, 'pid'])
 
        pid = open('/'.join(['/var', 'run', 'tor', pid_file])).readline()[:-1]
 

	
 
        if str(pid) in pids:
0 comments (0 inline, 0 general)