-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_security.py
More file actions
34 lines (26 loc) · 1.17 KB
/
test_security.py
File metadata and controls
34 lines (26 loc) · 1.17 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
import json
import os
def check_last_memory():
file_path = "conversation_memory.jsonl"
if not os.path.exists(file_path):
print("❌ HATA: conversation_memory.jsonl dosyası bulunamadı.")
print(" -> Önce projeyi çalıştırıp (python gradio_ui.py) yapay zekaya bir mesaj yazmalısın.")
return
try:
with open(file_path, "r", encoding="utf-8") as f:
lines = f.readlines()
if not lines:
print("⚠️ Hafıza dosyası boş.")
return
last_entry = json.loads(lines[-1])
print("\n--- SON HAFIZA KAYDI ---")
print(f"Kullanıcı Girdisi (Log): {last_entry["user"]}")
if "[CONFIDENTIAL" in last_entry["user"]:
print("\n✅ BAŞARILI: Hassas veri maskelenmiş!")
else:
print("\n⚠️ BİLGİ: Maskelenecek hassas veri bulunamadı veya maskeleme çalışmadı.")
print(" (Eğer mesajında telefon/email yoksa bu normaldir.)")
except Exception as e:
print(f"Bir hata oluştu: {e}")
if __name__ == "__main__":
check_last_memory()