-
Notifications
You must be signed in to change notification settings - Fork 0
/
XSS-BruteLogic.py
70 lines (56 loc) · 1.67 KB
/
XSS-BruteLogic.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
#!/usr/bin/env python
from PIL import Image
import cv2
from Crypto.Cipher import AES
import hashlib
import getpass
import sys
def decrypt():
print("Decrypting")
path = raw_input("Enter full path of image : ")
path = str(path)
img = cv2.imread(path)
binary = ""
list = []
lenght = 0
lenght = int(img[-1][-1][0])
lenght += int(img[-1][-1][1])
lenght += int(img[-1][-1][2])
lenght += int(img[-1][-2][0])
lenght += int(img[-1][-2][1])
lenght += int(img[-1][-2][2])
#print(lenght)
count = 0
for i in range(len(img)):
for j in range(len(img[i])):
for x in range(len(img[i][j])):
if count == lenght:
break
count += 1
if img[i][j][x] % 2 == 0:
binary = binary+"0"
elif img[i][j][x] % 2 != 0:
binary = binary+"1"
#print(binary)
a = 8
b = 0
for i in range(len(binary) / 8):
list.append(binary[b:a])
b = a
a += 8
liste = []
for i in range(len(list)):
a = str(list[i])
doc = int(a, 2)
char = chr(doc)
liste.append(char)
word = ""
word = ''.join(liste)
password = str("'-alert(1)-'")
deneme = word.decode('hex')
key = hashlib.md5(password)
k = key.hexdigest()
cipher = AES.new(k,AES.MODE_ECB) # AES MODE
dencrypted_data = cipher.decrypt(deneme)
print(dencrypted_data)
decrypt()