-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathHelper.py
93 lines (81 loc) · 4.16 KB
/
Helper.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
82
83
84
85
86
87
88
89
90
91
92
93
import Config
import os
import sys
import logging
import psutil
class Helper:
def __init__(self):
if Config.DEBUG_MODE is True:
logging.basicConfig(filename='log', level=Config.LOG_LEVEL, format='[%(asctime)s][%(levelname)s]: %(message)s')
def debug(self, text):
if Config.DEBUG_MODE is True:
logging.debug(text)
def warning(self, text):
if Config.DEBUG_MODE is True:
logging.warning(text)
def error(self, text):
if Config.DEBUG_MODE is True:
logging.error(text)
def info(self, text):
if Config.DEBUG_MODE is True:
logging.info(text)
def path(self, relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
def write_file(self, filename, content):
with open(filename, 'w') as f:
f.write(content)
f.close()
def safe_exit(self):
os = sys.platform
name = "tor"
if os == "win32":
name += ".exe"
for proc in psutil.process_iter():
if proc.name() == name:
proc.kill()
self.info("Killed tor...")
sys.exit(0)
def supergirl_pic(self):
print(' d8b 888')
print(' Y8P 888')
print(' 888')
print('.d8888b 888 88888888b. .d88b. 888d888 .d88b. 888888d888888')
print('88K 888 888888 "88bd8P Y8b888P" d88P"88b888888P" 888')
print('"Y8888b.888 888888 88888888888888 888 888888888 888')
print(' X88Y88b 888888 d88PY8b. 888 Y88b 888888888 888')
print(' 88888P\' "Y8888888888P" "Y8888 888 "Y88888888888 888')
print(' 888 888 ')
print(' 888 Y8b d88P ')
print(' 888 "Y88P" ')
def super_logo(self):
print(' \t\t\t,,########################################,,\n\
.*##############################################*\n\
,*####*:::*########***::::::::**######:::*###########,\n\
.*####: *#####*. :*###,.#######*,####*.\n\
*####: *#####* .###########* ,####*\n\
.*####: ,#######, ##########* :####*\n\
*####. :#########*, ,,,,,,,,. ,####:\n\
####* ,##############****************:,, .####*\n\
:####*#####################################**, *####.\n\
*############################################*, :####:\n\
.#############################################*,####*\n\
:#####:*****#####################################.\n\
*####: .,,,:*****###########,\n\
.*####, *######*\n\
.####* :*#######* ,#####*\n\
*###############*,,,,,,,,::**######,\n\
*##############################:\n\
*####*****##########**#####*\n\
.####*. :####*\n\
:####* .#####,\n\
*####: *####:\n\
.*####, *####*\n\
:####*####*\n\
*######,\n\
*##,')