feat: 添加多个功能模块和工具脚本
- 新增websocket客户端和服务端实现 - 添加图片压缩工具和快速压缩脚本 - 实现学生信息处理相关API - 添加MQTT客户端和消息处理功能 - 更新.gitignore忽略更多文件类型 - 添加数据库操作工具和示例 - 实现多个测试脚本和工具类
This commit is contained in:
+107
-31
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 59,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 60,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 61,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -37,7 +37,7 @@
|
||||
"0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"execution_count": 61,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -65,16 +65,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 62,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x2208bc58860>"
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x250160b7bf0>"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"execution_count": 62,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -85,7 +85,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 63,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -94,7 +94,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 64,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -103,16 +103,28 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 72,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "KeyError",
|
||||
"evalue": "'data'",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[72], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m records \u001b[38;5;241m=\u001b[39m get(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mip\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m/school/devices/listPage?temaId=19&groupId=0&pageNum=1&pageSize=40\u001b[39m\u001b[38;5;124m\"\u001b[39m,headers\u001b[38;5;241m=\u001b[39mheaders)\u001b[38;5;241m.\u001b[39mjson()[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrecords\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n",
|
||||
"\u001b[1;31mKeyError\u001b[0m: 'data'"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"records = get(f\"{ip}/school/devices/listPage?temaId=19&groupId=0&pageNum=1&pageSize=40\",headers=headers).json()[\"data\"][\"records\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 73,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -123,7 +135,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 74,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -139,16 +151,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 75,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"19"
|
||||
"27"
|
||||
]
|
||||
},
|
||||
"execution_count": 11,
|
||||
"execution_count": 75,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -159,16 +171,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 69,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"15"
|
||||
"6"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"execution_count": 69,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -306,12 +318,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 45,
|
||||
"execution_count": 81,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for index,item in enumerate(macs):\n",
|
||||
" time.sleep(1)\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/dog\"\n",
|
||||
" message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/watchDog.exe\",\"type\":\"down\"}\n",
|
||||
" client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
@@ -319,24 +330,50 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# for index,item in enumerate(macs):\n",
|
||||
"# time.sleep(1)\n",
|
||||
"# topic = f\"cmd/publicizeTelevision/{item}/dog\"\n",
|
||||
"# message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/HEU.exe\",\"type\":\"down\"}\n",
|
||||
"# client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 76,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for index,item in enumerate(macs):\n",
|
||||
" time.sleep(1)\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/dog\"\n",
|
||||
" message = {\"type\":\"stop\"}\n",
|
||||
" client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x2015292bfb0>"
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x250130fca90>"
|
||||
]
|
||||
},
|
||||
"execution_count": 30,
|
||||
"execution_count": 79,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"topic = f\"cmd/publicizeTelevision/000c290a0fcb/dog\"\n",
|
||||
"message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/watchDog.exe\",\"type\":\"down\"}\n",
|
||||
"client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
"# topic = f\"cmd/publicizeTelevision/00e066fd8989/dog\"\n",
|
||||
"# message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/watchDog.exe\",\"type\":\"down\"}\n",
|
||||
"# client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -365,7 +402,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -375,6 +412,30 @@
|
||||
" client.publish(topic,message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 49,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/cmd\"\n",
|
||||
" message = \"shutdown /r\"\n",
|
||||
" client.publish(topic,message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 48,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/cmd\"\n",
|
||||
" message = '''taskkill /f /t /im watchDog.exe'''\n",
|
||||
" client.publish(topic,message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
@@ -384,7 +445,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -509,7 +570,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 90,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -517,7 +578,22 @@
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/televisionDog/{item.upper()}/common\"\n",
|
||||
" message = {\n",
|
||||
" \"common\":[\"tasklist | findstr \\\"校宣机程序\\\"\"]\n",
|
||||
" \"common\":[\"shutdown /r \"]\n",
|
||||
"}\n",
|
||||
" client.publish(topic,json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 80,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/televisionDog/{item.upper()}/control\"\n",
|
||||
" message = {\n",
|
||||
" \"type\":\"capture\",\n",
|
||||
" \"id\":\"1\",\n",
|
||||
"}\n",
|
||||
" client.publish(topic,json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user