Skip to content

Commit

Permalink
complete testing running the program through bash script
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragon2fly committed Nov 13, 2016
1 parent adbc8c2 commit ab8a9a7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def __init__(self, path):
self.filter = OrderedDict([('country', 'all'), ('port', 'all'), ('score', 'all')])

self.dns = OrderedDict([('fix_dns', 'yes'),
('dns', '8.8.8.8, 8.8.8.8, 84.200.69.80, 208.67.222.222')])
('dns', '8.8.8.8, 84.200.69.80, 208.67.222.222')])

self.openvpn = {'verbose': 'yes'}

Expand Down
1 change: 1 addition & 0 deletions run
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
stdbuf -oL python vpn_indicator.py > indicator.log &
sleep 0.5
sudo python vpnproxy_tui.py
16 changes: 9 additions & 7 deletions vpn_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
import time
import platform

if 'buntu' in platform.platform() and \
not Popen(['pgrep', '-f', 'python vpn_indicator.py'], stdout=PIPE).communicate()[0]:
print 'Launch vpn_indicator'
else:
sys.exit()

try:
import gi
gi.require_version('Gtk', '3.0')
Expand Down Expand Up @@ -112,7 +106,8 @@ def check_io(self, q_info):
def send(self, msg):
if msg == 'dead':
self.is_dead = True
self.sock.shutdown(socket.SHUT_RDWR)
if self.is_connected:
self.sock.shutdown(socket.SHUT_RDWR)

elif self.is_connected:
try:
Expand Down Expand Up @@ -375,6 +370,13 @@ def callback(self):


if __name__ == '__main__':
another_me = Popen(['pgrep', '-f', 'python vpn_indicator.py'], stdout=PIPE).communicate()[0]
another_me = another_me.strip().split('\n')

if 'buntu' not in platform.platform() or len(another_me) > 1:
print 'exist another me', another_me[1:]
sys.exit()

# queue for interacting between indicator and server
q = Queue()

Expand Down
6 changes: 3 additions & 3 deletions vpnproxy_tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
__maintainer__ = "duc_tin"
__email__ = "nguyenbaduc.tin@gmail.com"

import os, sys
import os, sys, signal
import base64
import time
import datetime
from copy import deepcopy
from config import *
from Queue import Queue
from Queue import Queue, Empty
from subprocess import call, Popen, PIPE
from threading import Thread
from collections import deque, OrderedDict
from vpn_indicator import *
from vpn_indicator import InfoClient

# Get sudo privilege
euid = os.geteuid()
Expand Down

0 comments on commit ab8a9a7

Please sign in to comment.