-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadb.py
More file actions
33 lines (29 loc) · 1.24 KB
/
Copy pathadb.py
File metadata and controls
33 lines (29 loc) · 1.24 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
try:
from platform import system as os_system
from time import sleep
from subprocess import run
except ImportError as e:
pass
print('Python package error: ' + str(e).strip('Message: '))
exit()
class YedortADB():
def __init__(self, adb):
self.adb = adb if os_system().lower() == 'windows' else 'adb'
run(self.adb + ' devices -l', shell=True)
def reset_ip(self):
new_public_ip = public_ip = fetch_url('https://bot.whatismyipaddress.com')
while new_public_ip is None or new_public_ip == public_ip:
run(self.adb + ' shell su -c \'settings put global airplane_mode_on 1\'', shell=True)
run(self.adb + ' shell su -c \'am broadcast -a android.intent.action.AIRPLANE_MODE\'', shell=True)
sleep(3)
run(self.adb + ' shell su -c \'settings put global airplane_mode_on 0\'', shell=True)
run(self.adb + ' shell su -c \'am broadcast -a android.intent.action.AIRPLANE_MODE\'', shell=True)
sleep(3)
new_public_ip = fetch_url('https://bot.whatismyipaddress.com')
def quit(self):
try:
run(self.adb + ' kill-server', shell=True)
except:
pass