-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsqli.py
32 lines (26 loc) · 936 Bytes
/
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
from requests import codes, Session
LOGIN_FORM_URL = "http://localhost:8080/login"
PAY_FORM_URL = "http://localhost:8080/pay"
def submit_login_form(sess, username, password):
response = sess.post(LOGIN_FORM_URL,
data={
"username": username,
"password": password,
"login": "Login",
})
return response.status_code == codes.ok
def submit_pay_form(sess, recipient, amount):
response = sess.post(PAY_FORM_URL,
data={
"recipient": recipient,
"amount": amount,
})
return response.status_code == codes.ok
def sqli_attack(username):
sess = Session()
assert(submit_login_form(sess, "attacker", "attacker"))
pass
def main():
sqli_attack("admin")
if __name__ == "__main__":
main()