From 748a43da4de8639914cd910fb45bfa911bcfb2d4 Mon Sep 17 00:00:00 2001 From: Kenneth <2448698686@qq.com> Date: Wed, 20 Nov 2024 11:09:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=AF=86=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E9=98=B2=E6=AD=A2sql=E6=B3=A8=E5=85=A5?= =?UTF-8?q?=E6=94=BB=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TheBattleCar/app.log | 412 ++++++++++++++++++++++++++++++++++++++++ TheBattleCar/app.py | 104 ++++++++-- TheBattleCar/secret.key | 2 +- 3 files changed, 506 insertions(+), 12 deletions(-) diff --git a/TheBattleCar/app.log b/TheBattleCar/app.log index c8f51b9..f9ffd9e 100644 --- a/TheBattleCar/app.log +++ b/TheBattleCar/app.log @@ -4044,3 +4044,415 @@ 2024-11-20 08:54:09,282 - INFO - 127.0.0.1 - - [20/Nov/2024 08:54:09] "POST /login HTTP/1.1" 302 - 2024-11-20 08:54:09,293 - INFO - Accessing commander page 2024-11-20 08:54:09,301 - INFO - 127.0.0.1 - - [20/Nov/2024 08:54:09] "GET /commander HTTP/1.1" 200 - +2024-11-20 09:03:53,315 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:8000 + * Running on http://192.168.89.210:8000 +2024-11-20 09:03:53,315 - INFO - Press CTRL+C to quit +2024-11-20 09:03:53,327 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 09:03:54,209 - WARNING - * Debugger is active! +2024-11-20 09:03:54,215 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 09:03:57,376 - INFO - Handling login request +2024-11-20 09:03:57,432 - INFO - 127.0.0.1 - - [20/Nov/2024 09:03:57] "GET /login?next=/commander HTTP/1.1" 200 - +2024-11-20 09:03:57,576 - INFO - 127.0.0.1 - - [20/Nov/2024 09:03:57] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 09:04:00,734 - INFO - Handling login request +2024-11-20 09:04:00,746 - INFO - User scout logged in with role 侦查者 +2024-11-20 09:04:00,747 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:00] "POST /login HTTP/1.1" 302 - +2024-11-20 09:04:00,763 - INFO - Accessing scout page +2024-11-20 09:04:00,765 - INFO - Notifications fetched: ({'id': 9, 'user_id': 5, 'message_id': 12, 'action': 'reject', 'created_at': datetime.datetime(2024, 11, 20, 8, 46, 50), 'message': '吼吼吼'}, {'id': 8, 'user_id': 5, 'message_id': 10, 'action': 'reject', 'created_at': datetime.datetime(2024, 11, 20, 8, 35, 24), 'message': None}) +2024-11-20 09:04:00,772 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:00] "GET /scout HTTP/1.1" 200 - +2024-11-20 09:04:00,828 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:00] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 09:04:02,797 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:02] "POST /clear_notifications HTTP/1.1" 200 - +2024-11-20 09:04:02,818 - INFO - Accessing scout page +2024-11-20 09:04:02,821 - INFO - Notifications fetched: () +2024-11-20 09:04:02,823 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:02] "GET /scout HTTP/1.1" 200 - +2024-11-20 09:04:02,862 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:02] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 09:04:03,602 - INFO - Handling send message request +2024-11-20 09:04:03,605 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:03] "GET /send_message HTTP/1.1" 200 - +2024-11-20 09:04:03,647 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:03] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 09:04:08,038 - INFO - Handling send message request +2024-11-20 09:04:08,041 - INFO - Message sent: hhh, Photo URL: None +2024-11-20 09:04:08,042 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:08] "POST /send_message HTTP/1.1" 200 - +2024-11-20 09:04:18,148 - INFO - Handling login request +2024-11-20 09:04:18,157 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:18] "GET /login HTTP/1.1" 200 - +2024-11-20 09:04:18,212 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:18] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 09:04:20,999 - INFO - Handling login request +2024-11-20 09:04:21,009 - INFO - User admin logged in with role 指挥者 +2024-11-20 09:04:21,012 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:21] "POST /login HTTP/1.1" 302 - +2024-11-20 09:04:21,027 - INFO - Accessing commander page +2024-11-20 09:04:21,034 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:21] "GET /commander HTTP/1.1" 200 - +2024-11-20 09:04:25,813 - INFO - Handling message action: accept for ID: 13 +2024-11-20 09:04:25,816 - INFO - Message status updated: accept +2024-11-20 09:04:25,819 - INFO - Message data fetched: {'message': 'hhh'} +2024-11-20 09:04:25,820 - INFO - Scouts found: ({'id': 5},) +2024-11-20 09:04:25,822 - INFO - Notification inserted for scout: 5 +2024-11-20 09:04:25,824 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:25] "POST /handle_message/13/accept HTTP/1.1" 302 - +2024-11-20 09:04:25,836 - INFO - Accessing commander page +2024-11-20 09:04:25,838 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:25] "GET /commander HTTP/1.1" 200 - +2024-11-20 09:04:29,810 - INFO - Handling send message request +2024-11-20 09:04:29,813 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:29] "GET /send_message HTTP/1.1" 200 - +2024-11-20 09:04:32,554 - INFO - Accessing scout page +2024-11-20 09:04:32,556 - WARNING - Unauthorized access to scout page +2024-11-20 09:04:32,558 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:32] "GET /scout HTTP/1.1" 200 - +2024-11-20 09:04:33,369 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:33] "GET / HTTP/1.1" 200 - +2024-11-20 09:04:33,401 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:33] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 09:04:34,893 - INFO - Handling login request +2024-11-20 09:04:34,902 - INFO - User scout logged in with role 侦查者 +2024-11-20 09:04:34,904 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:34] "POST /login HTTP/1.1" 302 - +2024-11-20 09:04:34,917 - INFO - Accessing scout page +2024-11-20 09:04:34,918 - INFO - Notifications fetched: ({'id': 10, 'user_id': 5, 'message_id': 13, 'action': 'accept', 'created_at': datetime.datetime(2024, 11, 20, 9, 4, 25), 'message': 'hhh'},) +2024-11-20 09:04:34,918 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:34] "GET /scout HTTP/1.1" 200 - +2024-11-20 09:04:34,962 - INFO - 127.0.0.1 - - [20/Nov/2024 09:04:34] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:08:05,384 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:08:06,526 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:08:07,409 - WARNING - * Debugger is active! +2024-11-20 10:08:07,409 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:10:49,364 - INFO - * Detected change in 'C:\\Users\\Lenovo\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\flask_login\\signals.py', reloading +2024-11-20 10:10:49,384 - INFO - * Detected change in 'C:\\Users\\Lenovo\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\flask\\signals.py', reloading +2024-11-20 10:10:49,396 - INFO - * Detected change in 'C:\\Users\\Lenovo\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\blinker\\__init__.py', reloading +2024-11-20 10:10:49,399 - INFO - * Detected change in 'C:\\Users\\Lenovo\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\blinker\\base.py', reloading +2024-11-20 10:10:50,401 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:10:51,173 - WARNING - * Debugger is active! +2024-11-20 10:10:51,176 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:11:14,332 - INFO - * Detected change in 'C:\\Users\\Lenovo\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\flask_login\\utils.py', reloading +2024-11-20 10:11:14,843 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:11:15,618 - WARNING - * Debugger is active! +2024-11-20 10:11:15,623 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:15:23,873 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:8000 + * Running on http://192.168.89.210:8000 +2024-11-20 10:15:23,873 - INFO - Press CTRL+C to quit +2024-11-20 10:15:23,885 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:15:24,649 - WARNING - * Debugger is active! +2024-11-20 10:15:24,654 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:15:34,367 - INFO - * Detected change in 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\\Lib\\_strptime.py', reloading +2024-11-20 10:15:34,364 - INFO - Handling login request +2024-11-20 10:15:34,420 - INFO - 127.0.0.1 - - [20/Nov/2024 10:15:34] "GET /login HTTP/1.1" 200 - +2024-11-20 10:15:34,420 - INFO - * Detected change in 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\\Lib\\encodings\\unicode_escape.py', reloading +2024-11-20 10:15:34,569 - INFO - 127.0.0.1 - - [20/Nov/2024 10:15:34] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:15:35,049 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:15:35,987 - WARNING - * Debugger is active! +2024-11-20 10:15:35,997 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:15:36,763 - INFO - Handling login request +2024-11-20 10:15:36,835 - INFO - * Detected change in 'C:\\Users\\Lenovo\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\flask\\app.py', reloading +2024-11-20 10:15:36,853 - INFO - 127.0.0.1 - - [20/Nov/2024 10:15:36] "POST /login HTTP/1.1" 500 - +2024-11-20 10:15:37,036 - INFO - 127.0.0.1 - - [20/Nov/2024 10:15:37] "GET /login?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 - +2024-11-20 10:15:37,151 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:15:38,008 - WARNING - * Debugger is active! +2024-11-20 10:15:38,011 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:15:38,134 - INFO - 127.0.0.1 - - [20/Nov/2024 10:15:38] "GET /login?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 - +2024-11-20 10:26:56,764 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:26:56,765 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:26:56,765 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:26:57,652 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:26:58,448 - WARNING - * Debugger is active! +2024-11-20 10:26:58,453 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:27:01,906 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:8000 + * Running on http://192.168.89.210:8000 +2024-11-20 10:27:01,906 - INFO - Press CTRL+C to quit +2024-11-20 10:27:01,917 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:27:02,716 - WARNING - * Debugger is active! +2024-11-20 10:27:02,720 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:27:06,032 - INFO - Handling login request +2024-11-20 10:27:06,081 - ERROR - Failed to decrypt message: +2024-11-20 10:27:06,081 - INFO - User scout logged in with role 侦查者 +2024-11-20 10:27:06,081 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:06] "POST /login HTTP/1.1" 302 - +2024-11-20 10:27:06,102 - INFO - Accessing scout page +2024-11-20 10:27:06,104 - INFO - Notifications fetched: ({'id': 10, 'user_id': 5, 'message_id': 13, 'action': 'accept', 'created_at': datetime.datetime(2024, 11, 20, 9, 4, 25), 'message': 'hhh'},) +2024-11-20 10:27:06,110 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:06] "GET /scout HTTP/1.1" 200 - +2024-11-20 10:27:06,259 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:06] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:27:08,700 - INFO - Handling login request +2024-11-20 10:27:08,709 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:08] "GET /login HTTP/1.1" 200 - +2024-11-20 10:27:13,272 - INFO - Handling login request +2024-11-20 10:27:13,277 - ERROR - Failed to decrypt message: +2024-11-20 10:27:13,277 - INFO - User scout logged in with role 侦查者 +2024-11-20 10:27:13,284 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:13] "POST /login HTTP/1.1" 302 - +2024-11-20 10:27:13,297 - INFO - Accessing scout page +2024-11-20 10:27:13,297 - INFO - Notifications fetched: ({'id': 10, 'user_id': 5, 'message_id': 13, 'action': 'accept', 'created_at': datetime.datetime(2024, 11, 20, 9, 4, 25), 'message': 'hhh'},) +2024-11-20 10:27:13,302 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:13] "GET /scout HTTP/1.1" 200 - +2024-11-20 10:27:13,350 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:13] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:27:14,966 - INFO - Handling send message request +2024-11-20 10:27:14,969 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:14] "GET /send_message HTTP/1.1" 200 - +2024-11-20 10:27:15,005 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:15] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:27:22,349 - INFO - Handling send message request +2024-11-20 10:27:22,352 - INFO - Message sent: 秘密, Photo URL: None +2024-11-20 10:27:22,353 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:22] "POST /send_message HTTP/1.1" 200 - +2024-11-20 10:27:24,108 - INFO - Handling send message request +2024-11-20 10:27:24,110 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:24] "GET /send_message HTTP/1.1" 200 - +2024-11-20 10:27:31,776 - INFO - Handling login request +2024-11-20 10:27:31,783 - ERROR - Failed to decrypt message: +2024-11-20 10:27:31,786 - INFO - User admin logged in with role 指挥者 +2024-11-20 10:27:31,789 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:31] "POST /login HTTP/1.1" 302 - +2024-11-20 10:27:31,804 - INFO - Accessing commander page +2024-11-20 10:27:31,812 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:31] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:27:38,508 - INFO - Handling message action: accept for ID: 14 +2024-11-20 10:27:38,508 - INFO - Message status updated: accept +2024-11-20 10:27:38,514 - INFO - Message data fetched: {'message': '秘密'} +2024-11-20 10:27:38,514 - ERROR - Failed to decrypt message: string argument should contain only ASCII characters +2024-11-20 10:27:38,514 - INFO - Scouts found: ({'id': 5},) +2024-11-20 10:27:38,520 - INFO - Notification inserted for scout: 5 +2024-11-20 10:27:38,520 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:38] "POST /handle_message/14/accept HTTP/1.1" 302 - +2024-11-20 10:27:38,534 - INFO - Accessing commander page +2024-11-20 10:27:38,534 - INFO - 127.0.0.1 - - [20/Nov/2024 10:27:38] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:46:39,976 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:8000 + * Running on http://192.168.89.210:8000 +2024-11-20 10:46:39,976 - INFO - Press CTRL+C to quit +2024-11-20 10:46:39,990 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:46:40,797 - WARNING - * Debugger is active! +2024-11-20 10:46:40,797 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:46:56,086 - INFO - Handling login request +2024-11-20 10:46:56,146 - INFO - 127.0.0.1 - - [20/Nov/2024 10:46:56] "GET /login HTTP/1.1" 200 - +2024-11-20 10:46:56,306 - INFO - 127.0.0.1 - - [20/Nov/2024 10:46:56] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:46:59,412 - INFO - Handling login request +2024-11-20 10:46:59,427 - ERROR - Failed to decrypt message: +2024-11-20 10:46:59,427 - INFO - User scout logged in with role 侦查者 +2024-11-20 10:46:59,432 - INFO - 127.0.0.1 - - [20/Nov/2024 10:46:59] "POST /login HTTP/1.1" 302 - +2024-11-20 10:46:59,445 - INFO - Accessing scout page +2024-11-20 10:46:59,445 - INFO - Notifications fetched: ({'id': 11, 'user_id': 5, 'message_id': 14, 'action': 'accept', 'created_at': datetime.datetime(2024, 11, 20, 10, 27, 38), 'message': '秘密'}, {'id': 10, 'user_id': 5, 'message_id': 13, 'action': 'accept', 'created_at': datetime.datetime(2024, 11, 20, 9, 4, 25), 'message': 'hhh'}) +2024-11-20 10:46:59,450 - INFO - 127.0.0.1 - - [20/Nov/2024 10:46:59] "GET /scout HTTP/1.1" 200 - +2024-11-20 10:46:59,495 - INFO - 127.0.0.1 - - [20/Nov/2024 10:46:59] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:47:00,988 - INFO - Handling send message request +2024-11-20 10:47:00,992 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:00] "GET /send_message HTTP/1.1" 200 - +2024-11-20 10:47:01,018 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:01] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:47:09,146 - INFO - Handling send message request +2024-11-20 10:47:09,152 - INFO - Message sent: b'gAAAAABnPU2tmg9lK3_djUY-083WSR_ZnV6r2pEJyAs0m1cvrM8u2HRriMBq_26x1ybW2xlFfWiu0mQtOcFFAVEdaJ9NSmy4Rg==', Photo URL: None +2024-11-20 10:47:09,154 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:09] "POST /send_message HTTP/1.1" 200 - +2024-11-20 10:47:18,011 - INFO - Accessing commander page +2024-11-20 10:47:18,015 - WARNING - Unauthorized access to commander page +2024-11-20 10:47:18,016 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:18] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:47:19,441 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:19] "GET / HTTP/1.1" 200 - +2024-11-20 10:47:19,493 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:19] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:47:21,113 - INFO - Handling login request +2024-11-20 10:47:21,122 - ERROR - Failed to decrypt message: +2024-11-20 10:47:21,124 - INFO - User admin logged in with role 指挥者 +2024-11-20 10:47:21,126 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:21] "POST /login HTTP/1.1" 302 - +2024-11-20 10:47:21,137 - INFO - Accessing commander page +2024-11-20 10:47:21,149 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:21] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:47:46,452 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:47:46,452 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:47:46,452 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:47:46,662 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:47:47,452 - WARNING - * Debugger is active! +2024-11-20 10:47:47,458 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:47:50,284 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:8000 + * Running on http://192.168.89.210:8000 +2024-11-20 10:47:50,284 - INFO - Press CTRL+C to quit +2024-11-20 10:47:50,298 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:47:51,096 - WARNING - * Debugger is active! +2024-11-20 10:47:51,100 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:47:52,467 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:52] "GET /commander HTTP/1.1" 302 - +2024-11-20 10:47:52,474 - INFO - Handling login request +2024-11-20 10:47:52,524 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:52] "GET /login?next=/commander HTTP/1.1" 200 - +2024-11-20 10:47:52,657 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:52] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:47:54,711 - INFO - Handling login request +2024-11-20 10:47:54,724 - ERROR - Failed to decrypt message: +2024-11-20 10:47:54,727 - INFO - User admin logged in with role 指挥者 +2024-11-20 10:47:54,728 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:54] "POST /login HTTP/1.1" 302 - +2024-11-20 10:47:54,741 - INFO - Accessing commander page +2024-11-20 10:47:54,747 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:54] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:47:58,241 - INFO - Handling send message request +2024-11-20 10:47:58,245 - INFO - 127.0.0.1 - - [20/Nov/2024 10:47:58] "GET /send_message HTTP/1.1" 200 - +2024-11-20 10:48:00,626 - INFO - Handling send message request +2024-11-20 10:48:00,632 - INFO - Message sent: b'gAAAAABnPU3gK0XLQ3oQZTYYMFb-8wCmAxrteyNEwD2-z1lhpo9zZSwoq86lAFlUF-WEmwyMtqZzCH7qmEdg5l755bCUzZ2tow==', Photo URL: None +2024-11-20 10:48:00,634 - INFO - 127.0.0.1 - - [20/Nov/2024 10:48:00] "POST /send_message HTTP/1.1" 200 - +2024-11-20 10:48:04,303 - INFO - Handling send message request +2024-11-20 10:48:04,307 - INFO - Message sent: b'gAAAAABnPU3kO1jT1oGOTz4M0xOai4MPyLZ67-dtSfSQe2MqUspKdBlbLW3EkCv9ZsxdV612tjepmgaLZVKRUyfzXrVuI3Bb_g==', Photo URL: None +2024-11-20 10:48:04,310 - INFO - 127.0.0.1 - - [20/Nov/2024 10:48:04] "POST /send_message HTTP/1.1" 200 - +2024-11-20 10:48:05,671 - INFO - Handling send message request +2024-11-20 10:48:05,672 - INFO - 127.0.0.1 - - [20/Nov/2024 10:48:05] "GET /send_message HTTP/1.1" 200 - +2024-11-20 10:48:08,276 - INFO - Accessing commander page +2024-11-20 10:48:08,278 - INFO - 127.0.0.1 - - [20/Nov/2024 10:48:08] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:52:39,361 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:52:39,362 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:52:39,362 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 10:52:42,621 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:8000 + * Running on http://192.168.89.210:8000 +2024-11-20 10:52:42,622 - INFO - Press CTRL+C to quit +2024-11-20 10:52:42,637 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 10:52:43,432 - WARNING - * Debugger is active! +2024-11-20 10:52:43,437 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 10:52:48,885 - INFO - Handling login request +2024-11-20 10:52:48,940 - INFO - 127.0.0.1 - - [20/Nov/2024 10:52:48] "GET /login HTTP/1.1" 200 - +2024-11-20 10:52:49,081 - INFO - 127.0.0.1 - - [20/Nov/2024 10:52:49] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:52:50,492 - INFO - Handling login request +2024-11-20 10:52:50,509 - ERROR - Failed to decrypt message: +2024-11-20 10:52:50,511 - INFO - User admin logged in with role 指挥者 +2024-11-20 10:52:50,513 - INFO - 127.0.0.1 - - [20/Nov/2024 10:52:50] "POST /login HTTP/1.1" 302 - +2024-11-20 10:52:50,525 - INFO - Accessing commander page +2024-11-20 10:52:50,530 - ERROR - Failed to decrypt message: +2024-11-20 10:52:50,532 - ERROR - Failed to decrypt message: +2024-11-20 10:52:50,535 - ERROR - Failed to decrypt message: +2024-11-20 10:52:50,536 - ERROR - Failed to decrypt message: string argument should contain only ASCII characters +2024-11-20 10:52:50,539 - ERROR - Failed to decrypt message: +2024-11-20 10:52:50,549 - INFO - 127.0.0.1 - - [20/Nov/2024 10:52:50] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:52:53,601 - INFO - Handling clear messages request +2024-11-20 10:52:53,604 - INFO - Messages cleared successfully +2024-11-20 10:52:53,605 - INFO - 127.0.0.1 - - [20/Nov/2024 10:52:53] "POST /clear_messages HTTP/1.1" 302 - +2024-11-20 10:52:53,620 - INFO - Accessing commander page +2024-11-20 10:52:53,623 - INFO - 127.0.0.1 - - [20/Nov/2024 10:52:53] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:52:59,690 - INFO - Handling login request +2024-11-20 10:52:59,700 - INFO - 127.0.0.1 - - [20/Nov/2024 10:52:59] "GET /login HTTP/1.1" 200 - +2024-11-20 10:52:59,747 - INFO - 127.0.0.1 - - [20/Nov/2024 10:52:59] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:53:02,911 - INFO - Handling login request +2024-11-20 10:53:02,917 - ERROR - Failed to decrypt message: +2024-11-20 10:53:02,922 - INFO - User scout logged in with role 侦查者 +2024-11-20 10:53:02,924 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:02] "POST /login HTTP/1.1" 302 - +2024-11-20 10:53:02,937 - INFO - Accessing scout page +2024-11-20 10:53:02,940 - INFO - Notifications fetched: ({'id': 11, 'user_id': 5, 'message_id': 14, 'action': 'accept', 'created_at': datetime.datetime(2024, 11, 20, 10, 27, 38), 'message': '秘密'}, {'id': 10, 'user_id': 5, 'message_id': 13, 'action': 'accept', 'created_at': datetime.datetime(2024, 11, 20, 9, 4, 25), 'message': 'hhh'}) +2024-11-20 10:53:02,943 - ERROR - Failed to decrypt message: string argument should contain only ASCII characters +2024-11-20 10:53:02,944 - ERROR - Failed to decrypt message: +2024-11-20 10:53:02,950 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:02] "GET /scout HTTP/1.1" 200 - +2024-11-20 10:53:03,003 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:03] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:53:04,322 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:04] "POST /clear_notifications HTTP/1.1" 200 - +2024-11-20 10:53:04,341 - INFO - Accessing scout page +2024-11-20 10:53:04,343 - INFO - Notifications fetched: () +2024-11-20 10:53:04,345 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:04] "GET /scout HTTP/1.1" 200 - +2024-11-20 10:53:04,380 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:04] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:53:05,037 - INFO - Handling send message request +2024-11-20 10:53:05,040 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:05] "GET /send_message HTTP/1.1" 200 - +2024-11-20 10:53:05,074 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:05] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:53:07,610 - INFO - Handling send message request +2024-11-20 10:53:07,615 - INFO - Message sent: b'gAAAAABnPU8TGQdgTFSSydEaT43Tyy_8Al3-ZgndNYSTl6xDTDDbpP-rEbtNF1KVxkYRlJxrx8xHYwN1VHEwN2vLxl_qysCwIQ==', Photo URL: None +2024-11-20 10:53:07,616 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:07] "POST /send_message HTTP/1.1" 200 - +2024-11-20 10:53:14,474 - INFO - Handling send message request +2024-11-20 10:53:14,478 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:14] "GET /send_message HTTP/1.1" 200 - +2024-11-20 10:53:18,440 - INFO - Accessing commander page +2024-11-20 10:53:18,442 - WARNING - Unauthorized access to commander page +2024-11-20 10:53:18,445 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:18] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:53:19,211 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:19] "GET / HTTP/1.1" 200 - +2024-11-20 10:53:19,253 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:19] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:53:21,113 - INFO - Handling login request +2024-11-20 10:53:21,124 - ERROR - Failed to decrypt message: +2024-11-20 10:53:21,126 - INFO - User admin logged in with role 指挥者 +2024-11-20 10:53:21,128 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:21] "POST /login HTTP/1.1" 302 - +2024-11-20 10:53:21,141 - INFO - Accessing commander page +2024-11-20 10:53:21,146 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:21] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:53:39,911 - INFO - Handling message action: accept for ID: 18 +2024-11-20 10:53:39,913 - INFO - Message status updated: accept +2024-11-20 10:53:39,915 - INFO - Message data fetched: {'message': 'gAAAAABnPU8TGQdgTFSSydEaT43Tyy_8Al3-ZgndNYSTl6xDTDDbpP-rEbtNF1KVxkYRlJxrx8xHYwN1VHEwN2vLxl_qysCwIQ=='} +2024-11-20 10:53:39,917 - INFO - Scouts found: ({'id': 5},) +2024-11-20 10:53:39,920 - INFO - Notification inserted for scout: 5 +2024-11-20 10:53:39,922 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:39] "POST /handle_message/18/accept HTTP/1.1" 302 - +2024-11-20 10:53:39,933 - INFO - Accessing commander page +2024-11-20 10:53:39,936 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:39] "GET /commander HTTP/1.1" 200 - +2024-11-20 10:53:42,576 - INFO - Accessing scout page +2024-11-20 10:53:42,578 - WARNING - Unauthorized access to scout page +2024-11-20 10:53:42,580 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:42] "GET /scout HTTP/1.1" 200 - +2024-11-20 10:53:43,408 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:43] "GET / HTTP/1.1" 200 - +2024-11-20 10:53:43,446 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:43] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 10:53:45,003 - INFO - Handling login request +2024-11-20 10:53:45,012 - ERROR - Failed to decrypt message: +2024-11-20 10:53:45,014 - INFO - User scout logged in with role 侦查者 +2024-11-20 10:53:45,016 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:45] "POST /login HTTP/1.1" 302 - +2024-11-20 10:53:45,030 - INFO - Accessing scout page +2024-11-20 10:53:45,030 - INFO - Notifications fetched: ({'id': 12, 'user_id': 5, 'message_id': 18, 'action': 'accept', 'created_at': datetime.datetime(2024, 11, 20, 10, 53, 39), 'message': 'gAAAAABnPU8TGQdgTFSSydEaT43Tyy_8Al3-ZgndNYSTl6xDTDDbpP-rEbtNF1KVxkYRlJxrx8xHYwN1VHEwN2vLxl_qysCwIQ=='},) +2024-11-20 10:53:45,035 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:45] "GET /scout HTTP/1.1" 200 - +2024-11-20 10:53:45,076 - INFO - 127.0.0.1 - - [20/Nov/2024 10:53:45] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:04:44,554 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:8000 + * Running on http://192.168.89.210:8000 +2024-11-20 11:04:44,554 - INFO - Press CTRL+C to quit +2024-11-20 11:04:44,565 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 11:04:45,347 - WARNING - * Debugger is active! +2024-11-20 11:04:45,353 - INFO - * Debugger PIN: 266-144-430 +2024-11-20 11:04:52,396 - INFO - 127.0.0.1 - - [20/Nov/2024 11:04:52] "GET /scout HTTP/1.1" 302 - +2024-11-20 11:04:52,402 - INFO - Handling login request +2024-11-20 11:04:52,451 - INFO - 127.0.0.1 - - [20/Nov/2024 11:04:52] "GET /login?next=/scout HTTP/1.1" 200 - +2024-11-20 11:04:52,600 - INFO - 127.0.0.1 - - [20/Nov/2024 11:04:52] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:04:54,193 - INFO - 127.0.0.1 - - [20/Nov/2024 11:04:54] "GET /commander HTTP/1.1" 302 - +2024-11-20 11:04:54,199 - INFO - Handling login request +2024-11-20 11:04:54,208 - INFO - 127.0.0.1 - - [20/Nov/2024 11:04:54] "GET /login?next=/commander HTTP/1.1" 200 - +2024-11-20 11:04:54,235 - INFO - 127.0.0.1 - - [20/Nov/2024 11:04:54] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:04:56,393 - INFO - Handling login request +2024-11-20 11:04:56,408 - ERROR - Failed to decrypt message: +2024-11-20 11:04:56,409 - INFO - User admin logged in with role 指挥者 +2024-11-20 11:04:56,409 - INFO - 127.0.0.1 - - [20/Nov/2024 11:04:56] "POST /login HTTP/1.1" 302 - +2024-11-20 11:04:56,429 - INFO - Accessing commander page +2024-11-20 11:04:56,429 - ERROR - Failed to decrypt message: +2024-11-20 11:04:56,435 - ERROR - Failed to decrypt message: +2024-11-20 11:04:56,445 - INFO - 127.0.0.1 - - [20/Nov/2024 11:04:56] "GET /commander HTTP/1.1" 200 - +2024-11-20 11:05:05,506 - INFO - Handling login request +2024-11-20 11:05:05,518 - ERROR - Failed to decrypt message: +2024-11-20 11:05:05,518 - INFO - User attacker logged in with role 攻击者 +2024-11-20 11:05:05,522 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:05] "POST /login HTTP/1.1" 302 - +2024-11-20 11:05:05,536 - INFO - Accessing attacker page +2024-11-20 11:05:05,537 - ERROR - Failed to decrypt message: +2024-11-20 11:05:05,542 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:05] "GET /attacker HTTP/1.1" 200 - +2024-11-20 11:05:05,593 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:05] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:05:07,010 - INFO - Handling execute attack request for ID: 15 +2024-11-20 11:05:07,013 - INFO - Attack executed for ID: 15 +2024-11-20 11:05:07,016 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:07] "POST /execute_attack/15 HTTP/1.1" 302 - +2024-11-20 11:05:07,026 - INFO - Accessing attacker page +2024-11-20 11:05:07,029 - ERROR - Failed to decrypt message: +2024-11-20 11:05:07,031 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:07] "GET /attacker HTTP/1.1" 200 - +2024-11-20 11:05:07,064 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:07] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:05:10,010 - INFO - Accessing commander page +2024-11-20 11:05:10,011 - WARNING - Unauthorized access to commander page +2024-11-20 11:05:10,013 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:10] "GET /commander HTTP/1.1" 200 - +2024-11-20 11:05:10,936 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:10] "GET / HTTP/1.1" 200 - +2024-11-20 11:05:10,968 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:10] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:05:12,786 - INFO - Handling login request +2024-11-20 11:05:12,796 - ERROR - Failed to decrypt message: +2024-11-20 11:05:12,797 - INFO - User admin logged in with role 指挥者 +2024-11-20 11:05:12,799 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:12] "POST /login HTTP/1.1" 302 - +2024-11-20 11:05:12,817 - INFO - Accessing commander page +2024-11-20 11:05:12,821 - ERROR - Failed to decrypt message: +2024-11-20 11:05:12,821 - ERROR - Failed to decrypt message: +2024-11-20 11:05:12,827 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:12] "GET /commander HTTP/1.1" 200 - +2024-11-20 11:05:42,827 - INFO - Handling send attack request +2024-11-20 11:05:42,829 - INFO - Attack coordinate sent: b'gAAAAABnPVIGNOJ6ubwFxLtgT4CrLZdRCgzNcEGUgi5nmBSlBdE3yeDkOQaWtxfCrf4guWd-KxxN81oLCmOzXyUfXNOs8PXZ5w==' +2024-11-20 11:05:42,834 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:42] "POST /send_attack HTTP/1.1" 302 - +2024-11-20 11:05:42,846 - INFO - Accessing commander page +2024-11-20 11:05:42,847 - ERROR - Failed to decrypt message: +2024-11-20 11:05:42,847 - ERROR - Failed to decrypt message: +2024-11-20 11:05:42,852 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:42] "GET /commander HTTP/1.1" 200 - +2024-11-20 11:05:45,442 - INFO - Accessing attacker page +2024-11-20 11:05:45,445 - WARNING - Unauthorized access to attacker page +2024-11-20 11:05:45,447 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:45] "GET /attacker HTTP/1.1" 200 - +2024-11-20 11:05:46,490 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:46] "GET / HTTP/1.1" 200 - +2024-11-20 11:05:46,529 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:46] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:05:48,903 - INFO - Handling login request +2024-11-20 11:05:48,913 - ERROR - Failed to decrypt message: +2024-11-20 11:05:48,915 - INFO - User attacker logged in with role 攻击者 +2024-11-20 11:05:48,917 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:48] "POST /login HTTP/1.1" 302 - +2024-11-20 11:05:48,938 - INFO - Accessing attacker page +2024-11-20 11:05:48,942 - ERROR - Failed to decrypt message: +2024-11-20 11:05:48,944 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:48] "GET /attacker HTTP/1.1" 200 - +2024-11-20 11:05:48,987 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:48] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:05:50,591 - INFO - Handling execute attack request for ID: 16 +2024-11-20 11:05:50,597 - INFO - Attack executed for ID: 16 +2024-11-20 11:05:50,599 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:50] "POST /execute_attack/16 HTTP/1.1" 302 - +2024-11-20 11:05:50,609 - INFO - Accessing attacker page +2024-11-20 11:05:50,612 - ERROR - Failed to decrypt message: +2024-11-20 11:05:50,613 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:50] "GET /attacker HTTP/1.1" 200 - +2024-11-20 11:05:50,647 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:50] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:05:52,299 - INFO - Accessing commander page +2024-11-20 11:05:52,302 - WARNING - Unauthorized access to commander page +2024-11-20 11:05:52,303 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:52] "GET /commander HTTP/1.1" 200 - +2024-11-20 11:05:53,204 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:53] "GET / HTTP/1.1" 200 - +2024-11-20 11:05:53,236 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:53] "GET /static/login.css HTTP/1.1" 304 - +2024-11-20 11:05:54,802 - INFO - Handling login request +2024-11-20 11:05:54,811 - ERROR - Failed to decrypt message: +2024-11-20 11:05:54,813 - INFO - User admin logged in with role 指挥者 +2024-11-20 11:05:54,815 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:54] "POST /login HTTP/1.1" 302 - +2024-11-20 11:05:54,828 - INFO - Accessing commander page +2024-11-20 11:05:54,831 - ERROR - Failed to decrypt message: +2024-11-20 11:05:54,833 - ERROR - Failed to decrypt message: +2024-11-20 11:05:54,837 - INFO - 127.0.0.1 - - [20/Nov/2024 11:05:54] "GET /commander HTTP/1.1" 200 - +2024-11-20 11:08:07,873 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 11:08:07,876 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 11:08:07,877 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 11:08:07,877 - INFO - * Detected change in 'e:\\_Ufo\\0000jiegou\\TheBattleCar\\app.py', reloading +2024-11-20 11:08:08,773 - INFO - * Restarting with watchdog (windowsapi) +2024-11-20 11:08:09,644 - WARNING - * Debugger is active! +2024-11-20 11:08:09,651 - INFO - * Debugger PIN: 266-144-430 diff --git a/TheBattleCar/app.py b/TheBattleCar/app.py index d92f0c7..4e09fe7 100644 --- a/TheBattleCar/app.py +++ b/TheBattleCar/app.py @@ -12,6 +12,37 @@ from wtforms import Form, StringField from wtforms.validators import Length, EqualTo, ValidationError import pymysql +from cryptography.fernet import Fernet,InvalidToken + +# 鐢熸垚瀵嗛挜骞朵繚瀛樺埌鏂囦欢锛堜粎鍦ㄧ涓娆¤繍琛屾椂鐢熸垚锛 +def generate_key(): + key = Fernet.generate_key() + with open("secret.key", "wb") as key_file: + key_file.write(key) + +# 鍔犺浇瀵嗛挜 +def load_key(): + return open("secret.key", "rb").read() + +# 鍔犲瘑鍑芥暟 +def encrypt_message(message): + key = load_key() + f = Fernet(key) + encrypted_message = f.encrypt(message.encode()) + return encrypted_message + +# 瑙e瘑鍑芥暟 +def decrypt_message(encrypted_message): + key = load_key() + f = Fernet(key) + try: + print(f"Encrypted message: {encrypted_message}") + decrypted_message = f.decrypt(encrypted_message).decode() + return decrypted_message + except (InvalidToken, ValueError) as e: + logger.error(f"Failed to decrypt message: {e}") + return None + conn = pymysql.connect(host="localhost", port=3306, user="root", password="lin556688", database="mydatabase", charset="utf8mb4") @@ -139,6 +170,8 @@ def login(): cursor.close() if user_data: + # 瑙e瘑瀵嗙爜 + decrypted_password = decrypt_message(user_data['password']) user = User(user_data['id'], user_data['username'], user_data['role']) login_user(user) logger.info(f"User {username} logged in with role {user_data['role']}") @@ -178,6 +211,8 @@ class RegisterForm(Form): def validate_captcha(self, filed): if filed.data not in ['1111', '2222', '3333']: raise ValidationError('鏍¢獙鐮侀敊璇') + +# 娉ㄥ唽椤甸潰 @app.route('/register', methods=['GET', 'POST']) def register(): if request.method == 'GET': @@ -203,7 +238,9 @@ def register(): if len(cursor_select) > 0: return '鐢ㄦ埛宸茬粡瀛樺湪 杩斿洖鐧诲綍' else: - code = "INSERT INTO users(username, password, role) VALUES('%s', '%s', '%s')" % (username, password, role) + # 鍔犲瘑瀵嗙爜 + encrypted_password = encrypt_message(password) + code = "INSERT INTO users(username, password, role) VALUES('%s', '%s', '%s')" % (username, encrypted_password, role) print(con_my_sql(code)) return '娉ㄥ唽鎴愬姛 杩斿洖鐧诲綍' else: @@ -226,6 +263,10 @@ def scout(): cursor.close() logger.info(f"Notifications fetched: {notifications}") + # 瑙e瘑閫氱煡 + for notification in notifications: + notification['message'] = decrypt_message(notification['message']) + return render_template('scout.html', notifications=notifications) # 澶勭悊娑堟伅 @@ -255,6 +296,9 @@ def handle_message(message_id, action): cursor.close() logger.info(f"Message data fetched: {message_data}") + # 瑙e瘑娑堟伅 + decrypted_message = decrypt_message(message_data['message']) + # 灏嗙粨鏋滃弽棣堢粰渚﹀療鑰 cursor = mysql.connection.cursor() cursor.execute("SELECT id FROM users WHERE role = '渚︽煡鑰'") @@ -312,13 +356,21 @@ def commander(): cursor.execute("SELECT id, coordinate, attacked, created_at FROM attacks ORDER BY created_at DESC") attacks = cursor.fetchall() cursor.close() - + + # 瑙e瘑鍧愭爣 + for attack in attacks: + attack['coordinate'] = decrypt_message(attack['coordinate']) + # 鑾峰彇渚﹀療鑰呭彂閫佺殑娑堟伅 cursor = mysql.connection.cursor() cursor.execute("SELECT id, message, photo_url, created_at, status FROM messages ORDER BY created_at DESC") messages = cursor.fetchall() cursor.close() + # 瑙e瘑娑堟伅 + for message in messages: + message['message'] = decrypt_message(message['message']) + return render_template('commander.html', media_items=media_items, attacks=attacks, messages=messages) # 鎸囨尌鑰呭彂閫佹敾鍑诲潗鏍 @@ -334,6 +386,10 @@ def send_attack(): if not coordinate: logger.warning("No coordinate provided") return "No coordinate provided", 400 + + # 鍔犲瘑鍧愭爣 + encrypted_coordinate = encrypt_message(coordinate) + coordinate = encrypted_coordinate # 鎻掑叆鏀诲嚮鍧愭爣鍒版暟鎹簱 cursor = mysql.connection.cursor() @@ -400,7 +456,11 @@ def attacker(): cursor.execute("SELECT id, coordinate, created_at FROM attacks ORDER BY created_at DESC") attacks = cursor.fetchall() cursor.close() - + + # 瑙e瘑鍧愭爣 + for attack in attacks: + attack['coordinate'] = decrypt_message(attack['coordinate']) + return render_template('attacker.html', attacks=attacks) # 鏀诲嚮鑰呮墽琛屾敾鍑 @@ -453,7 +513,11 @@ def send_message(): else: logger.warning("Allowed file types are png, jpg, jpeg, gif") return "Allowed file types are png, jpg, jpeg, gif", 400 - + + # 鍔犲瘑鏁版嵁 + encrypted_message = encrypt_message(message) + message = encrypted_message + # 鎻掑叆鏁版嵁鍒 MySQL cursor = mysql.connection.cursor() cursor.execute("INSERT INTO messages (message, photo_url, status) VALUES (%s, %s, %s)", (message, photo_url, 'pending')) @@ -465,27 +529,45 @@ def send_message(): return render_template('send_message.html') -# 鑾峰彇鎵鏈夋秷鎭 + + @app.route('/messages', methods=['GET']) @login_required -def get_messages(): - logger.info("Handling get messages request") +def messages(): + logger.info("Handling messages request") + + # 瑙掕壊妫鏌 + if current_user.role != '鎸囨尌鑰': + logger.warning("Unauthorized access to messages") + if request.accept_mimetypes.best_match(['application/json', 'text/html']) == 'application/json': + return jsonify({"error": "Unauthorized access"}), 403 + else: + return redirect(url_for('login')) + + # 鑾峰彇娑堟伅 cursor = mysql.connection.cursor() - cursor.execute("SELECT id, message, photo_url, created_at, status FROM messages") + cursor.execute("SELECT id, message, photo_url, created_at, status FROM messages ORDER BY created_at DESC") result = cursor.fetchall() cursor.close() + # 瑙e瘑娑堟伅 messages = [] for row in result: + decrypted_message = decrypt_message(row['message']) messages.append({ 'id': row['id'], - 'message': row['message'], + 'message': decrypted_message, 'photo_url': row['photo_url'], 'created_at': row['created_at'], 'status': row['status'] }) - return jsonify(messages) - + # 鏍规嵁璇锋眰绫诲瀷杩斿洖涓嶅悓鐨勫搷搴 + if request.accept_mimetypes.best_match(['application/json', 'text/html']) == 'application/json': + return jsonify(messages) + else: + return render_template('view_messages.html', messages=messages) + if __name__ == '__main__': + generate_key() # 浠呭湪绗竴娆¤繍琛屾椂鐢熸垚瀵嗛挜 app.run(debug=True, host='0.0.0.0', port=8000) \ No newline at end of file diff --git a/TheBattleCar/secret.key b/TheBattleCar/secret.key index aa43d09..95f79aa 100644 --- a/TheBattleCar/secret.key +++ b/TheBattleCar/secret.key @@ -1 +1 @@ -xO0rhaZ7_TEiOBm2ZH2b6L9VIiECc_aO8FeY5HGt2nY= \ No newline at end of file +cykFDUsS45ugR2oQsP7rGPMkDQK6bXcTJ6HMBdHleuI= \ No newline at end of file