-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shell.py
100 lines (93 loc) · 3.57 KB
/
Shell.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
94
95
96
97
98
99
100
#Code by Sergio00166
from os import system as cmd
from os import environ, getcwd
from sys import setrecursionlimit, path, argv
from subprocess import check_output
version="alfa v0.1.71.0"
def clsmenu(): cmd("cls"); print(menu,end="\n\n")
def var(arg1):
direct=directory[:len(directory)-1]
arg1=arg1.replace("'$dir'","\f").replace("$dir",direct)
arg1=arg1.replace("\f","$dir").replace("'$ver'","\f")
arg1=arg1.replace("$ver",version).replace("\f","$ver")
for key, value in environ.items():
if not key=="PATH":
arg1=arg1.replace(("'$"+key.lower()+"'"), "\f")
arg1=arg1.replace(("$"+key.lower()), value)
arg1=arg1.replace("\f", ("$"+key.lower()))
return arg1
def cli(args):
global directory
try:
if not len(oldir)==1:
if not directory==oldir[1]: oldir.append(directory)
else: oldir.append(directory)
if not args:
print(fix+directory+flechas, end="")
try: a=str(input())
except: a=""
else: a=args+" "
a=forvar(a, directory)
inp=a.replace("';'","\f").split(";")
for a in inp:
a=var(a+" ").replace("\f",";").replace("';'", ";")
a=a.lstrip().rstrip()
if " " in a:
arg=a[:a.find(" ")]
arg1=a[a.find(" ")+1:].lstrip().rstrip()
else: arg=a; arg1=""
if arg=="exit":
database("mp3","-quit","","")
exit()
elif arg=="clear": clsmenu()
else:
if not arg=="":
if arg=="sudo": arg1=arg1.replace(";","';'")
try: directory=database(arg,arg1,directory,str(oldir[0]))
except KeyboardInterrupt: pass
except: print(ferror)
if not len(oldir)==1:
if not directory==oldir[1]: oldir.pop(0)
if args: input("Press any key to exit . . . ")
except KeyboardInterrupt: pass
def main(args):
global directory
if args=="#-FIXSUDIRECT-#":
directory=userdir.replace("\\\\","\\"); args=""
if not len(args)==0:
if args[:1]==";":
clsmenu()
directory=args[1:]
while True: cli(False)
else: cli(args)
else:
while True: cli(False)
if __name__ == "__main__":
cmd("title OEPWS shell")
setrecursionlimit(10**6)
for x in path:
if "site-packages" in x: path.remove(x)
for x in path:
if "site-packages" in x: path.remove(x)
path.append(path[0]+chr(92)+"import")
path.append(path[0]+chr(92)+"import\\other")
from colors import color
menu=str(color(" OEPWS by Sergio1260 ","G")+"\n "+
color(version,"R")+color(" on ","G")+
color("Windows OS","B"))
clsmenu(); from forvar import main as forvar
flechas=str(color(" >> ","G-"))
ferror=color("\n FATAL ERROR\n","R")
raw=str(check_output("echo %userprofile%",shell=True))
userdir=raw[2:len(raw)-4].replace(chr(92)+chr(92),chr(92))
userdir=userdir.replace(chr(92),chr(92)+chr(92))
path.append(path[0] + chr(92) + 'windows')
from database import database
user=str(check_output("whoami")); oldir=[]
user=user[2:len(user)-5]; args=" ".join(argv[1:])
user=user[user.find(chr(92)+chr(92))+2:]
del raw; directory=getcwd()+chr(92)
directory=directory.replace("\\\\","\\")
oldir.append(directory)
fix="\r "+str(color(user,"B"))+str(color(" ","B-"))
main(args)