forked from s0md3v/Decodify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdcode
182 lines (182 loc) · 7.66 KB
/
dcode
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/usr/bin/env python2
from re import search
from urllib import unquote
from base64 import b64decode
from urllib import urlopen, urlencode
import sys, argparse
parser = argparse.ArgumentParser()
parser.add_argument('string', help="string to be decoded")
parser.add_argument("--rot", help="caesar cipher offest", dest='roter')
g = '\033[1;32m[+]\033[1;m'
w = '\033[1;97m'
e = '\033[1;m\033[1;32m'
li = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
print '''\033[1;32m
__ %s__%s
|%s/%s | | / /
| | %s___%s ___ ___ %s___%s| (
%s|%s )|___)| %s|%s )| )| |%s___%s \ %s)%s
|__%s/%s |__ |%s__%s |__/ %s|%s__/ | %s|%s \_/
%s/%s \033[1;m'''%(w,e,w,e,w,e,w,e,w,e,w,e,w,e,w,e,w,e,w,e,w,e,w,e,w,e)
args = parser.parse_args()
string = args.string
def rotifier(string, roter):
rotated = []
def rotx(number, x):
while 1==1:
find = number + roter
try:
replace = find - 26*x
rotated.append(li[replace])
break
except:
x = x + 1
rotable = list(string.lower())
for char in rotable:
match = search(r'[a-z]', char)
if match:
number = 0
for replace in li:
if char == replace:
x = 1
rotx(number, x)
break
else:
number = number + 1
else:
rotated.append(char)
string = ''.join(rotated)
print g + ' Rot%s : '%(roter), string
if args.roter == 'all':
pass
else:
decode(string)
def decode(string):
def binary(string):
string = string.replace(' ', '')
string = ''.join(chr(int(string[i*8:i*8+8],2)) for i in range(len(string)//8))
print g + ' Decoded from Binary : %s'%(string)
decode(string)
quit()
con = string.isdigit()
if con:
binary = search(r'[01]+', string)
if binary:
binary(string)
else:
pass
def SHA2(string):
html = urlopen("http://md5decrypt.net/Api/api.php?hash="+hashvalue+"&hash_type=sha256&[email protected]&code=1152464b80a61728")
find = html.read()
if len(find) > 0:
print g + ' Cracked SHA2 Hash: ', find
quit()
else:
print '\033[1;31m[-]\033[1;m Its a SHA2 Hash but I failed to crack it.'
quit()
sha2 = search(r'([a-f0-9]{64})', string)
if sha2:
SHA2(string)
def SHA1(string):
data = urlencode({"auth":"8272hgt", "hash":string, "string":"","Submit":"Submit"})
html = urlopen("http://hashcrack.com/index.php" , data)
find = html.read()
match = search (r'<span class=hervorheb2>[^<]*</span></div></TD>', find)
if match:
print g + ' Cracked SHA1 : ', match.group().split('hervorheb2>')[1][:-18]
else:
print '\033[1;31m[-]\033[1;m Its a SHA1 Hash but I failed to crack it.'
quit()
sha1 = search(r'([a-f0-9]{40})', string)
if sha1:
SHA1(string)
def MD5(string):
url = "http://www.nitrxgen.net/md5db/" + string
purl = urlopen(url).read()
if len(purl) > 0:
print g + ' Cracked MD5 Hash : %s'% purl
quit()
else:
print '\033[1;31m[-]\033[1;m Its a MD5 Hash but I failed to crack it.'
quit()
md5 = search(r'([a-f0-9]{32})', string)
if md5:
MD5(string)
def fromchar(string):
string = string.lower()
string = string.strip('string.fromcharcode(').strip(')').strip(' ')
jv_list = string.split(',')
decoded = []
for i in jv_list:
i = i.replace(' ', '').replace('97', 'a').replace('98', 'b').replace('99', 'c').replace('100', 'd').replace('101', 'e').replace('102', 'f').replace('103', 'g').replace('104', 'h').replace('105', 'i').replace('106', 'j').replace('107', 'k').replace('108', 'l').replace('109', 'm').replace('110', 'n').replace('111', 'o').replace('112', 'p').replace('113', 'q').replace('114', 'r').replace('115', 's').replace('116', 't').replace('117', 'u').replace('118', 'v').replace('119', 'w').replace('120', 'x').replace('121', 'y').replace('122', 'z').replace('48', '0').replace('49', '1').replace('50', '2').replace('51', '3').replace('52', '4').replace('53', '5').replace('54', '6').replace('55', '7').replace('56', '8').replace('57', '9').replace('33', '!').replace('64', '@').replace('35', '#').replace('36', '$').replace('37', '%').replace('94', '^').replace('38', '&').replace('42', '*').replace('40', '(').replace('41', ')').replace('45', '-').replace('61', '=').replace('95', '_').replace('43', '+').replace('91', '[').replace('93', ']').replace('92', '\\').replace('59', ';').replace('39', '\'').replace('44', ',').replace('46', '.').replace('47', '/').replace('123', '{').replace('125', '}').replace('124', '|').replace('58', ':').replace('34', '"').replace('60', '<').replace('62', '>').replace('63', '?').replace('32', ' ').replace(',', '').replace('65', 'A').replace('66', 'B').replace('67', 'C').replace('68', 'D').replace('69', 'E').replace('70', 'F').replace('71', 'G').replace('72', 'H').replace('73', 'I').replace('74', 'J').replace('75', 'K').replace('76', 'L').replace('77', 'M').replace('78', 'N').replace('79', 'O').replace('80', 'P').replace('81', 'Q').replace('82', 'R').replace('83', 'S').replace('84', 'T').replace('85', 'U').replace('86', 'V').replace('87', 'W').replace('88', 'X').replace('89', 'Y').replace('90', 'Z').replace('32', ' ')
decoded.append(i)
string = ''.join(decoded)
print g + ' Decoded from FromChar : %s'%(string)
decode(string)
quit()
jv_char = search(r'\d*, \d*,', string)
if jv_char:
fromchar(string)
def urle(string):
string = unquote(string)
print g + ' Decoded from URL encoding : %s'%(string)
decode(string)
quit()
url = search(r'%..%..+', string)
if url:
urle(string)
else:
pass
def hexenc(string):
string = string.replace('0x', '')
string = bytearray.fromhex(string).decode()
print g + ' Decoded from Hex : %s'%(string)
decode(string)
quit()
hexx = search(r'\d\d\d+', string)
hexxx = search(r'0x\d\d+', string)
if hexx or hexxx:
hexenc(string)
def base64(string):
string = b64decode(string)
print g + ' Decoded from Base64 : %s'%(string)
decode(string)
quit()
b64 = search(r'[A-Za-z0-9+\/=]+', string)
if len(string)%4 == 0 and b64:
base64(string)
else:
pass
def decimal(string):
calculated = []
string = string.replace('&#', '').replace(';', ' ')
str_list = string.split(' ')
for i in str_list:
if i == ' ':
pass
else:
try:
i = int(i)
calculated.append(chr(i))
print calculated
except:
pass
string = ''.join(calculated)
print g + ' Decoded from Decimal : %s'%(string.encode('utf-8'))
decode(string)
quit()
deci = search(r'&#*;+', string)
if deci:
decimal(string)
else:
pass
if args.roter:
if args.roter == 'all':
for roter in range(20):
rotifier(string, roter)
else:
roter = int(args.roter)
rotifier(string, roter)
quit()
else:
decode(string)