Skip to content

Commit

Permalink
功能已实现,敏感信息去除
Browse files Browse the repository at this point in the history
  • Loading branch information
hoixding committed May 31, 2022
1 parent 3003d60 commit 8adaf1c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
15 changes: 11 additions & 4 deletions login.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import json
import urllib

import requests

headers = {
post_headers = {
"Host": "192.168.0.1",
"Connection": "keep-alive",
"Accept": "*/*",
Expand All @@ -11,10 +13,15 @@
"Referer": "http://192.168.0.1/",
"Accept-Encoding": "gzip, deflate, br"
}
data = json.dumps({"method":"do","login":{"password":"********"}})
data = json.dumps({"method":"do","login":{"password":"**********"}})
url = 'http://192.168.0.1/'
resp = requests.post(url, headers=headers, data=data)
resp = requests.post(url, headers=post_headers, data=data)
# 获取服务器状态响应
print(resp.text)
dict = json.loads(resp.content.decode('utf-8'))
print(dict.get('stok'))
stok=dict.get('stok')
url = 'http://192.168.0.1/stok='+stok+'/pc/WizardEnd.htm'

#print(request.text)
r=requests.get(url)
print(r.text)
44 changes: 44 additions & 0 deletions setPPPoEandwlan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import json
import requests

#set admin password
headers = {
"Host": "192.168.0.1",
"Connection": "keep-alive",
"Accept": "*/*",
"Origin": "http://192.168.0.1",
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/json",
"Referer": "http://192.168.0.1/",
"Accept-Encoding": "gzip, deflate, br"
}
data = json.dumps({"method":"do","set_password":{"password":"*********"}})
url = 'http://192.168.0.1/'
resp = requests.post(url, headers=headers, data=data)
dict = json.loads(resp.content.decode('utf-8'))
stok=dict.get('stok')
#ds url
url = 'http://192.168.0.1/stok='+stok+'/ds'

#get connect html
r=requests.get('http://192.168.0.1/stok='+stok+'/pc/Content.htm')
#get set PPPoE html
r=requests.get('http://192.168.0.1/stok='+stok+'/pc/WizardPPPoE.htm')
#set PPPoE account
data = json.dumps({"protocol":{"wan":{"wan_type":"pppoe"},"pppoe":{"username":"******","password":"******"}},"method":"set"})
resp = requests.post(url, headers=headers, data=data)
dict = json.loads(resp.content.decode('utf-8'))
if dict.get('error_code')==0:
print('ok')
else:
print('error'+dict.get('error_code'))
#get end html
r=requests.get('http://192.168.0.1/stok='+stok+'/pc/WizardEnd.htm')
#set fact
data = json.dumps({"system":{"sys":{"is_factory":"0"}},"method":"set"})
resp = requests.post(url, headers=headers, data=data)
#set wlan
data = json.dumps({"wireless":{"wlan_host_2g":{"ssid":"***","key":"***","encryption":"1"},"wlan_bs":{"bs_enable":"0"},"wlan_host_5g":{"ssid":"***","key":"***","encryption":"1"}},"method":"set"})
resp = requests.post(url, headers=headers, data=data)


0 comments on commit 8adaf1c

Please sign in to comment.