Changeset - 853f2417ae5a
[Not reviewed]
default
0 1 0
Tyler Durden (virii) - 11 years ago 2014-01-22 20:11:02
virii@c3l.lu
Bridge recognition fixxed
1 file changed with 16 insertions and 13 deletions:
0 comments (0 inline, 0 general)
Scripts/update_server.pl
Show inline comments
 
@@ -10,20 +10,20 @@ by virii
 
use HTTP::Tiny;
 
use IO::Socket;
 
######## [defaults] ########
 
@configs = @ARGV if @ARGV;					 # perl updater_server.pl torrc torrc0 torrc1
 
@configs = qw(torrc torrc2) unless @ARGV;			 # OR hardcode every config file! like: torrc torrc0 torrc1 
 
$data_dir = '/var/lib/tor';					 # default data dir
 
$pidfile  = '/var/run/tor/tor.pid';				 # default pid file
 
$API_url = 'http://enn.lu';					 # will be ignored if /etc/ennstatus_updater.conf is present
 
@configs = @ARGV if @ARGV;                           # perl updater_server.pl torrc torrc0 torrc1
 
@configs = qw(torrc torrc2) unless @ARGV;            # OR hardcode every config file! like: torrc torrc0 torrc1 
 
$data_dir = '/var/lib/tor';                          # default data dir
 
$pidfile  = '/var/run/tor/tor.pid';                  # default pid file
 
$API_url = 'http://enn.lu';                          # will be ignored if /etc/ennstatus_updater.conf is present
 
######## [ennstatus URL - config file] ######
 
if (-e '/etc/ennstatus_updater.conf') {
 
	open ennstatus, "<", "/etc/ennstatus_updater.conf" || die "Cannot open 'ennstatus_updater.conf'!\n";
 
    		while (<ennstatus>) {
 
        		$ennstatus_url = $1 if /^ennstatus_url = (.+)/i;
 
    		}
 
	close ennstatus;
 
    open ennstatus, "<", "/etc/ennstatus_updater.conf" || die "Cannot open 'ennstatus_updater.conf'!\n";
 
            while (<ennstatus>) {
 
                $ennstatus_url = $1 if /^ennstatus_url = (.+)/i;
 
            }
 
    close ennstatus;
 
} else {
 
	$ennstatus_url = $API_url;
 
    $ennstatus_url = $API_url;
 
}
 
######## [loop through configs] ########
 
for (1..scalar @configs) {
 
@@ -31,7 +31,7 @@ for (1..scalar @configs) {
 
        while (<config>) {
 
            $server_name = $1       if /^Nickname (\w+)/i;
 
            $server_type = 'Exit'   if /^ExitPolicy accept \*:\*/i;
 
            $server_type = 'Relay'  if /^ExitPolicy reject \*:\*/i;
 
            $server_type = 'Relay'  if /^ExitPolicy reject \*:\*/i and $server_type ne 'Bridge';
 
            $server_type = 'Bridge' if /^BridgeRelay 1/i;
 
            $data_dir    = $1       if /^DataDirectory (.*)/i;
 
            $pidfile     = $1       if /^PidFile (.*)/i;
 
@@ -40,7 +40,8 @@ for (1..scalar @configs) {
 
        }
 
    close config;
 
######## [obfs check] ########  
 
    $obfs = 'False' if ($obfs ne "True" and $server_type == 'Bridge');
 
    $obfs = 'False' if $obfs ne 'True' and $server_type eq 'Bridge';
 
print $obfs . "\n";
 
######## [ip check] ########    
 
    if ($ip == "") {
 
        $socket = new IO::Socket::INET ( PeerAddr => "google.com",
 
@@ -93,3 +94,5 @@ print $request->{content};
 
######## [end of loop] ########
 
}
 

	
 

	
 

	
0 comments (0 inline, 0 general)