-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsefide.txt
249 lines (210 loc) · 9.71 KB
/
sefide.txt
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
import sys
import os
import random
from PyQt5.QtWidgets import (
QApplication, QMainWindow, QLabel, QVBoxLayout, QFileDialog, QProgressBar,
QWidget, QComboBox, QMessageBox, QDialog, QPushButton
)
from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer
from PyQt5.QtGui import QPixmap, QIcon
# Logo ve İkon Dosya Yolu Kontrolleri
def get_logo_path():
if hasattr(sys, "_MEIPASS"): # PyInstaller ile paketlenmişse
return os.path.join(sys._MEIPASS, "sefidelo.png")
elif os.path.exists("/usr/share/icons/hicolor/48x48/apps/sefidelo.png"):
return "/usr/share/icons/hicolor/48x48/apps/sefidelo.png"
elif os.path.exists("sefidelo.png"):
return "sefidelo.png"
return None
def get_icon_path():
if hasattr(sys, "_MEIPASS"): # PyInstaller ile paketlenmişse
return os.path.join(sys._MEIPASS, "sefidelo.png")
elif os.path.exists("/usr/share/icons/hicolor/48x48/apps/sefidelo.png"):
return "/usr/share/icons/hicolor/48x48/apps/sefidelo.png"
return None
LOGO_PATH = get_logo_path()
ICON_PATH = get_icon_path()
# Güvenli Silme Algoritması
def overwrite_file(path, passes=1):
try:
with open(path, "r+b") as file:
length = os.path.getsize(path)
for _ in range(passes):
file.seek(0)
file.write(bytearray(random.getrandbits(8) for _ in range(length)))
os.remove(path)
except Exception as e:
print(f"Hata: {e}")
return False
return True
# "Hakkında" Penceresi
class AboutDialog(QDialog):
def __init__(self):
super().__init__()
self.setWindowTitle("Hakkında")
self.setWindowIcon(QIcon("sefidelo.png"))
self.setFixedSize(400, 450)
self.setStyleSheet("background-color: #1F1F1F; color: #FBB318;")
about_layout = QVBoxLayout()
about_label = QLabel("\n\n"
"SEFIDE\n"
"(SEcure FIle DEstructor)\n\n"
" SEFIDE, Dosya ve klasörlerinizi güvenli bir şekilde kalıcı olarak yok etmeniz için tasarlanmış güçlü bir araçtır. Günümüzde, hassas bilgilerin ve dosyaların yanlış ellere geçmesi ciddi güvenlik sorunlarına yol açabilir. Bu uygulama, dijital güvenliğinizi sağlamak için geliştirilmiştir.\n\n"
" Geliştirici: ALG Yazılım Inc. | www.algyzilim.com | [email protected]\n\n"
" Fatih ÖNDER (CekToR) | wwww.fatihonder.org.tr | [email protected]\n\n"
" EnCo Tüm Hakları Saklıdır. 2024 ALG Software Inc\n\n"
" \n\n"
" ALG Yazılım Pardus'a Göç'ü Destekler.\n\n"
" SEFIDE Sürüm: 1.0\n\n")
about_label.setWordWrap(True)
about_label.setAlignment(Qt.AlignCenter)
about_layout.addWidget(about_label)
close_button = QPushButton("Kapat")
close_button.clicked.connect(self.close)
about_layout.addWidget(close_button)
self.setLayout(about_layout)
# Güvenli Silme İşlemleri için Çalışma Thread'i
class DeleteFilesThread(QThread):
progress_signal = pyqtSignal(int)
complete_signal = pyqtSignal(str)
current_file_signal = pyqtSignal(str) # Her dosya için sinyal ekledik
def __init__(self, file_paths, passes):
super().__init__()
self.file_paths = file_paths
self.passes = passes
def run(self):
total_files = len(self.file_paths)
for index, file in enumerate(self.file_paths):
# Her dosya için güncel dosya bilgisini gönder
self.current_file_signal.emit(f"Siliniyor: {os.path.basename(file)}")
if not overwrite_file(file, self.passes):
self.complete_signal.emit(f"{file} dosyası yok edilemedi!")
else:
# Her dosya için progress'i güncelle
self.progress_signal.emit(int((index + 1) / total_files * 100))
# Tüm işlem bitiminde sinyal gönder
self.complete_signal.emit("Dosya(lar) başarıyla yok edildi!")
# Ana Uygulama
class SecureDeleteApp(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("✨ SEFIDE ✨")
self.setWindowIcon(QIcon("sefidelo.png"))
self.setFixedSize(320, 500) # Boyutu biraz arttırdım
self.setStyleSheet("background-color: #1F1F1F; color: #FBB318;")
# Uygulama İkonunu Ayarlama
if ICON_PATH:
self.setWindowIcon(QIcon(ICON_PATH))
# Ana Widget ve Layout
central_widget = QWidget()
main_layout = QVBoxLayout()
main_layout.setSpacing(10)
central_widget.setLayout(main_layout)
self.setCentralWidget(central_widget)
# "Hakkında" tıklanabilir label
about_label = QLabel("...")
about_label.setStyleSheet("font-size: 15px; color: #f0a500;")
about_label.setAlignment(Qt.AlignCenter)
about_label.mousePressEvent = self.show_about_dialog
main_layout.addWidget(about_label)
# "SEFIDE" Başlık
sefide_label = QLabel("SEFIDE")
sefide_label.setStyleSheet("font-size: 22px; font-weight: bold; color: #f0a500;")
sefide_label.setAlignment(Qt.AlignCenter)
main_layout.addWidget(sefide_label)
# Açıklama Etiketi
description_label = QLabel("SEcure FIle DEstructor")
description_label.setWordWrap(True)
description_label.setStyleSheet("font-size: 22px; font-weight: bold; color: #f0a500;")
description_label.setAlignment(Qt.AlignCenter)
main_layout.addWidget(description_label)
# Logo
logo_label = QLabel()
if LOGO_PATH and os.path.exists(LOGO_PATH):
logo_pixmap = QPixmap(LOGO_PATH)
if logo_pixmap.isNull():
logo_label.setText("Logo yüklenemedi")
else:
logo_label.setPixmap(logo_pixmap.scaled(100, 100, Qt.KeepAspectRatio))
else:
logo_label.setText("Logo yüklenemedi")
logo_label.setAlignment(Qt.AlignCenter)
main_layout.addWidget(logo_label)
# Güvenlik Seviyesi
self.security_label = QLabel("Güvenlik Seviyesi:")
self.security_combo = QComboBox()
self.security_combo.addItems(["Hızlı (1 Geçiş)", "Orta (3 Geçiş)", "Yüksek (7 Geçiş)", "Gutmann (35 Geçiş)"])
main_layout.addWidget(self.security_label)
main_layout.addWidget(self.security_combo)
# Güncel Dosya Etiketi
self.current_file_label = QLabel("Henüz işlem yapılmadı")
self.current_file_label.setStyleSheet("color: #FBB318;")
self.current_file_label.setAlignment(Qt.AlignCenter)
main_layout.addWidget(self.current_file_label)
# İlerleme Çubuğu
self.progress_bar = QProgressBar()
self.progress_bar.setValue(0)
main_layout.addWidget(self.progress_bar)
# Mesaj Alanı
self.drag_drop_label = QLabel("Dosya veya klasör sürükleyin ya da seçmek için herhangi bir yere tıklayın.")
self.drag_drop_label.setWordWrap(True)
self.drag_drop_label.setAlignment(Qt.AlignCenter)
main_layout.addWidget(self.drag_drop_label)
# Sürükle Bırak Etkinleştirme
self.setAcceptDrops(True)
# Silinecek Dosyalar
self.file_paths = []
def show_about_dialog(self, event=None):
"""Hakkında penceresini açar."""
about_dialog = AboutDialog()
about_dialog.exec()
def dragEnterEvent(self, event):
if event.mimeData().hasUrls():
event.acceptProposedAction()
def dropEvent(self, event):
self.file_paths = [url.toLocalFile() for url in event.mimeData().urls()]
if self.file_paths:
self.drag_drop_label.setText(f"Seçilen: {', '.join(self.file_paths)}")
self.delete_files()
def delete_files(self):
# Her işlem öncesi progress bar ve etiketleri sıfırla
self.progress_bar.setValue(0)
self.current_file_label.setText("İşlem başlıyor...")
passes = {
"Hızlı (1 Geçiş)": 1,
"Orta (3 Geçiş)": 3,
"Yüksek (7 Geçiş)": 7,
"Gutmann (35 Geçiş)": 35
}.get(self.security_combo.currentText(), 1)
self.delete_thread = DeleteFilesThread(self.file_paths, passes)
self.delete_thread.progress_signal.connect(self.update_progress)
self.delete_thread.complete_signal.connect(self.on_delete_complete)
self.delete_thread.current_file_signal.connect(self.update_current_file)
self.delete_thread.start()
def update_current_file(self, file_name):
"""Güncel dosya ismini günceller"""
self.current_file_label.setText(file_name)
def update_progress(self, value):
self.progress_bar.setValue(value)
def on_delete_complete(self, message):
QMessageBox.information(self, "Tamamlandı", message)
# Progress bar'ı sıfırlamak için timer kullanıyoruz
QTimer.singleShot(2000, self.reset_progress_bar)
def reset_progress_bar(self):
"""Progress bar'ı sıfırlayan metod"""
self.progress_bar.setValue(0)
self.current_file_label.setText("Hazır")
self.drag_drop_label.setText("Dosya veya klasör sürükleyin ya da seçmek için herhangi bir yere tıklayın.")
def mousePressEvent(self, event):
"""Form üzerinde herhangi bir yere tıklanınca dosya seçme diyalogu açılır."""
file_paths, _ = QFileDialog.getOpenFileNames(self, "Dosya Seç", "", "Tüm Dosyalar (*)")
if file_paths:
self.file_paths = file_paths
self.drag_drop_label.setText(f"Seçilen: {', '.join(file_paths)}")
self.delete_files()
# Uygulama Başlatma
if __name__ == "__main__":
app = QApplication(sys.argv)
window = SecureDeleteApp()
window.show()
sys.exit(app.exec_())