-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
executable file
·81 lines (59 loc) · 2.09 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import time
from tetherspot.adb import (disable_mobile_data, enable_mobile_data,
is_package_running, is_screen_on, is_unlocked,
is_wifi_hotspot_enabled, press_power_button,
start_everyproxy, stop_everyproxy,
toggle_wifi_hotspot)
from tetherspot.gnirehtet import run_gnirehtet_pc, stop_gnirehtet_android
def main():
while not is_unlocked():
print('Unlock screen\n')
if not is_screen_on():
press_power_button()
time.sleep(3)
print('(Re)starting EveryProxy')
stop_everyproxy()
start_everyproxy()
print('EveryProxy status:', is_package_running('com.gorillasoftware.everyproxy'))
print()
print('Starting WiFi hotspot if needed')
is_hotspot_enabled = is_wifi_hotspot_enabled()
print('WiFi hotspot status:', is_hotspot_enabled)
while not is_hotspot_enabled:
print('Try enabling WiFi hotspot')
toggle_wifi_hotspot()
is_hotspot_enabled = is_wifi_hotspot_enabled()
print()
print('Disabling mobile data to ensure VPN sharing')
disable_mobile_data()
print()
print('Starting Gniregtet')
if True: # TODO: If gnirehtet installed
press_power_button()
run_gnirehtet_pc()
while not is_unlocked():
print('\nUnlock screen')
if not is_screen_on():
press_power_button()
time.sleep(3)
print()
print('Stopping Gniregtet')
stop_gnirehtet_android()
print()
print('Stopping EveryProxy')
stop_everyproxy()
print('EveryProxy status:', is_package_running('com.gorillasoftware.everyproxy'))
print()
print('Stopping WiFi hotspot if needed')
is_hotspot_enabled = is_wifi_hotspot_enabled()
print('WiFi hotspot status:', is_hotspot_enabled)
while is_hotspot_enabled:
print()
print('Try disabling WiFi hotspot')
toggle_wifi_hotspot()
is_hotspot_enabled = is_wifi_hotspot_enabled()
print()
print('Enabling mobile data')
enable_mobile_data()
if __name__ == '__main__':
main()