-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlinuxlook.py
268 lines (253 loc) · 7.97 KB
/
linuxlook.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
import getpass
import os
import random
import socket
from uuid import getnode as get_mac
import time
try:
import colorama
from colorama import Fore
except:
print("Colorama package not found, installing Colorama")
os.system("pip install colorama")
print('Termithon restart required')
print('closing in 5 seconds')
time.sleep(5)
exit()
mac = get_mac()
# Made in python
# collaborated with https://github.com/BigBoyTaco/ for this little update
# thanks for green1490#2863 for helping me with arguments
os.system('cls||clear')
print(Fore.MAGENTA)
print('Termithon')
print(Fore.LIGHTCYAN_EX)
idkdwij = '''
I D K K D W W I J
I D D K K D D W W W I J J
I D K K D W W W W I J J
'''
bigboytaco = '''
____ _ ____ _______
| _ \(_) | _ \ |__ __|
| |_) |_ __ _| |_) | ___ _ _| | __ _ ___ ___
| _ <| |/ _` | _ < / _ \| | | | |/ _` |/ __/ _ \
| |_) | | (_| | |_) | (_) | |_| | | (_| | (_| (_) |
|____/|_|\__, |____/ \___/ \__, |_|\__,_|\___\___/
__/ | __/ |
|___/ |___/ '''
print('The Python based terminal by' + idkdwij + 'it says idkdwij')
print(Fore.GREEN)
print("IRL Friend/ 2nd devloper" + bigboytaco)
print(Fore.LIGHTWHITE_EX)
print('The source is here github.com/IDkDwij/termithon')
#setup
global current_dir
global echo_on
echo_on = False
PY_warning_said = bool(False)
#get hostname
hostname = socket.gethostname()
#gets users ip addresss
ip = socket.gethostbyname(hostname)
#current user
curr_user = getpass.getuser()
def listToString(s):
str1 = ""
for ele in s:
str1 += ele
return str1
current_dir = os.getcwd()
commands = '''ls (shows files in current directory)
exit (exits program)
ip (gives you your ip)
hostname (gives you your computers id)
user (gives the user your logged on)
mac (gives you your mac addresss)
ping (lets you ping a website)
python3 (full python3 support [only if you have python3 installed])
pip (python pip command)
cd (change current working directory)
del (deletes file)
mkdir (creates folder)
echo (echo something or create something [not currently working])
clear (clear terminal)
curl (the curl command)
start (run something)
color (change text color)
For more help go to github.com/IDkDwij/termithon
'''
cur_color = Fore.WHITE
def main(current_dir, cur_color):
global old_dir
old_dir = current_dir
global cmd
cmd = input(Fore.GREEN + curr_user + "@" + hostname + Fore.LIGHTBLUE_EX + " ~\\ " + current_dir + cur_color + '$ ')
whatiscommand(current_dir,cur_color)
def whatiscommand(current_dir, cur_color):
args = cmd.split()
#help command
if args[0] == 'help':
print(commands)
main(current_dir, cur_color)
#ls command
elif args[0] == 'ls':
print(os.listdir(current_dir))
main(current_dir, cur_color)
elif args[0] == 'curl':
os.system(cmd)
main(current_dir, cur_color)
#start command
elif args[0] == "start":
os.system(cmd)
#cd command
elif args[0] == "cd":
args.remove('cd')
args = ' '.join(args)
if args[0] == "cd":
main(current_dir, cur_color)
old_dir = current_dir
if os.path.isdir(args) == True:
current_dir = args
main(args,cur_color)
elif os.path.isdir(old_dir + '\\' + args):
new_dir = old_dir + '\\' + args
current_dir = new_dir
main(new_dir,cur_color)
else:
print('The system cannot find the path specified. \n')
main(current_dir, cur_color)
#exit command
elif args[0] == 'exit':
exit()
#ip command
elif args[0] == 'ip':
print(ip)
main(current_dir, cur_color)
#hostname command
elif args[0] == 'hostname':
print(hostname)
main(current_dir, cur_color)
#users command
elif args[0] == 'user':
print(curr_user())
main(current_dir, cur_color)
#mac address command
elif args[0] == "mac":
print(mac)
main(current_dir, cur_color)
#ping command
elif args[0] == 'ping':
os.system(cmd)
main(current_dir, cur_color)
#clear command
elif args[0] == "clear":
os.system('cls||clear')
main(current_dir, cur_color)
elif args[0] == "mkdir":
try:
os.makedirs(args[1])
except:
os.makedirs(current_dir + args[1])
main(current_dir, cur_color)
elif args[0] == "del":
try:
os.remove(args[1])
except:
os.remove(current_dir + args[1])
main(current_dir, cur_color)
elif args[0] == 'echo':
args.remove('echo')
args = ' '.join(args)
print(args)
main(current_dir, cur_color)
#python command
elif args[0] == 'python3':
global PY_warning_said
if PY_warning_said == False:
print('warning, this reqires python3 to be installed')
PY_warning_said = True
os.system(cmd)
main(current_dir, cur_color)
else:
os.system(cmd)
main(current_dir, cur_color)
elif args[0] == "":
main(current_dir, cur_color)
elif "color" in cmd:
color(current_dir,cur_color)
elif args[0] == 'pip':
print('warning python must be installed to use this commnad')
time.sleep(1)
os.system(cmd)
main(current_dir, cur_color)
else:
Miscellaneous.commands(current_dir,cur_color)
class Miscellaneous():
def commands(current_dir,cur_color):
if args[0] == 'inspace':
Miscellaneous.emulation(current_dir,cur_color)
else:
Miscellaneous.error(current_dir,cur_color)
def emulation(current_dir,cur_color):
chance = random.randint(1,100)
if chance > 2:
print("You Died")
else:
print('You survived')
main(current_dir, cur_color)
def error(current_dir,cur_color):
print("'" + str(cmd) + "'" + ''' is not recognized as an internal or external command (external commands not supported atm)''')
main(current_dir, cur_color)
def color(current_dir,cur_color):
args = cmd.split()
if args[0] == "color":
print(''' 0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White''')
elif args[1] == "help":
print(''' 0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White''')
elif args[1] == "1":
cur_color = Fore.BLUE
elif args[1] == "2":
cur_color = Fore.GREEN
elif args[1] == "3":
cur_color = Fore.CYAN
elif args[1] == "4":
cur_color = Fore.RED
elif args[1] == "5":
cur_color = Fore.RED
elif args[1] == "6":
cur_color = Fore.YELLOW
elif args[1] == "7":
cur_color = Fore.WHITE
elif args[1] == "8":
cur_color = Fore.LIGHTBLACK_EX
elif args[1] == "9":
cur_color = Fore.LIGHTBLUE_EX
elif args[1] == "0":
cur_color = Fore.BLACK
elif args[1].lower() == "a":
cur_color = Fore.BLUE
elif args[1].lower() == "c":
cur_color = Fore.LIGHTRED_EX
elif args[1].lower() == "d":
cur_color = Fore.LIGHTMAGENTA_EX
elif args[1].lower() == "e":
cur_color = Fore.LIGHTYELLOW_EX
elif args[1].lower() == "f":
cur_color = Fore.LIGHTWHITE_EX
main(current_dir,cur_color)
main(current_dir, cur_color)