Skip to content

Commit 82eaacf

Browse files
Modified check_java and some linting.
1 parent e0ca554 commit 82eaacf

File tree

8 files changed

+41
-54
lines changed

8 files changed

+41
-54
lines changed

helpers/custom_ci.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
except ImportError:
1010
try:
1111
os.system('pip3 install termcolor')
12-
except:
12+
except Exception:
1313
os.system('python3 -m pip install termcolor')
1414

1515
if not (os.path.isdir('log')):

helpers/device_serial_id.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ def init(mode, tcp_ip='', tcp_port=''):
1010
f'>>> I am in device_serial_id.init({mode=!s}, {tcp_ip=!s}, {tcp_port=!s})', is_print=False)
1111
# Detect OS
1212
is_windows = False
13-
is_linux = False
1413
if platform.system() == 'Windows':
1514
is_windows = True
16-
if platform.system() == 'Linux':
17-
is_linux = True
1815

1916
# Global command line helpers
2017
curr_dir = os.path.dirname(os.path.realpath(__file__))
@@ -58,7 +55,6 @@ def init(mode, tcp_ip='', tcp_port=''):
5855
return ''
5956

6057
device_to_connect = None
61-
i = 1
6258
if(len(output) == 2):
6359
if(output[1].split()[1] == 'offline'):
6460
custom_print(
@@ -113,7 +109,7 @@ def init(mode, tcp_ip='', tcp_port=''):
113109
return ''
114110
''' Possible outputs
115111
['connected', 'to', '192.168.43.130:5555']
116-
['failed', 'to', 'authenticate', 'to', '192.168.43.130:5555']
112+
['failed', 'to', 'authenticate', 'to', '192.168.43.130:5555']
117113
['cannot', 'connect', 'to', '192.168.43.130:5555:', 'No', 'connection', 'could', 'be', 'made', 'because', 'the', 'target', 'machine', 'actively', 'refused', 'it.', '(10061)']
118114
'''
119115
else:

helpers/handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import re
33
import shutil
44
import subprocess
5-
from subprocess import check_output, getoutput
5+
from subprocess import getoutput
66
try:
77
import requests
88
from packaging import version
99
from tqdm import tqdm
1010
except ImportError:
1111
try:
1212
os.system('pip3 install packaging requests tqdm')
13-
except:
13+
except Exception:
1414
os.system('python3 -m pip install packaging requests tqdm')
1515

1616
from custom_ci import custom_input, custom_print

non_essentials/DATE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
06/03/2022
1+
08/03/2022

protect.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import datetime
21
import os
32
import platform
43
import shutil
@@ -156,12 +155,12 @@ def show_banner():
156155
banner_content = '''
157156
================================================================================
158157
======== ========
159-
======== db d8b db .d8b. db dD d8888b. d8888b. d88888b ========
160-
======== 88 I8I 88 d8' `8b 88 ,8P' 88 `8D 88 `8D 88' ========
161-
======== 88 I8I 88 88ooo88 88,8P 88 88 88oooY' 88ooooo ========
162-
======== Y8 I8I 88 88~~~88 C8888D 88`8b 88 88 88~~~b. 88~~~~~ ========
163-
======== `8b d8'8b d8' 88 88 88 `88. 88 .8D 88 8D 88. ========
164-
======== `8b8' `8d8' YP YP YP YD Y8888D' Y8888P' Y88888P ========
158+
======== db d8b db .d8b. db dD d8888b. d8888b. d88888b ========
159+
======== 88 I8I 88 d8' `8b 88 ,8P' 88 `8D 88 `8D 88' ========
160+
======== 88 I8I 88 88ooo88 88,8P 88 88 88oooY' 88ooooo ========
161+
======== Y8 I8I 88 88~~~88 C8888D 88`8b 88 88 88~~~b. 88~~~~~ ========
162+
======== `8b d8'8b d8' 88 88 88 `88. 88 .8D 88 8D 88. ========
163+
======== `8b8' `8d8' YP YP YP YD Y8888D' Y8888P' Y88888P ========
165164
======== ========
166165
================================================================================
167166
'''

restore_whatsapp.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import argparse
2-
import datetime
32
import os
43
import platform
54
import subprocess
@@ -57,12 +56,12 @@ def show_banner():
5756
banner_content = '''
5857
================================================================================
5958
======== ========
60-
======== db d8b db .d8b. db dD d8888b. d8888b. d88888b ========
61-
======== 88 I8I 88 d8' `8b 88 ,8P' 88 `8D 88 `8D 88' ========
62-
======== 88 I8I 88 88ooo88 88,8P 88 88 88oooY' 88ooooo ========
63-
======== Y8 I8I 88 88~~~88 C8888D 88`8b 88 88 88~~~b. 88~~~~~ ========
64-
======== `8b d8'8b d8' 88 88 88 `88. 88 .8D 88 8D 88. ========
65-
======== `8b8' `8d8' YP YP YP YD Y8888D' Y8888P' Y88888P ========
59+
======== db d8b db .d8b. db dD d8888b. d8888b. d88888b ========
60+
======== 88 I8I 88 d8' `8b 88 ,8P' 88 `8D 88 `8D 88' ========
61+
======== 88 I8I 88 88ooo88 88,8P 88 88 88oooY' 88ooooo ========
62+
======== Y8 I8I 88 88~~~88 C8888D 88`8b 88 88 88~~~b. 88~~~~~ ========
63+
======== `8b d8'8b d8' 88 88 88 `88. 88 .8D 88 8D 88. ========
64+
======== `8b8' `8d8' YP YP YP YD Y8888D' Y8888P' Y88888P ========
6665
======== ========
6766
================================================================================
6867
'''

view_extract.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import argparse
2-
import datetime
32
import os
43
import platform
54
import re
@@ -19,8 +18,6 @@
1918
if platform.system() == 'Linux':
2019
is_linux = True
2120

22-
# Global variables
23-
global is_java_installed
2421

2522
# Global command line helpers
2623
tmp = 'tmp/'
@@ -37,38 +34,32 @@ def main():
3734
custom_print('>>> I am in view_extract.main()', is_print=False)
3835
os.system('cls' if os.name == 'nt' else 'clear')
3936
show_banner()
40-
is_java_installed = check_java()
37+
check_java()
4138
extract_self(is_tar_only=is_tar_only)
4239

4340

4441
def check_java():
4542
custom_print('>>> I am in view_extract.check_java()', is_print=False)
46-
# TODO: Variable -s_java_installed scope problems.
4743
java_version = ''
4844
out = getoutput('java -version')
4945
if(out):
5046
java_version = re.findall('(?<=version ")(.*)(?=")', out)
5147
else:
5248
custom_print(
5349
'Could not get output of \"java -version\" in \"view_extract.py\"', 'red')
54-
return False
55-
if(java_version):
56-
is_java_installed = True
57-
else:
58-
is_java_installed = False
59-
if is_java_installed:
50+
kill_me()
51+
52+
if java_version:
6053
custom_print(
6154
f'Found Java v{java_version[0]} installed on system. Continuing...')
62-
return is_java_installed
6355
else:
6456
is_no_java_continue = custom_input(
6557
'It looks like you don\'t have JAVA installed on your system. If you are sure that JAVA is installed you can (C)ontinue with the process or (S)top?: ', 'red') or 's'
6658
if(is_no_java_continue.upper() == 'C'):
6759
custom_print(
6860
'Continuing without detecting JAVA...', 'yellow')
69-
return is_java_installed
7061
else:
71-
kill_me()
62+
kill_me('Can not view extract without java installed on system!')
7263

7364

7465
def clean_tmp():
@@ -78,9 +69,12 @@ def clean_tmp():
7869
shutil.rmtree(tmp)
7970

8071

81-
def kill_me():
82-
custom_print('>>> I am in view_extract.kill_me()', is_print=False)
72+
def kill_me(reason: str = ''):
73+
custom_print(
74+
f'>>> I am in view_extract.kill_me({reason=!s})', is_print=False)
8375
custom_print('\n', is_get_time=False)
76+
if reason:
77+
custom_print(reason)
8478
custom_print('Exiting...')
8579
os.system(
8680
'bin\\adb.exe kill-server') if(is_windows) else os.system('adb kill-server')
@@ -202,12 +196,12 @@ def show_banner():
202196
banner_content = '''
203197
================================================================================
204198
======== ========
205-
======== db d8b db .d8b. db dD d8888b. d8888b. d88888b ========
206-
======== 88 I8I 88 d8' `8b 88 ,8P' 88 `8D 88 `8D 88' ========
207-
======== 88 I8I 88 88ooo88 88,8P 88 88 88oooY' 88ooooo ========
208-
======== Y8 I8I 88 88~~~88 C8888D 88`8b 88 88 88~~~b. 88~~~~~ ========
209-
======== `8b d8'8b d8' 88 88 88 `88. 88 .8D 88 8D 88. ========
210-
======== `8b8' `8d8' YP YP YP YD Y8888D' Y8888P' Y88888P ========
199+
======== db d8b db .d8b. db dD d8888b. d8888b. d88888b ========
200+
======== 88 I8I 88 d8' `8b 88 ,8P' 88 `8D 88 `8D 88' ========
201+
======== 88 I8I 88 88ooo88 88,8P 88 88 88oooY' 88ooooo ========
202+
======== Y8 I8I 88 88~~~88 C8888D 88`8b 88 88 88~~~b. 88~~~~~ ========
203+
======== `8b d8'8b d8' 88 88 88 `88. 88 .8D 88 8D 88. ========
204+
======== `8b8' `8d8' YP YP YP YD Y8888D' Y8888P' Y88888P ========
211205
======== ========
212206
================================================================================
213207
'''

wa_kdbe.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Auto Requirements installer.
2-
import datetime
32
import json
43
import os
54
import socket
@@ -15,7 +14,7 @@
1514
try:
1615
# Trying both methods of installations
1716
os.system('pip3 install --upgrade packaging psutil termcolor requests tqdm')
18-
except:
17+
except Exception:
1918
os.system(
2019
'python3 -m pip install --upgrade packaging psutil termcolor requests tqdm')
2120

@@ -298,7 +297,7 @@ def run_scrcpy(_is_scrcpy):
298297
custom_print(
299298
f'>>> I am in wa_kdbe.run_scrcpy({_is_scrcpy=!s})', is_print=False)
300299
if(_is_scrcpy):
301-
cmd = 'bin\scrcpy.exe --max-fps 15 -b 4M --always-on-top' if(
300+
cmd = 'bin\\scrcpy.exe --max-fps 15 -b 4M --always-on-top' if(
302301
is_windows) else 'scrcpy --max-fps 15 -b 4M --always-on-top'
303302
proc = subprocess.Popen(cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE,
304303
stderr=subprocess.PIPE, shell=False)
@@ -319,12 +318,12 @@ def show_banner():
319318
================================================================================
320319
======== Current release date: {release_date.strip()} ========
321320
======== ========
322-
======== db d8b db .d8b. db dD d8888b. d8888b. d88888b ========
323-
======== 88 I8I 88 d8' `8b 88 ,8P' 88 `8D 88 `8D 88' ========
324-
======== 88 I8I 88 88ooo88 88,8P 88 88 88oooY' 88ooooo ========
325-
======== Y8 I8I 88 88~~~88 C8888D 88`8b 88 88 88~~~b. 88~~~~~ ========
326-
======== `8b d8'8b d8' 88 88 88 `88. 88 .8D 88 8D 88. ========
327-
======== `8b8' `8d8' YP YP YP YD Y8888D' Y8888P' Y88888P ========
321+
======== db d8b db .d8b. db dD d8888b. d8888b. d88888b ========
322+
======== 88 I8I 88 d8' `8b 88 ,8P' 88 `8D 88 `8D 88' ========
323+
======== 88 I8I 88 88ooo88 88,8P 88 88 88oooY' 88ooooo ========
324+
======== Y8 I8I 88 88~~~88 C8888D 88`8b 88 88 88~~~b. 88~~~~~ ========
325+
======== `8b d8'8b d8' 88 88 88 `88. 88 .8D 88 8D 88. ========
326+
======== `8b8' `8d8' YP YP YP YD Y8888D' Y8888P' Y88888P ========
328327
======== ========
329328
================================================================================'''
330329

0 commit comments

Comments
 (0)