-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.py
More file actions
102 lines (82 loc) · 3.17 KB
/
Copy pathMain.py
File metadata and controls
102 lines (82 loc) · 3.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
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
"""
./bin :
./bin/Convert-pcap-in-hc2200.sh
./bin/extract-eapol.py
./hashs :
Hash files Folder
./Pcap_files:
Pcap files Folder
./wordlists :
./wordlists/Generate_Wordlist.py
default wordlists : 10million.txt, rockyou.txt
"""
import os
import subprocess
from time import sleep as wait
def extract_eapol():
""" Exécute le script pour extraire les EAPOL """
try:
subprocess.run("cd bin && python extract-eapol.py", shell=True, check=True)
wait(0.5)
return True
except subprocess.CalledProcessError as e:
print(f"Error during EAPOL extraction: {e}")
return False
def convert_in_hc22000():
""" Exécute le script pour convertir les fichiers en hc22000 """
try:
subprocess.run("cd bin && chmod +x Convert-pcap-in-hc22000.sh && bash Convert-pcap-in-hc22000.sh", shell=True, check=True)
wait(0.5)
print("Conversion done!")
return True
except subprocess.CalledProcessError as e:
print(f"Error during conversion: {e}")
return False
def hashcat(wordlists, w_choosed):
""" Lance Hashcat avec la wordlist choisie """
file = "./hash/hashed.hc22000"
try:
subprocess.run(f"hashcat -m 22000 {file} {wordlists[w_choosed]}", shell=True, check=True)
except subprocess.CalledProcessError as e:
print(f"Error running Hashcat: {e}")
if __name__ == "__main__":
try:
subprocess.run("clear", shell=True)
print("\nWelcome to Crack-Pcap!\n\n")
wait(0.5)
print("\nAnalyzing your wordlists...")
wordlist_dir = "./wordlists"
# Vérification que le dossier existe
if not os.path.isdir(wordlist_dir):
print(f"Error: The directory '{wordlist_dir}' does not exist.")
exit(1)
# Lister les fichiers dans le dossier wordlists
wordlists = [os.path.join(wordlist_dir, wordlist) for wordlist in os.listdir(wordlist_dir) if os.path.isfile(os.path.join(wordlist_dir, wordlist))]
if not wordlists:
print(f"Error: No wordlists found in '{wordlist_dir}' directory.")
exit(1)
wait(0.5)
print("\nNumber of wordlists:", len(wordlists))
for k, v in enumerate(wordlists):
print(f"[{k+1}] {os.path.basename(v)}")
# Choisir la wordlist
try:
w_choosed = input("Choose your wordlist [default = 1]: ").strip()
w_choosed = int(w_choosed) - 1 if w_choosed.isdigit() else 0
if not (0 <= w_choosed < len(wordlists)):
raise ValueError
except ValueError:
print("Invalid choice! Using default wordlist.")
w_choosed = 0
print("\nChosen wordlist:", os.path.basename(wordlists[w_choosed]))
print("\nTrust the script.")
wait(0.5)
if extract_eapol():
if convert_in_hc22000():
print("Crack will start...")
wait(0.5)
subprocess.run("clear", shell=True)
wait(0.1)
hashcat(wordlists, w_choosed)
except Exception as e:
print(f"Unexpected error: {e}")