Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Thumbs.db
.pytest_cache/
.coverage
htmlcov/

# Mouwafic

files/
65 changes: 65 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python3
"""
Script pour exécuter tous les tests du projet
"""

import sys
import os
import subprocess

def run_test_file(test_file):
"""Exécute un fichier de test"""
print(f"\nExécution de {test_file}")
print("=" * 50)

try:
# Ajouter le répertoire racine au path
sys.path.insert(0, os.path.dirname(__file__))

# Exécuter le test
result = subprocess.run([sys.executable, test_file],
capture_output=True, text=True, cwd=os.path.dirname(__file__))

if result.returncode == 0:
print("✅ Tests réussis")
print(result.stdout)
else:
print("❌ Tests échoués")
print(result.stdout)
print(result.stderr)

return result.returncode == 0

except Exception as e:
print(f"❌ Erreur lors de l'exécution: {e}")
return False

def main():
"""Exécute tous les tests disponibles"""
print("Lancement des tests du projet CryptoForensic")
print("=" * 60)

tests = [
"tests/test_global.py",
"tests/test_analyzers.py"
]

success_count = 0
total_count = len(tests)

for test_file in tests:
if os.path.exists(test_file):
if run_test_file(test_file):
success_count += 1
else:
print(f"⚠️ Fichier de test non trouvé: {test_file}")

print(f"\nRésumé: {success_count}/{total_count} tests réussis")

if success_count == total_count:
print("Résultat:Tous les tests passent !")
else:
print("Résultat: Certains tests ont échoué")

if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions src/analyzers/aes_cbc_analyzer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ..crypto_analyzer import CryptoAnalyzer
from ..utils import calculer_entropie
from src.crypto_analyzer import CryptoAnalyzer
from src.utils import calculer_entropie
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
Expand Down
2 changes: 1 addition & 1 deletion src/analyzers/aes_gcm_analyzer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ..crypto_analyzer import CryptoAnalyzer
from src.crypto_analyzer import CryptoAnalyzer
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives import hashes
import re
Expand Down
4 changes: 2 additions & 2 deletions src/analyzers/blowfish_analyzer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ..detecteur_crypto import CryptoAnalyzer
from ..utils import calculer_entropie
from src.crypto_analyzer import CryptoAnalyzer
from src.utils import calculer_entropie
import hashlib
from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes
from cryptography.hazmat.primitives.padding import PKCS7
Expand Down
5 changes: 2 additions & 3 deletions src/analyzers/chacha20_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import sys
from typing import List

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from crypto_analyzer import CryptoAnalyzer
from utils import calculer_entropie
from src.crypto_analyzer import CryptoAnalyzer
from src.utils import calculer_entropie

# Définition de la classe ChaCha20_Analyzer
class ChaCha20_Analyzer(CryptoAnalyzer):
Expand Down
2 changes: 1 addition & 1 deletion src/analyzers/fernet_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from cryptography.fernet import Fernet
from typing import List

from ..crypto_analyzer import CryptoAnalyzer
from src.crypto_analyzer import CryptoAnalyzer

class FernetAnalyzer(CryptoAnalyzer):
"""
Expand Down
12 changes: 6 additions & 6 deletions src/detecteur_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
from typing import List, Union

# Import des modules d'analyse
from analyzers.aes_cbc_analyzer import Aes_Cbc_Analyzer
from crypto_analyzer import CryptoAnalyzer
from analyzers.chacha20_analyzer import ChaCha20_Analyzer
from analyzers.blowfish_analyzer import Blowfish_Analyzer
from analyzers.aes_gcm_analyzer import Aes_Gcm_Analyzer
from src.analyzers.aes_cbc_analyzer import Aes_Cbc_Analyzer
from src.crypto_analyzer import CryptoAnalyzer
from src.analyzers.chacha20_analyzer import ChaCha20_Analyzer
from src.analyzers.blowfish_analyzer import Blowfish_Analyzer
from src.analyzers.aes_gcm_analyzer import Aes_Gcm_Analyzer

# Import des modules utilitaries
from utils import est_dechiffre
from src.utils import est_dechiffre

class ResultatAnalyse:
"""
Expand Down
1 change: 0 additions & 1 deletion tests/test_analyzers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))

from src.analyzers.aes_cbc_analyzer import Aes_Cbc_Analyzer
from src.analyzers.chacha20_analyzer import ChaCha20_Analyzer
Expand Down