315 lines
12 KiB
Plaintext
315 lines
12 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "d34b4562",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from requests import get,post\n",
|
|
"import time\n",
|
|
"ip = \"http://band.hxzhxy.cn\"\n",
|
|
"param = {\n",
|
|
" \"username\": \"tangchao\",\n",
|
|
" \"password\": \"123456a\",\n",
|
|
" \"client_id\": \"client\",\n",
|
|
" \"grant_type\": \"password\",\n",
|
|
" \"client_secret\": \"123456\",\n",
|
|
"}\n",
|
|
"data = get(url=f\"http://band.hxzhxy.cn/oauth/token?username=zhongwei&password=123456a&client_id=client&grant_type=password&client_secret=123456\").json()\n",
|
|
"token = data[\"access_token\"]\n",
|
|
"header = {\n",
|
|
" \"content-type\": \"application/json\",\n",
|
|
" \"authorization\": f\"Bearer {token}\",\n",
|
|
"}"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "03513226",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"ename": "",
|
|
"evalue": "",
|
|
"output_type": "error",
|
|
"traceback": [
|
|
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
|
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
|
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
|
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"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()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"id": "4108fb9a",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import time"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "266fc913",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"serialNos=['1619991908']"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"id": "673efe31",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
|
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"for item in data[\"data\"][\"content\"]:\n",
|
|
" addAdminBand =\",\".join(serialNos)\n",
|
|
" a =post(\"https://band.hxzhxy.cn/door/accredit/sendNews\",json={\n",
|
|
" \"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\":\"\"\n",
|
|
" },headers=header).text\n",
|
|
" print(a)\n",
|
|
" time.sleep(1)\n",
|
|
" "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "c4e96b85",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import tqdm"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "96da8a5d",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"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()\n",
|
|
"with tqdm.tqdm(total=len(data[\"data\"][\"content\"])) as pbar:\n",
|
|
" for item in data[\"data\"][\"content\"]:\n",
|
|
" if item[\"password\"] == \"12345687\" or item[\"password\"]==None: \n",
|
|
" pbar.update(1)\n",
|
|
" continue\n",
|
|
" 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)\n",
|
|
" time.sleep(7)\n",
|
|
" pbar.update(1)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "ee45017c",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"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()\n",
|
|
"for item in data[\"data\"][\"content\"]:\n",
|
|
" if item[\"password\"] != \"12345687\" and item[\"password\"]!=None:\n",
|
|
" print(item)\n",
|
|
" print(item['password'])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "cc3c500c",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"len(\"Xpaotongshutongwenzhongxue971001\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 37,
|
|
"id": "e1a6df45",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"['4007516707',\n",
|
|
" '4009525491',\n",
|
|
" '4004683395',\n",
|
|
" '4008811955',\n",
|
|
" '4008924883',\n",
|
|
" '4009224243',\n",
|
|
" '4009213507',\n",
|
|
" '4009187555',\n",
|
|
" '4007743635',\n",
|
|
" '4009523651',\n",
|
|
" '4008270787',\n",
|
|
" '4009482275',\n",
|
|
" '0276930835',\n",
|
|
" '4009509123',\n",
|
|
" '4007526915',\n",
|
|
" '4007516643',\n",
|
|
" '4008464659',\n",
|
|
" '4009443907',\n",
|
|
" '4009203219',\n",
|
|
" '4009209379',\n",
|
|
" '3478812113',\n",
|
|
" '3470473985']"
|
|
]
|
|
},
|
|
"execution_count": 37,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"serialNos"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 43,
|
|
"id": "d35c7e00",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"0\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"#权限提取\n",
|
|
"count = 0\n",
|
|
"for item in data[\"data\"][\"content\"]:\n",
|
|
" 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\"]\n",
|
|
" flag = True\n",
|
|
" for i in teacher:\n",
|
|
" if '物业' in i[\"teaName\"]:\n",
|
|
" flag = False\n",
|
|
" break\n",
|
|
" if flag:\n",
|
|
" print(item[\"lockName\"])\n",
|
|
" count+=1\n",
|
|
" addAdminBand =\",\".join(serialNos)\n",
|
|
" a =post(\"https://band.hxzhxy.cn/door/accredit/sendNews\",json={\n",
|
|
" \"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\":\"\"\n",
|
|
" },headers=header).text\n",
|
|
" time.sleep(10)\n",
|
|
" \n",
|
|
"print(count)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "263663b3",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "978802c0",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "base",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.12.4"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|