-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathinstall.py
92 lines (85 loc) · 2.6 KB
/
install.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
import os, sys
from sys import platform as _platform
import shutil
try:
from termcolor import colored
except ImportError:
print '[!] Failed to Import termcolor'
try:
choice = raw_input('[*] Wana install termcolor? [y/n] ')
except KeyboardInterrupt:
print '\n[!] User Interrupted Choice'
sys.exit(1)
if choice.strip().lower()[0] == 'y':
print '[*] Attempting to Install termcolor... ',
sys.stdout.flush()
try:
import pip
pip.main(['install', '-q', 'termcolor==1.1.0'])
from termcolor import colored
print '[DONE]'
except Exception:
print '[FAIL]'
sys.exit(1)
elif choice.strip().lower()[0] == 'n':
print '[*] User Denied Auto-install'
sys.exit(1)
else:
print '[!] Invalid Decision'
sys.exit(1)
try:
import colorama
except ImportError:
print '[!] Failed to Import colorama'
try:
choice = raw_input('[*] Wana install colorama? [y/n] ')
except KeyboardInterrupt:
print '\n[!] User Interrupted Choice'
sys.exit(1)
if choice.strip().lower()[0] == 'y':
print '[*] Attempting to Install colorama... ',
sys.stdout.flush()
try:
import pip
pip.main(['install', '-q', 'colorama==0.3.9'])
import colorama
print '[DONE]'
except Exception:
print '[FAIL]'
sys.exit(1)
elif choice.strip().lower()[0] == 'n':
print '[*] User Denied Auto-install'
sys.exit(1)
else:
print '[!] Invalid Decision'
sys.exit(1)
if _platform == 'win32':
import colorama
colorama.init()
def yellow(text):
return colored(text, 'yellow', attrs=['bold'])
def green(text):
return colored(text, 'green', attrs=['bold'])
def red(text):
return colored(text, 'red', attrs=['bold'])
def cyan(text):
return colored(text, 'cyan', attrs=['bold'])
loc = os.getcwd()
file = loc+'\pystat.bat'
contfile = loc+'\pystat_core.py'
cont = '''@echo off
python %s
pause'''%(contfile)
out = open(file, 'w')
out.write(cont)
out.close()
os.system('cls')
print green("\n\n\n[!] Script Generated pystat.bat file")
dest = os.environ['WINDIR']
full_file_name = file
try:
shutil.copy(full_file_name, dest)
except IOError:
print red("\nError:")+cyan(" Permission denied While moving pystat.bat to C:\Windows")
print green("\n[!] Please copy pystat.bat file to C:\Windows")
print green("\n[+] For test open CMD and enter pystat\n\n\n")