12 KiB
12 KiB
In [1]:
from requests import get,post
import time
ip = "http://band.hxzhxy.cn"
param = {
"username": "tangchao",
"password": "123456a",
"client_id": "client",
"grant_type": "password",
"client_secret": "123456",
}
data = get(url=f"http://band.hxzhxy.cn/oauth/token?username=zhongwei&password=123456a&client_id=client&grant_type=password&client_secret=123456").json()
token = data["access_token"]
header = {
"content-type": "application/json",
"authorization": f"Bearer {token}",
}In [ ]:
data = get(f"https://band.hxzhxy.cn/door/lock/listLockPage?teamId=119&pageSize=60&pageNumber=0&value=&areaId=&tierId=®ionId=&bindType=&lockName=&type=2&mainTypeId=&sizeType=&lockType=&access_token={token}").json()[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。 [1;31m请查看单元格中的代码,以确定故障的可能原因。 [1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。 [1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。
In [3]:
import timeIn [4]:
serialNos=['1619991908']In [5]:
for item in data["data"]["content"]:
addAdminBand =",".join(serialNos)
a =post("https://band.hxzhxy.cn/door/accredit/sendNews",json={
"startTime":"25082114","endTime":"35051814","adminType":"55","type":"01","time":[1755756984314,2071380076000],"accountIp":"183.220.92.213","accountName":"183.220.92.213","lockNo":item["lockNo"],"serialNo":item["serialNo"],"addAdminBand":"","addUserBand":addAdminBand,"removeBand":"","doorAccreditIds":""
},headers=header).text
print(a)
time.sleep(1)
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
{"success":true,"msg":"操作成功","code":0,"data":null}
In [ ]:
import tqdmIn [ ]:
data = get(f"https://band.hxzhxy.cn/door/lock/listLockPage?teamId=119&pageSize=60&pageNumber=0&value=&areaId=&tierId=®ionId=&bindType=&lockName=&type=2&mainTypeId=&sizeType=&lockType=&access_token={token}").json()
with tqdm.tqdm(total=len(data["data"]["content"])) as pbar:
for item in data["data"]["content"]:
if item["password"] == "12345687" or item["password"]==None:
pbar.update(1)
continue
post("https://band.hxzhxy.cn/door/password/send",json={"lockNos":item["lockNo"],"serialNos":item["serialNo"],"password":"12345687","type":"04","typeSend":"0","accountIp":"183.220.91.181","accountName":"183.220.91.181","account":"5789"},headers=header)
time.sleep(7)
pbar.update(1)In [ ]:
data = get(f"https://band.hxzhxy.cn/door/lock/listLockPage?teamId=119&pageSize=60&pageNumber=0&value=&areaId=&tierId=®ionId=&bindType=&lockName=&type=2&mainTypeId=&sizeType=&lockType=&access_token={token}").json()
for item in data["data"]["content"]:
if item["password"] != "12345687" and item["password"]!=None:
print(item)
print(item['password'])In [ ]:
len("Xpaotongshutongwenzhongxue971001")In [37]:
serialNosOut [37]:
['4007516707', '4009525491', '4004683395', '4008811955', '4008924883', '4009224243', '4009213507', '4009187555', '4007743635', '4009523651', '4008270787', '4009482275', '0276930835', '4009509123', '4007526915', '4007516643', '4008464659', '4009443907', '4009203219', '4009209379', '3478812113', '3470473985']
In [43]:
#权限提取
count = 0
for item in data["data"]["content"]:
teacher = get(f"https://band.hxzhxy.cn/door/admin/selectAllTeacherAndSerialNew?teamId=119&lockNo={item['lockNo']}&access_token=2ca5ff6c-24a0-4231-98e2-fec9e38c5a38").json()["data"]["userTea"]
flag = True
for i in teacher:
if '物业' in i["teaName"]:
flag = False
break
if flag:
print(item["lockName"])
count+=1
addAdminBand =",".join(serialNos)
a =post("https://band.hxzhxy.cn/door/accredit/sendNews",json={
"startTime":"25082114","endTime":"35051814","adminType":"55","type":"01","time":[1755756984314,2071380076000],"accountIp":"183.220.92.213","accountName":"183.220.92.213","lockNo":item["lockNo"],"serialNo":item["serialNo"],"addAdminBand":"","addUserBand":addAdminBand,"removeBand":"","doorAccreditIds":""
},headers=header).text
time.sleep(10)
print(count)0
In [ ]:
In [ ]: