-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
executable file
·307 lines (249 loc) · 7.35 KB
/
app.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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
import random
import os
import time
import app
import webbrowser
import edit
from playsound import playsound as ps
from supermail import EmailClient
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
import zipfile
import glob
def bootscr():
os.system("clear")
load = "########"
loadb = "########"
for i in range(6):
os.system("clear")
boottxt = open("txt/boot.txt", "r")
print(boottxt.read())
print(" ")
print(" " + load)
load = load + loadb
time.sleep(0.5)
os.system("clear")
time.sleep(0.75)
return
def home():
def prnt():
os.system("clear")
homtxt = open("txt/hom.txt", "r")
print(homtxt.read())
prnt()
while True:
x = input("/~# ")
if x == "1":
app.files()
prnt()
elif x == "2":
app.google()
elif x == "3":
app.terminal()
prnt()
elif x == '4':
app.email()
prnt()
elif x == "clear":
prnt()
elif x == "g":
helptxt = open("txt/help.txt", "r")
print(helptxt.read())
elif x == "exit":
return
else:
inctxt = open("txt/inc.txt", "r")
print(inctxt.read())
def files():
while True:
def prnt():
os.system("clear")
filtxt = open("txt/fil.txt", "r")
print(filtxt.read())
prnt()
os.chdir("filesys")
os.system("ls")
while True:
file = input("$~# ")
if file == "exit":
os.chdir("..")
return
elif file == "ls":
os.system("ls")
elif file.split()[0] == 'edit':
# edit.edit(file.split()[1])
#
## WARNING
## This code is not currently stable. Do not use!
#
print("Under production")
elif file.split()[0] == "nano":
os.system(file)
elif file.split()[0] == "cd":
os.chdir(file.split()[1])
elif file.split()[0] == "rm" or file.split()[0] == "remove":
os.system("rm -r " + file.split()[1])
print("Removed " + file.split()[1])
elif file.split()[0] == "add" or file.split()[0] == "touch":
os.system("touch " + file.split()[1])
elif file.split()[0] == "mkdir":
os.system(file)
elif file == "clear":
os.chdir("..")
prnt()
os.chdir("filesys")
elif file.split()[0] == 'play':
ps(file.split()[1])
elif file.split()[0] == 'help':
help = open('../txt/filhelp.txt', 'r')
print(help.read())
else:
print("# Not a recognised command. \n # Check documentation for more info")
def google():
while True:
ur = str(input("]~# "))
url = "https://" + ur
webbrowser.open(url)
return
def terminal():
def prnt():
os.system("clear")
tertxt = open("txt/terminal.txt", "r")
print(tertxt.read())
prnt()
os.chdir("filesys")
while True:
terminal = input("@~# ")
if terminal == "exit":
os.chdir("..")
return
elif terminal == "clear":
os.chdir("..")
prnt()
os.chdir("filesys")
else:
os.system(terminal)
def nano(file):
os.system(f'nano {file}')
global logincred
def email():
def prnt():
os.system("clear")
emtxt = open("txt/email.txt", "r")
print(emtxt.read())
def createlogin():
try:
os.system('rm login.txt')
except:
pass
os.system('touch login.txt')
loginfile = open('login.txt', 'w')
loginfile.write(input('input email: '))
loginfile.write('\n')
loginfile.write(input('input password: '))
loginfile.close()
pass
def login():
global logincred
try:
logincred = open('login.txt', 'r')
except:
createlogin()
logincred = logincred.read()
logincred = logincred.splitlines()
if logincred == []:
createlogin()
else:
pass
logincred = open('login.txt', 'r')
logincred = logincred.read()
logincred = logincred.splitlines()
if gmailchecker(logincred[0], logincred[1]) == True:
print('Logged in!')
pass
else:
createlogin()
def gmailchecker(username,password):
import smtplib as s
ID = username
PASSW = password
server = s.SMTP("smtp.gmail.com", 587)
server.starttls()
if server.login(ID,PASSW):
server.quit()
return True
else:
server.quit()
return
def getmail():
webbrowser.open('https://mail.google.com')
def writemail():
try:
os.system('rm email.txt')
except:
pass
os.system('touch email.txt')
nano('email.txt')
def sendmail():
writemail()
recipient = input('Recipient: ')
subject = input('Subject: ')
text = open('email.txt', 'r')
cc = input('CC: ')
attach = input('Attachments:')
email_user = logincred[0]
email_password = logincred[1]
email_rcver = recipient
msg = MIMEMultipart()
msg['From'] = email_user
msg['To'] = email_rcver
msg['Cc'] = cc
msg['Subject'] = subject
body = text.read()
msg.attach(MIMEText(body, 'plain'))
if attach != '':
attachment = open(attach, 'rb')
part = MIMEBase('application', 'octet-stream')
part.set_payload(attachment.read())
encoders.encode_base64(part)
part.add_header('content-disposition', 'attachment; filename=' + attach)
msg.attach(part)
else:
pass
text = msg.as_string()
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(email_user, email_password)
try:
server.sendmail(email_user, email_rcver, text)
server.quit()
print("\nEmail Sent!\n")
os.system('rm email.txt')
except:
try:
server.quit()
except:
pass
print('Unknown error. Please try again.')
def mainloop():
while True:
email = input('E~# ')
if email == 'readmail' or email == 'read':
getmail()
elif email == 'sendmail' or email == 'send':
sendmail()
elif email == 'help':
emtxt = open("txt/emhelp.txt", "r")
print(emtxt.read())
elif email == 'clear':
prnt()
elif email == 'exit':
break
else:
print("Command not recognised. Use 'help' for help")
prnt()
login()
mainloop()