-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmechanize_attack1.py
More file actions
36 lines (34 loc) · 1.35 KB
/
mechanize_attack1.py
File metadata and controls
36 lines (34 loc) · 1.35 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
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Update: 0.0.5
#------------------------------------------------
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(False)
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")
#------------------------------------------------------------------------------------------------------------------------------------
attackNumber = 1
with open('xss_vectors.txt') as f:
for line in f:
browser.open(url)
browser["fname"] = line
res = browser.submit()
content = res.read()
# check the attack vector is printed in the response.
if content.find(line) > 0:
print ("Possible XXS")
#output = open('response/'+str(attackNumber)+'.txt', 'w')
#output.write(content)
#output.close()
print ("Attack #", attackNumber, ", Response: ", content)
attackNumber += 1