-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaudodecoder.py
81 lines (75 loc) · 2.83 KB
/
audodecoder.py
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
try:
from colorama import Fore
import argparse
import pycipher
import pyperclip
from utils.decoder import Decoder
from itertools import product
except:
print("\
AutoDecoder.py - Error: Install required libraries\n\
pip3 install argparse colorama pycipher pyperclip")
exit()
def banner():
print(Fore.WHITE)
print("\n\
( \n\
( ( )\ ) ( \n\
)\ ( )\ ) (()/( ( )\ ) ( ( \n\
((((_)( ))\ (()/( ( /(_)) ))\ ( ( (()/( ))\ )( \n\
)\ _ )\ /((_) ((_)) )\(_))_ /((_) )\ )\ ((_))/((_)(()\ \n\
(_)_\(_)(_))( _| | ((_)| \ (_)) ((_)((_) _| |(_)) ((_) \n\
/ _ \ | || |/ _` |/ _ \| |) |/ -_)/ _|/ _ \/ _` |/ -_) | '_| \n\
/_/ \_\ \_,_|\__,_|\___/|___/ \___|\__|\___/\__,_|\___| |_| \n\n\
Author: oreos | Twitter: @oreos_ES\n\n")
def decodefunc(args):
message = args.message
key = args.key
levels = args.levels
pattern = args.pattern
shift = args.caesar
show_all = args.show_all
decoder = Decoder()
decoders = [
"base16",
"base32",
"base64",
"base85",
"autokey",
"atbash",
"baconian",
"beaufort",
"caesar",
"morse",
"rot13",
"rot47",
"playfair",
"vigenere"
]
combdecs = list(product(decoders, repeat=levels))
for arraydecs in combdecs:
translated = message
flow = ""
for dec in arraydecs:
translated = decoder.decode(dec, translated, shift, key)
if translated is None:
if show_all is not None and show_all:
print(Fore.RED+" > ".join(arraydecs))
break
if translated is not None:
if pattern is None or (pattern and pattern in translated):
print(Fore.WHITE+" > ".join(arraydecs)+": "+Fore.BLUE+translated)
def main():
banner()
parser = argparse.ArgumentParser(description='AutoDecoder.py')
parser.add_argument("-l", "--levels", type=int, help='Number of decoding levels [1-6], default = 2', default=2)
parser.add_argument("-k", "--key", type=str, help='Key used to decode')
parser.add_argument("-c", "--caesar", type=int, help='Caesar shift to use [0-25], default = 3', default=3)
parser.add_argument("-s", "--show_all", help='Show chains with errors during decoding', action='store_true')
parser.add_argument("-p", "--pattern", type=str, help='Search pattern in decoded string')
requiredNamed = parser.add_argument_group('required named arguments')
requiredNamed.add_argument('-m', '--message', help='Message to decode', required=True)
args = parser.parse_args()
decodefunc(args)
if __name__== "__main__":
main()