Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mengyyy authored Feb 1, 2018
1 parent 714746e commit ceecb2b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions feixun.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import base64
import json

# 浏览器抓包得 chrome f12
# 网页请求地址
loginUrl = 'http://192.168.2.1/cgi-bin/'
# 网页请求发送数据 含用户名密码
data = {
"method":"set",
"module":
Expand All @@ -21,20 +24,27 @@
},
"_deviceType":"pc"
}
# 网页请求头部
headers = {
'Content-Type':'application/json',
'Host':'192.168.2.1',
'Origin':'http://192.168.2.1',
'Referer':'http://192.168.2.1/cgi-bin',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'
}
session = requests.Session()

# 用户名表
username = ['root','admin']
# 密码表
password = ['123456', 'root', 'admin', 'rootroot']

for u in username:
for p in password:
# 修改请求数据中的用户名
data['module']['security']['login']['username'] = u
# 密码不能直接发送 需要进行base64编码
data['module']['security']['login']['password'] = base64.b64encode(p.encode('utf-8')).decode('utf-8')
req = session.post(loginUrl, data=json.dumps(data), headers=headers)
# 浏览器抓包得 发送请求方式和格式
req = requests.post(loginUrl, data=json.dumps(data), headers=headers)
# 打印结果
print(u, p, req.json(), sep=' | ')

0 comments on commit ceecb2b

Please sign in to comment.