Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -72,73 +72,16 @@ def decrypt(passw,enc_in=None):
|
|
72 |
enc_in=enc_in.strip('"')
|
73 |
print (f'enc_in :::: {enc_in}')
|
74 |
|
75 |
-
if "+aaa+" in enc_in:
|
76 |
-
mes1=enc_in.split("+aaa+",1)[0]
|
77 |
-
mes1=mes1.strip("b'").strip("'")
|
78 |
-
mes_bytes = bytes(mes1,'utf-8')
|
79 |
-
mes_dec = fernet.decrypt(mes_bytes).decode()
|
80 |
-
if "+bbb+" in enc_in:
|
81 |
-
mes12=enc_in.split("+aaa+",1)[1]
|
82 |
-
mes2=mes12.split("+bbb+",1)[0]
|
83 |
-
mes2=mes2.strip("b'").strip("'")
|
84 |
-
im_bytes = bytes(mes2,'utf-8')
|
85 |
-
print(f'im_bytes::{im_bytes}')
|
86 |
-
|
87 |
-
mes2 = fernet.decrypt(mes2).decode()
|
88 |
-
#base = bytes(decMessage, 'utf-8')
|
89 |
-
with open(f"finished_im.png", "wb") as fh:
|
90 |
-
#fh.write(base64.decodebytes(im_bytes))
|
91 |
-
fh.write(base64.decodebytes(bytes(mes2, 'utf-8')))
|
92 |
-
fh.close
|
93 |
-
dec_im = "finished_im.png"
|
94 |
-
if "+ccc+" in enc_in:
|
95 |
-
mes13=enc_in.split("+bbb+",1)[1]
|
96 |
-
mes3=mes13.split("+ccc+",1)[0]
|
97 |
-
mes3=mes3.strip("b'").strip("'")
|
98 |
-
json_bytes = bytes(mes3,'utf-8')
|
99 |
-
print(f'im_bytes::{json_bytes}')
|
100 |
-
dec_json = fernet.decrypt(json_bytes).decode()
|
101 |
-
if not "+bbb+" in enc_in:
|
102 |
-
if "+ccc+" in enc_in:
|
103 |
-
mes14=enc_in.split("+aaa+",1)[1]
|
104 |
-
|
105 |
-
mes4=mes14.split("+ccc+",1)[0]
|
106 |
-
mes4=mes4.strip("b'").strip("'")
|
107 |
-
json_bytes = bytes(mes4,'utf-8')
|
108 |
-
print(f'im_bytes::{json_bytes}')
|
109 |
-
dec_json = fernet.decrypt(json_bytes).decode()
|
110 |
-
|
111 |
-
if not "+aaa+" in enc_in:
|
112 |
-
if "+bbb+" in enc_in:
|
113 |
-
mes2 = enc_in.split("+bbb+",1)[0]
|
114 |
-
mes2=mes2.strip("b'").strip("'")
|
115 |
-
im_bytes = bytes(mes2,'utf-8')
|
116 |
-
print(f'im_bytes2::{im_bytes}')
|
117 |
-
mes2 = fernet.decrypt(mes2).decode()
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
if "+ccc+" in enc_in:
|
126 |
-
mes13=enc_in.split("+bbb+",1)[1]
|
127 |
-
mes3=mes13.split("+ccc+",1)[0]
|
128 |
-
mes3=mes3.strip("b'").strip("'")
|
129 |
-
json_bytes = bytes(mes3,'utf-8')
|
130 |
-
print(f'im_bytes::{json_bytes}')
|
131 |
-
dec_json = fernet.decrypt(json_bytes).decode()
|
132 |
-
if not "+bbb+" in enc_in:
|
133 |
-
if "+ccc+" in enc_in:
|
134 |
-
mes4=enc_in.split("+ccc+",1)[0]
|
135 |
-
mes14=mes4.strip("b'").strip("'")
|
136 |
-
json_bytes = bytes(mes14,'utf-8')
|
137 |
-
print(f'im_bytes::{json_bytes}')
|
138 |
-
dec_json = fernet.decrypt(json_bytes).decode()
|
139 |
|
140 |
|
141 |
-
return(
|
142 |
|
143 |
def decode_doc(passw,doc=None):
|
144 |
key = create_key(passw)
|
|
|
72 |
enc_in=enc_in.strip('"')
|
73 |
print (f'enc_in :::: {enc_in}')
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
if "+ccc+" in enc_in:
|
77 |
+
mes4=enc_in.split("+ccc+",1)[0]
|
78 |
+
mes14=mes4.strip("b'").strip("'")
|
79 |
+
json_bytes = bytes(mes14,'utf-8')
|
80 |
+
print(f'im_bytes::{json_bytes}')
|
81 |
+
dec_json = fernet.decrypt(json_bytes).decode()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
|
84 |
+
return(dec_json)
|
85 |
|
86 |
def decode_doc(passw,doc=None):
|
87 |
key = create_key(passw)
|