-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOS_manip.py
More file actions
87 lines (57 loc) · 1.86 KB
/
OS_manip.py
File metadata and controls
87 lines (57 loc) · 1.86 KB
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
import os
import subprocess
from make_enc import*
from testGUI import first_GUI
# ----- GATHERING PATH INFO -----
output = subprocess.getoutput( 'cd' )
full_path = '' + output
# ----- GETTING USERNAME -----
LHS_start = output.find('Users') + len('Users') + 1
user = output[LHS_start:]
RHS_end = user.find('\\')
user = user[:RHS_end]
# ----- GETTING PRE-USERNAME ------
n = full_path.find(user + '\\')
pre_user = full_path[:n]
# ----- BASIC DIR EST ON DESKTOP ------
target = pre_user + user + '\\Desktop'
target = os.path.join( target, 'SecureData' )
# ----------- CREATING OS PATHS -----------
notes = 'NOTES.txt'
idk = 'secretNOTES.txt'
to_NOTES = os.path.join(target, notes)
to_IDK = os.path.join(target, idk)
def create_folder():
if( os.path.exists(target)==False ):
os.mkdir(target)
def create_notes():
if( os.path.exists(to_NOTES)==False ):
f = open(to_NOTES, 'a+', encoding='utf_8')
f.close()
def create_safe_note():
if( os.path.exists(to_IDK)==False ):
f = open(to_IDK, 'a+', encoding='utf_8')
f.close()
def clean_start():
if( os.path.exists(to_IDK)==False and os.path.exists(to_NOTES)==False ):
create_notes()
first_GUI()
exit()
# ------------------ ENCRYPT ... to_NOTES -> to_IDK ------------------
def do_encrypt():
f = open(to_NOTES, 'r', encoding='utf_8')
fi = open(to_IDK, 'a+', encoding='utf_8')
for i in f:
fi.write( enc_motor(i) )
fi.close()
f.close()
os.remove(to_NOTES)
# ------------------ DE-CRYPT ... to_IDK -> to_NOTES ------------------
def do_decrypt():
f = open(to_IDK, 'r', encoding='utf_8')
fi = open(to_NOTES, 'a+', encoding='utf_8')
for i in f:
fi.write( dec_motor(i) )
fi.close()
f.close()
os.remove(to_IDK)