diff --git a/UE2.18_Communication_Marketing/README.md b/UE2.18_Communication_Marketing/README.md index cb4d4af..dcb5ad9 100644 --- a/UE2.18_Communication_Marketing/README.md +++ b/UE2.18_Communication_Marketing/README.md @@ -11,6 +11,4 @@ Mr Kalonji Jean.Claude - jean-claude.kalonji@seineetmarne.cci.fr > Etude de marché, offre et demande - - ## 24 06 2026 \ No newline at end of file diff --git a/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/README.md b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/README.md new file mode 100644 index 0000000..e69de29 diff --git a/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/TP1_RPC.docx b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/TP1_RPC.docx new file mode 100644 index 0000000..4d101ee Binary files /dev/null and b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/TP1_RPC.docx differ diff --git a/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/TP1_RPC.pdf b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/TP1_RPC.pdf new file mode 100644 index 0000000..39d9d10 Binary files /dev/null and b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/TP1_RPC.pdf differ diff --git a/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/TP1_RPC_Guillaume_Sanchez.docx b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/TP1_RPC_Guillaume_Sanchez.docx new file mode 100644 index 0000000..0e89058 Binary files /dev/null and b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/TP1_RPC_Guillaume_Sanchez.docx differ diff --git a/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/client.py b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/client.py new file mode 100644 index 0000000..09d301f --- /dev/null +++ b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/client.py @@ -0,0 +1,4 @@ +import xmlrpc.client +proxy = xmlrpc.client.ServerProxy("http://192.168.1.210:9000/") +num = int(input("Entrez un nombre : ")) +print("Résultat : ", proxy.square(num)) \ No newline at end of file diff --git a/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/server.py b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/server.py new file mode 100644 index 0000000..10c4677 --- /dev/null +++ b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/server.py @@ -0,0 +1,7 @@ +from xmlrpc.server import SimpleXMLRPCServer +def square(x): + return x * x +server = SimpleXMLRPCServer(("0.0.0.0", 9000)) +print("Server listening on port 9000...") +server.register_function(square, "square") +server.serve_forever() \ No newline at end of file diff --git a/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/server_master.py b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/server_master.py new file mode 100644 index 0000000..86fb777 --- /dev/null +++ b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/server_master.py @@ -0,0 +1,64 @@ +from xmlrpc.server import SimpleXMLRPCServer +import itertools +import string + +class HashCrackerServer: + def __init__(self, target_hash, algo): + self.target_hash = target_hash + self.algo = algo + self.workers = [] + self.password_found = False + + print("Génération de l'espace de recherche (1 à 4 lettres)...") + self.blocks = self._generate_blocks() + print(f"Espace divisé en {len(self.blocks)} blocs de travail.") + + def _generate_blocks(self, block_size=5000): + chars = string.ascii_lowercase + all_combinations = [] + # Génère les mots de 1 à 4 lettres + for length in range(1, 5): + for p in itertools.product(chars, repeat=length): + all_combinations.append("".join(p)) + + # Découpage de la liste globale en sous-listes (blocs) + return [all_combinations[i:i + block_size] for i in range(0, len(all_combinations), block_size)] + + def register_worker(self, worker_name): + if worker_name not in self.workers: + self.workers.append(worker_name) + print(f"[INFO] Nouveau Worker enregistré : {worker_name}") + return True + + def get_work_block(self): + if self.password_found: + return {"status": "STOP"} # Quelqu'un a déjà trouvé + if not self.blocks: + return {"status": "DONE"} # Plus de travail disponible + + # On retire le premier bloc de la liste et on l'envoie + return { + "status": "WORK", + "algo": self.algo, + "target": self.target_hash, + "words": self.blocks.pop(0) + } + + def submit_result(self, worker_name, password): + if password: + self.password_found = True + print(f"\n[SUCCÈS] Le worker '{worker_name}' a cracké le hash ! Mot de passe : {password}") + return True + +# Hash MD5 pour le mot "toto" +TARGET_HASH = "f71dbe52628a3f83a77ab494817525c6" +ALGO = "md5" + +server = SimpleXMLRPCServer(("0.0.0.0", 9000), allow_none=True) +cracker_instance = HashCrackerServer(TARGET_HASH, ALGO) + +# Enregistrement de l'instance entière (expose toutes ses méthodes publiques) +server.register_instance(cracker_instance) + +print("Serveur Maître RPC en écoute sur le port 9000...") +server.serve_forever() \ No newline at end of file diff --git a/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/worker.py b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/worker.py new file mode 100644 index 0000000..5ab2246 --- /dev/null +++ b/UE2.24_Systèmes_distribués_et_applications_sous_Windows_et_Linux/TP1/worker.py @@ -0,0 +1,54 @@ +import xmlrpc.client +import hashlib +import sys + +# Pense à remplacer par l'IP de ta VM1 +PROXY_URL = "http://192.168.1.210:9000/" +WORKER_NAME = "UE2-24-worker1" +#WORKER_NAME = "UE2-24-worker2" + +try: + proxy = xmlrpc.client.ServerProxy(PROXY_URL, allow_none=True) + proxy.register_worker(WORKER_NAME) + print(f"Connecté au serveur en tant que {WORKER_NAME}") +except Exception as e: + print(f"Impossible de se connecter au serveur : {e}") + sys.exit(1) + +while True: + try: + job = proxy.get_work_block() + except Exception as e: + print(f"Erreur de communication avec le serveur : {e}") + break + + if job["status"] == "STOP": + print("Un autre worker a trouvé le mot de passe. Fin du programme.") + break + elif job["status"] == "DONE": + print("L'espace de recherche est épuisé. Le mot de passe n'a pas été trouvé.") + break + + words = job["words"] + target = job["target"] + algo = job["algo"] + + print(f"Réception d'un bloc de {len(words)} mots à tester...") + found_password = None + + # Boucle de force brute sur le bloc + for word in words: + h = hashlib.new(algo) + h.update(word.encode('utf-8')) + + if h.hexdigest() == target: + found_password = word + break + + # Soumission du résultat (mot de passe ou None si échec sur ce bloc) + if found_password: + proxy.submit_result(WORKER_NAME, found_password) + print(f">>> MOT DE PASSE TROUVÉ : {found_password} <<<") + break + else: + proxy.submit_result(WORKER_NAME, None) \ No newline at end of file