-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathwordpress.py
More file actions
33 lines (28 loc) · 967 Bytes
/
wordpress.py
File metadata and controls
33 lines (28 loc) · 967 Bytes
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
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
class WordPress:
def __init__(self):
self.required = 'wp-login.php?action=logout'
def parse(self, text, user, passw):
try:
soup = BeautifulSoup(text, features="html.parser")
r_to = soup.find("input", {"name": "redirect_to"})['value']
b_nm = soup.find("input", {"name": "wp-submit"})['value']
return {
'log': user,
'pwd': passw,
'wp-submit': b_nm,
'redirect_to': r_to,
'testcookie': '1'
}
except:
return
def valid(self, status, text):
if 'IP address has been blocked' in text or status == 403:
return False
elif 'redirect_to' not in text:
return False
elif '"captcha' in text:
return False
else:
return True