-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFazCrypter.py
More file actions
350 lines (323 loc) · 15.5 KB
/
FazCrypter.py
File metadata and controls
350 lines (323 loc) · 15.5 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
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# -*- coding:utf-8 -*-
from os import mkdir,path,system,name,remove,urandom
from time import sleep
from shutil import rmtree
#from numpy import array,nditer
from colorama import Fore as f
#ŞİFRELEME PROGRAMI
if name == 'nt':
clrscr_command = "cls"
else:clrscr_command = "clear"
def clear():
system(clrscr_command)
def opened():
print("""{}
______ _ _____ _ _ _ _
| ___| | | | ___| | | | | (_) | |
| |_ __ _ ___| |__ ___ __ _ _ __ | |__ _ __ | |_ ___ _ __| |_ __ _ _ _ __ _ __ ___ ___ _ __ | |_
| _/ _` |_ / '_ \ / _ \/ _` | '__| | __| '_ \| __/ _ \ '__| __/ _` | | '_ \| '_ ` _ \ / _ \ '_ \| __|
| || (_| |/ /| |_) | __/ (_| | | | |__| | | | || __/ | | || (_| | | | | | | | | | | __/ | | | |_
\_| \__,_/___|_.__/ \___|\__,_|_| \____/_| |_|\__\___|_| \__\__,_|_|_| |_|_| |_| |_|\___|_| |_|\__|
""".format(f.LIGHTRED_EX))
if name=="nt":
kit_adres="C:/kits/"
elif name=="posix":
#kit_adres="/sys/"
kit_adres="/kits/"
system('chcp 1254')
#chcp 65001
clear()
charlist="abcçdefgğhijklmnoöpqrsştuüvwxyz"+"abcçdefgğhijklmnoöpqrsştuüvwxyz".upper()+"#+'-!@#$&_-)}{+,(=1234567890;"
run=True
menu=f"""\n
{f.GREEN}1{f.LIGHTRED_EX}-{f.YELLOW}){f.WHITE} Cihazıma özel şifre kitleri oluştur.
{f.GREEN}2{f.LIGHTRED_EX}-{f.YELLOW}){f.WHITE} Cihazıma özel şifre kitleri var mı kontrol et.
{f.GREEN}3{f.LIGHTRED_EX}-{f.YELLOW}){f.WHITE} Dosyamı şifrele.
{f.GREEN}4{f.LIGHTRED_EX}-{f.YELLOW}){f.WHITE} Dosyamı çöz.
{f.GREEN}5{f.LIGHTRED_EX}-{f.YELLOW}){f.WHITE} Kitlerimi sil.
{f.GREEN}6{f.LIGHTRED_EX}-{f.YELLOW}){f.WHITE} Konsolu temizle.
{f.GREEN}7{f.LIGHTRED_EX}-{f.YELLOW}){f.WHITE} Çıkış.
"""
while run:
opened()
print(menu)
try:
islem=int(input("{} > {}".format(f.LIGHTBLACK_EX,f.LIGHTBLUE_EX)))
except:
print(f.LIGHTRED_EX+"\nSayısal bir değer gir.")
continue
#KİT OLUŞTURMA KISMI
if islem==1:
if path.exists(kit_adres):
print(f.LIGHTYELLOW_EX+"\nUyarı! Eğer kitiniz varsa ve yenisini oluşturmaya kalkarsınız eski kitleriniz silinir.Ve önceden şifrelenmiş dosyalarınızı çözemezsiniz!")
end_qu=str(input(f.LIGHTBLACK_EX+"\nEminmisin(Y or N) >"+f.LIGHTBLUE_EX))
if end_qu.lower()=="y" or end_qu.lower()=="yes":
try:
uzunluk=2**int(input(f.LIGHTBLACK_EX+"\nKit karakter uzunluğu girin > "+f.LIGHTBLUE_EX))
if uzunluk>2:
if path.exists(kit_adres):
rmtree(kit_adres)
mkdir(kit_adres)
kit=urandom(uzunluk)
for c in charlist:
hash_file=open(kit_adres+str(c)+".kit","wb")
kit=urandom(uzunluk)
print(f.RED+c.upper(),f.MAGENTA+':',f.LIGHTBLACK_EX,kit)
hash_file.write(kit)
hash_file.close()
print(f.GREEN+"\nBaşarıyla yeni kitleriniz oluşturuldu.\n")
hash_kit=None
else:
print(f.LIGHTRED_EX+"\nEn düşük uzunluk 3 karakterdir!")
hash_kit=None
input()
except:
hash_kit=None
print(f.LIGHTRED_EX+"\nBir hata oluştu. Uygulamayı yönetici olarak başlatmayı deneyin.")
#print(f"Unexpected {err}, {type(err)}")
else:
continue
else:
try:
uzunluk=2**int(input(f.LIGHTBLACK_EX+"\nKit karakter uzunluğu girin > "+f.LIGHTBLUE_EX))
if uzunluk>2:
if path.exists(kit_adres):
rmtree(kit_adres)
mkdir(kit_adres)
for c in charlist:
hash_file=open(kit_adres+str(c)+".kit","wb")
kit=urandom(uzunluk)
print(f.RED+c.upper(),f.MAGENTA+':',f.LIGHTBLACK_EX,kit)
hash_file.write(kit)
hash_file.close()
print(f.GREEN+"\nBaşarıyla yeni kitleriniz oluşturuldu.\n")
else:
print(f.LIGHTRED_EX+"\nEn düşük uzunluk 3 karakterdir!")
input()
except Exception as err:
print(f.LIGHTRED_EX+"\nBir hata oluştu. Uygulamayı yönetici olarak başlatmayı deneyin.")
print(f"Unexpected {err}, {type(err)}")
#KONTROL KISMI
elif islem==2:
print(f.LIGHTYELLOW_EX+"\nKontrol başlatılıyor..\n\n")
html_file=open("control.html","a")
html_file.write("<br><h1>Kit control</h1><ul>")
try:
if path.exists(kit_adres):
for c in charlist:
str(c)
if path.exists(kit_adres+c+".kit"):
wtext="<li><strong>"+c+"</strong> için kit <strong style=\"color:green;\">true</strong>. Uzunluk : <b>"+str(path.getsize(kit_adres+c+".kit"))+"</b>.</li>"
html_file.write(wtext)
else:
html_file.write("<li>"+c+" için kit <strong style=\"color:red;\">false</strong>.</li>")
html_file.write("</ul>")
html_file.close()
if name == "nt":
system("start control.html")
elif name == "posix":
system("xdg-open dosya.html")
sleep(1.1)
remove("control.html")
print(f.GREEN+"\nKontrolünüz başarıyla tamamlandı.\n")
else:
html_file.write("<li><strong>Kits</strong> klasörü <strong style=\"color:red;\">false</strong>.</li>")
html_file.write("</ul><br>")
html_file.close()
if name == "nt":
system("start control.html")
elif name == "posix":
system("xdg-open dosya.html")
sleep(1.1)
remove("control.html")
print(f.GREEN+"\nKontrolünüz başarıyla tamamlandı.\n")
except:
print(f.LIGHTRED_EX+"\nBir hata oluştu. Uygulamayı yönetici olarak başlatmayı deneyin.")
#print(f"Unexpected {err}, {type(err)}")
#ŞİFRELEME KISMI
elif islem==3:
fn=str(input(f.LIGHTBLACK_EX+"\nŞifrelenecek dosya : "+f.LIGHTBLUE_EX))
try:
if path.exists(fn):
sifrelenmis=b""
rf=open(fn,"r",encoding="utf-8").read()
if len(rf)>=150600:
print(f.LIGHTRED_EX+"\nDosya boyutu çok büyük. Bazı sorunlar çıkabilir veya dosyanız çok geç şifrelenebilir.")
end_qu=str(input(f.LIGHTBLACK_EX+"\nEminmisin(Y or N) >"+f.LIGHTBLUE_EX))
if end_qu.lower()=="y" or end_qu.lower()=="yes":
str(rf)
check_rf=rf
hf=open(path.splitext(fn)[0]+".fef","wb")
#rf=array(rf)
for c in rf:
if path.exists(kit_adres+c+".kit"):
sf=open(kit_adres+c+".kit","rb").read()
sifrelenmis+=sf
else:
sifrelenmis+=bytes(c,encoding="utf-8")
"""BU YÖNTEM BÜYÜK SORUNLAR OLUŞTURDUĞUNDAN KALDIRILDI.HIZLI AMA GÜVENSİZ
sifrelenmis=rf
for c in charlist:
str(c)
if path.exists(kit_adres+c+".kit"):
sf=open(kit_adres+c+".kit","r").read()
else:
continue
sifrelenmis=sifrelenmis.replace(c,sf)
"""
if check_rf == rf:
print(f.LIGHTRED_EX+"\nŞifreleme sonucu bir şey değişmedi. Eski kitleriniz silinmiş olabilir!")
input()
hf.write(sifrelenmis)
rf=sifrelenmis=sf=check_rf=None
hf.close()
print(f.GREEN+"\nŞifreleme başarıyla tamamlandı.\n")
else:
continue
else:
str(rf)
hf=open(path.splitext(fn)[0]+".fef","wb")
check_rf=rf
rf=list(rf)
for c in rf:
if path.exists(kit_adres+c+".kit"):
sf=open(kit_adres+c+".kit","rb").read()
sifrelenmis+=sf
else:
sifrelenmis+=bytes(c,encoding="utf-8")
if check_rf == rf:
print(f.LIGHTRED_EX+"\nŞifreleme sonucu bir şey değişmedi. Eski kitleriniz silinmiş olabilir!")
input()
hf.write(sifrelenmis)
rf=sifrelenmis=sf=check_rf=None
hf.close()
print(f.GREEN+"\nŞifreleme başarıyla tamamlandı.\n")
else:
print(f.LIGHTRED_EX+"\n{} adında bir dosya yok.".format(fn))
input()
except Exception as err:
print(f.LIGHTRED_EX+"\nBir hata oluştu. Uygulamayı yönetici olarak başlatmayı deneyin.")
print(f"Unexpected {err}, {type(err)}")
#DEŞİFRELEME KISMI
elif islem==4:
df=str(input(f.LIGHTBLACK_EX+"\nDeşifre edilecek dosya : "+f.LIGHTBLUE_EX))
if df.endswith(".fef")!=True:
print(f.LIGHTRED_EX+"\nDosya uzantın .fef olmalı.")
continue
if path.exists(df):
try:
rf=open(df,"rb").read()
for c in charlist:
str(c)
if path.exists(kit_adres+c+".kit"):
wf=open(kit_adres+c+".kit","rb").read()
break
else:
continue
if len(rf)>=70600*len(wf):
wf=None
print(f.LIGHTRED_EX+"\nDosya boyutu çok büyük. Bazı sorunlar çıkabilir veya dosyanız çok geç deşifrelenebilir.")
end_qu=str(input(f.LIGHTBLACK_EX+"\nEminmisin(Y or N) >"+f.LIGHTBLUE_EX))
if end_qu.lower()=="y" or end_qu.lower()=="yes":
uzanti=str(input(f.LIGHTBLACK_EX+"Yeni dosyanın uzantısı : "+f.LIGHTBLUE_EX))
ef=open(path.splitext(df)[0]+uzanti,"w",encoding="utf-8")# cozulmus dosya
check_rf=rf
for c in charlist:
if path.exists(kit_adres+c+".kit"):
sf=open(kit_adres+c+".kit","rb").read()
rf=rf.replace(sf,c)
else:
print(f.LIGHTRED_EX+"\nKit hatası.")
break
if check_rf == rf:
print(f.LIGHTRED_EX+"\nDeşifreleme sonucu bir şey değişmedi. Eski kitleriniz silinmiş olabilir!")
input()
ef.close()
remove(path.splitext(df)[0]+uzanti)
check_rf=rf=None
else:
pass
ef.write(rf)
#print(rf)
ef.close()
check_rf=rf=None
print(f.GREEN+"\nDeşifreleme başarıyla tamamlandı.\n")
else:
uzanti=str(input(f.LIGHTBLACK_EX+"Yeni dosyanın uzantısı : "+f.LIGHTBLUE_EX))
ef=open(path.splitext(df)[0]+uzanti,"wb")# cozulmus dosya
check_rf=rf
for c in charlist:
if path.exists(kit_adres+c+".kit"):
sf=open(kit_adres+c+".kit","rb").read()
rf=rf.replace(sf,bytes(c,encoding="utf-8"))
else:
print(f.LIGHTRED_EX+"\nKit hatası.")
break
if check_rf == rf:
print(f.LIGHTRED_EX+"\nDeşifreleme sonucu bir şey değişmedi. Eski kitleriniz silinmiş olabilir!")
input()
ef.close()
remove(path.splitext(df)[0]+uzanti)
check_rf=rf=None
continue
else:
pass
ef.write(rf)
#print(rf)
ef.close()
check_rf=rf=None
print(f.GREEN+"\nDeşifreleme başarıyla tamamlandı.\n")
except Exception as err:
print(f.LIGHTRED_EX+"\nBir hata oluştu. Uygulamayı yönetici olarak başlatmayı deneyin.")
print(f"Unexpected {err}, {type(err)}")
else:
print(f.LIGHTRED_EX+"\n{} adında bir dosya yok.".format(df))
#KİT SİLME KISMI
elif islem==5:
if path.exists(kit_adres)==False:
print(f.LIGHTRED_EX+"\nZaten kitin yok.")
continue
print(f.LIGHTYELLOW_EX+"\nUyarı! Eğer kitlerinizi silerseniz önceden şifrelenmiş dosyalarınızı çözemezsiniz!")
end_qu=str(input(f.LIGHTBLACK_EX+"\nEminmisin(Y or N) >"+f.LIGHTBLUE_EX))
if end_qu.lower()=="y" or end_qu.lower()=="yes":
if path.exists(kit_adres):
try:
rmtree(kit_adres)
print(f.GREEN+"\nKitlerin başarıyla silindi.\n")
except Exception as err:
print(f.LIGHTRED_EX+"\nBir hata oluştu. Uygulamayı yönetici olarak başlatmayı deneyin.")
print(f"Unexpected {err}, {type(err)}")
else:
pass
#KONSOL TEMİZLEME
elif islem==6:
clear()
#Çıkıs
elif islem==7:
run=False
del menu,charlist,kit_adres,islem,clrscr_command
print(f.RESET)
elif islem==1983 or islem==1987:
e=f.RED+"""
066 117 114 100 097 110 032 107
097 195 167 033 033 033 066 117
110 117 032 110 101 114 100 101
110 032 098 105 108 105 121 111
114 115 117 110 033 066 117 032
098 101 110 105 109 032 121 097
197 159 097 109 196 177 109 032
118 101 032 115"""+f.YELLOW+""" 105 122 032 098
117 110 117 032 098 105 108 109
101 109 101 108 105 115 105 110
105 122 033 072 101 114 032 197
159 101 121 032 098 105 114 032
111 121 117 110 100 097 110 032
105 098 097 114 101 116 032 100
101 196 159 105 108 033 066 085
046 046 046"""
print(e,"\a\a\a")
else:
print(f.LIGHTRED_EX+"\nBilinmeyen komut.")
continue
del run
print(f.RESET)