-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmainP.py
More file actions
123 lines (110 loc) · 3.61 KB
/
mainP.py
File metadata and controls
123 lines (110 loc) · 3.61 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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import os
import platform
import atexit
import shutil
import argparse
from program.downloadImage import dlImage as m1
from program.userSearch import main as m2
from program.picker import picker as m3
from program.md5_to_post import run as m4
from program.dlallfromusr import Program as m5
from program.compress_all import Compress as m6
from program.encrypt_downloads import DownloadEncryptor, DownloadDecryptor
OS = platform.system()
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--threads', help='# of threads to use. Default is 1.', required=False)
args, *leftover = parser.parse_known_args()
if args.threads is not None:
if not (args.threads).isdigit():
print('Number of threads must be a number')
exit()
else:
num_of_threads = int(args.threads)
if num_of_threads > 5 or num_of_threads < 1:
print('Out of bounds. # of threads must be between 1-5')
exit()
else:
num_of_threads = 1
thread_string = f"[!] "
if num_of_threads > 1:
thread_string += f"{num_of_threads} THREADS"
else:
thread_string += 'SINGLE-THREADED'
@atexit.register
def clear_pycache():
try:
shutil.rmtree('__pycache__/')
except FileNotFoundError:
pass
finally:
shutil.rmtree('program/__pycache__')
banner = """
#########################################
# ################## ################## #
# # # # # #
# # ############# # ############# #
# # # # # #
# # # # # #
# # # # # #
# # ######## # ############# #
# # # # # #
# # ######## # ######## # #
# # # # # # # #
# # # # # # # #
# # # # # # # #
# # ############# # ######## # #
# # # # # #
# ################## ################## #
#########################################
"""
def menu():
_EXIT = False
while not _EXIT:
if OS == 'Linux':
os.system('clear')
elif OS == 'Windows':
os.system('cls')
print(banner)
print(f'OPTIONS:\t{thread_string}\n')
print('\t Download Image [1]')
print('\t User Search [2]')
print('\t Explorer [3]')
print('\t MD5 To Post [4]')
print('\t Download All From User [5]')
print('\t Compress Downloads [6]')
print('\t Encrypt Downloads [7]')
print('\t Decrypt Downloads [8]')
print('\t Exit Program [99]')
option = input('\nChoice: ')
if option == '1':
m1(RETURN=False)
elif option == '2':
m2(RETURN=False)
elif option == '3':
picOrUser = (input('Content or User? [C/u] ')).lower()
if picOrUser == 'u':
m3(MODE='usr')
elif picOrUser == 'c':
m3(MODE='img')
elif option == '4':
m4()
elif option == '5':
m5(num_of_threads)
elif option == '6':
compress = m6()
compress.run_all()
elif option == '7':
de = DownloadEncryptor()
de.start()
elif option == '8':
de = DownloadDecryptor()
de.start()
elif option == '99':
_EXIT = True
print('Thanks for using! Goodbye!')
if not _EXIT:
input('Press enter to continue...')
if __name__ == '__main__':
menu()
else:
pass