1
- from .handlers import bruteforce_handler , decrypt_handler , encrypt_handler , freq_analysis_handler
1
+ from .handlers import bruteforce_handler , decrypt_handler , encrypt_handler , freq_analysis_handler , brute_freq_handler
2
+ from colorama import Fore , Style
2
3
import argparse
3
4
4
5
parser = argparse .ArgumentParser (
26
27
metavar = 'PLAIN' , help = 'Cipher text to crack' , type = str )
27
28
28
29
# -fr & --freq-analysis
29
- parser .add_argument ('-fr' , '--freq-analysis' , nargs = '+' , metavar = 'CIPHER' , help = 'Cipher text to crack by analysing' , type = str )
30
+ parser .add_argument ('-fr' , '--freq-analysis' , nargs = '+' , metavar = 'CIPHER' ,
31
+ help = 'Plain text to crack by analysing' , type = str )
30
32
31
33
# -w & --wordlist
32
- parser .add_argument ('-w' , '--wordlist' , nargs = 1 , metavar = 'WORDLIST' , help = 'Path to the wordlist containing language words' , type = str )
34
+ parser .add_argument ('-w' , '--wordlist' , nargs = 1 , metavar = 'WORDLIST' ,
35
+ help = 'Path to the wordlist containing language words' , type = str )
36
+
37
+ # -bfr & --brute-frequency
38
+ parser .add_argument ('-bfr' , '--brute-frequency' , nargs = '+' , metavar = 'CIPHER' ,
39
+ help = 'Cipher to crack and analyse output for the text containing words in a wordlist' )
33
40
34
41
args = parser .parse_args ()
35
42
@@ -39,6 +46,10 @@ def handle_args():
39
46
# If key isn't in the args,
40
47
if not args .key and (args .encrypt or args .decrypt ):
41
48
raise NameError ("Key is not defined" )
49
+ # If brute frequency flag used,
50
+ elif args .brute_frequency :
51
+ brute_freq_handler (args )
52
+ # If frequency flag used,
42
53
elif args .freq_analysis :
43
54
freq_analysis_handler (args )
44
55
# If the bruteforce flag used
@@ -54,4 +65,4 @@ def handle_args():
54
65
else :
55
66
raise ValueError ("No Arguments given" )
56
67
except Exception as e :
57
- print (" Error:" , e )
68
+ print (f' { Fore . LIGHTRED_EX } Error: { e } { Style . RESET_ALL } ' )
0 commit comments