WWW.YOUINFO.SITE
标签聚合 脚本

/tag/脚本

LinuxDo 最新话题 · 2026-06-12 01:32:55+08:00 · tech

之前让hermes帮我写了点脚本 然后调试之后发现根本走不通,就放那了。 今天想起来脚本是会自动运行的,没什么用,我就让hermes给我把脚本进程关了,文件删了。刚好接入了mimo code送的一点额度,我寻思这应该没什么事吧。 就直接批准了,然后它不知道为什么,给自己 数据库 删了几张表,直接给自己删失忆了。还好前几天用codex给hermes 做主题的时候备份了一个,这下直接失忆回到几天前了,真难绷啊,还有自杀的。 2 个帖子 - 2 位参与者 阅读完整话题

v2ex · 2026-06-11 20:57:55+08:00 · tech

把抢机脚本从 Cloud Shell (断连就停)改成了跑在自己机器上的 launchd 守护进程,连跑直到抢到。几个关键点踩出来分享下: 用 API 签名密钥别用 session token (会过期)。 错误按消息文本分类:Out of host capacity 其实是 500 InternalError ,不能只看状态码; 429 要退避。 OCI CLI 默认对 5xx 内部重试退避~110s ,把轮换节奏全打乱→launch 加--no-retry 秒返回。 抢到即停且不能抢第二台:launch 不加 --wait-for-state (退 0=已建无歧义)+每次 launch 前查存量+KeepAlive{SuccessfulExit:false}+哨兵守卫扛重启。 Oracle Ubuntu 镜像自带 iptables 挡 80/443 (只放行 22 )+默认 MTU 9000 ,装 Web 服务记得处理。 抢中率最大杠杆:升级 PAYG (只用免费额度仍 $0 ,但拿容量优先级高得多)。 升级 PAYG 后约 1 小时抢到 4 核/24G 。机器拿来给我的 IP 检测小工具 ipok.io 做双栈 echo 端点了。有需要细节的可以交流。

LinuxDo 最新话题 · 2026-06-11 20:48:22+08:00 · tech

脚本 #!/data/data/com.termux/files/usr/bin/bash set -euo pipefail readonly SCRIPT_NAME="$(basename "$0")" readonly MIMO_PACKAGE_NAME="@mimo-ai/cli" readonly MIMO_PACKAGE_VERSION="${MIMO_CODE_VERSION:-${MIMOCODE_VERSION:-latest}}" readonly PREFIX_DIR="${PREFIX:-/data/data/com.termux/files/usr}" readonly HOST_MIMO_PATH="$PREFIX_DIR/bin/mimo" readonly MIMO_CLI_PKG_DIR="$PREFIX_DIR/lib/node_modules/@mimo-ai/cli" readonly MIMO_ARCH_PKG_NAME="@mimo-ai/mimocode-linux-arm64" readonly MIMO_ARCH_PKG_DIR="$PREFIX_DIR/lib/node_modules/$MIMO_ARCH_PKG_NAME" readonly TMP_ROOT="$HOME/tmp" readonly BACKUP_DIR="$TMP_ROOT/mimocode-backups" readonly WRAPPER_MARKER="# mimocode-termux-glibc-wrapper" # Resolved by install_mimo_package() after locating the real glibc ELF. MIMO_BINARY_PATH="" MIMO_RESOLVED_VERSION="" readonly C_BOLD_BLUE="\033[1;34m" readonly C_BOLD_GREEN="\033[1;32m" readonly C_BOLD_YELLOW="\033[1;33m" readonly C_BOLD_RED="\033[1;31m" readonly C_RESET="\033[0m" info() { printf '%b[INFO]%b %s\n' "$C_BOLD_BLUE" "$C_RESET" "$*"; } success() { printf '%b[ OK ]%b %s\n' "$C_BOLD_GREEN" "$C_RESET" "$*"; } warn() { printf '%b[WARN]%b %s\n' "$C_BOLD_YELLOW" "$C_RESET" "$*" >&2; } die() { printf '%b[ERR ]%b %s\n' "$C_BOLD_RED" "$C_RESET" "$*" >&2; exit 1; } usage() { cat <<EOF Usage: bash $SCRIPT_NAME What it does (glibc-runner mode, no proot): 1. Installs glibc-repo, refreshes apt metadata, installs glibc-runner. 2. Installs nodejs-lts + npm in Termux (if missing). 3. npm installs ${MIMO_PACKAGE_NAME} globally, then force-installs the ${MIMO_ARCH_PKG_NAME} native linux-arm64 package. 4. Skips MiMoCode's postinstall script because Termux Node reports process.platform='android' and the upstream script looks for a non-existent @mimo-ai/mimocode-android-arm64 package. 5. Replaces \$PREFIX/bin/mimo with a grun wrapper that runs the glibc ELF directly on Termux. Environment overrides: MIMO_CODE_VERSION npm package version/tag, default: ${MIMO_PACKAGE_VERSION} examples: latest, preview, 0.1.0, v0.1.0 MIMOCODE_VERSION alias for MIMO_CODE_VERSION Notes: - Official MiMoCode install docs: https://github.com/XiaomiMiMo/MiMo-Code - glibc-runner injects glibc via LD_LIBRARY_PATH; kernel calls are native. EOF } command_exists() { command -v "$1" >/dev/null 2>&1; } # ELF magic = 7f 45 4c 46; e_machine at offset 18 = 0xb7 for EM_AARCH64. is_valid_aarch64_elf() { local f="$1" [ -f "$f" ] || return 1 local magic machine magic=$(od -An -tx1 -N4 "$f" 2>/dev/null | tr -d ' \n') [ "$magic" = "7f454c46" ] || return 1 machine=$(od -An -tx1 -j18 -N1 "$f" 2>/dev/null | tr -d ' \n') [ "$machine" = "b7" ] } find_arch_binary() { local candidate for candidate in \ "$MIMO_ARCH_PKG_DIR/bin/mimo" \ "$MIMO_CLI_PKG_DIR/bin/.mimocode"; do if is_valid_aarch64_elf "$candidate"; then MIMO_BINARY_PATH="$candidate" return 0 fi done while IFS= read -r candidate; do if is_valid_aarch64_elf "$candidate"; then MIMO_BINARY_PATH="$candidate" return 0 fi done < <(find "$MIMO_ARCH_PKG_DIR" "$MIMO_CLI_PKG_DIR" -type f -size +10M 2>/dev/null) return 1 } ensure_tmp_root() { mkdir -p "$TMP_ROOT" [ -w "$TMP_ROOT" ] || die "Temp directory is not writable: $TMP_ROOT" export TMPDIR="$TMP_ROOT" } require_termux() { [ -d "$PREFIX_DIR" ] || die "This script must run in Termux." command_exists pkg || die "pkg not found. This script must run in Termux." if [ -r /proc/1/status ] && grep -q 'TracerPid:.*[1-9]' /proc/1/status 2>/dev/null; then warn "Detected non-zero TracerPid on PID 1 -- looks like a proot session." warn "Run this script from a plain Termux shell, not from inside proot-distro." fi } ensure_termux_package() { local package_name="$1" if dpkg -s "$package_name" >/dev/null 2>&1; then success "Termux package already installed: $package_name" return 0 fi info "Installing Termux package: $package_name" pkg install -y "$package_name" success "Installed Termux package: $package_name" } ensure_glibc_runner() { ensure_termux_package "glibc-repo" if ! apt-cache show glibc-runner >/dev/null 2>&1; then info "Refreshing apt metadata so glibc-repo becomes visible" pkg update -y || apt-get update -y || true fi ensure_termux_package "glibc-runner" command_exists grun || die "grun not found after installing glibc-runner." } ensure_nodejs() { if command_exists node && command_exists npm; then success "Termux node present: $(node --version), npm $(npm --version)" return 0 fi if dpkg -s nodejs >/dev/null 2>&1; then success "nodejs already installed" else ensure_termux_package "nodejs-lts" fi command_exists node && command_exists npm || die "node/npm not found after installing nodejs." } resolve_mimo_version() { local requested="$MIMO_PACKAGE_VERSION" if [ "$requested" != "latest" ]; then requested="${requested#v}" fi local pkg_spec="$MIMO_PACKAGE_NAME" if [ "$requested" != "latest" ]; then pkg_spec="${MIMO_PACKAGE_NAME}@${requested}" fi info "Resolving version for ${pkg_spec}" local resolved resolved=$(npm view "$pkg_spec" version 2>/dev/null | tail -n1) \ || die "Failed to resolve version for ${pkg_spec} via npm view" [[ "$resolved" =~ ^[0-9]+\.[0-9]+ ]] \ || die "npm view returned a bogus version: '$resolved'" MIMO_RESOLVED_VERSION="$resolved" } backup_existing_launcher() { mkdir -p "$BACKUP_DIR" [ -e "$HOST_MIMO_PATH" ] || return 0 if grep -Fq "$WRAPPER_MARKER" "$HOST_MIMO_PATH" 2>/dev/null; then success "glibc-runner wrapper already in place" return 0 fi local backup_path="$BACKUP_DIR/mimo.host-backup.$(date +%Y%m%d_%H%M%S)" cp -P "$HOST_MIMO_PATH" "$backup_path" success "Backed up existing launcher to $backup_path" } install_mimo_package() { resolve_mimo_version local main_version="$MIMO_RESOLVED_VERSION" local pinned_main="${MIMO_PACKAGE_NAME}@${main_version}" local arch_spec="${MIMO_ARCH_PKG_NAME}@${main_version}" info "Installing ${pinned_main} without upstream optional platform packages" npm install -g --force --ignore-scripts --omit=optional "$pinned_main" info "Installing ${arch_spec} for Termux via glibc-runner" npm install -g --force --ignore-scripts --os=linux --cpu=arm64 "$arch_spec" find_arch_binary || die "No valid aarch64 ELF found under $MIMO_ARCH_PKG_DIR. \ The arch package may not have unpacked correctly; inspect with: \ ls -la $MIMO_ARCH_PKG_DIR" success "MiMoCode native binary: $MIMO_BINARY_PATH ($(stat -c %s "$MIMO_BINARY_PATH" 2>/dev/null || echo '?') bytes)" } install_host_wrapper() { local tmp_wrapper tmp_wrapper="$(mktemp "$TMP_ROOT/mimo-grun.XXXXXX")" cat >"$tmp_wrapper" <<EOF #!/data/data/com.termux/files/usr/bin/sh $WRAPPER_MARKER mkdir -p "\$HOME/tmp" 2>/dev/null || true export TMPDIR="\${TMPDIR:-\$HOME/tmp}" exec grun "$MIMO_BINARY_PATH" "\$@" EOF chmod 755 "$tmp_wrapper" rm -f "$HOST_MIMO_PATH" mv "$tmp_wrapper" "$HOST_MIMO_PATH" chmod 755 "$HOST_MIMO_PATH" success "Installed Termux launcher: $HOST_MIMO_PATH" } verify_install() { info "Verifying binary via grun" grun "$MIMO_BINARY_PATH" --version info "Verifying Termux launcher" "$HOST_MIMO_PATH" --version local path_mimo="" path_mimo="$(command -v mimo 2>/dev/null || true)" if [ -n "$path_mimo" ] && [ "$path_mimo" != "$HOST_MIMO_PATH" ]; then warn "Your PATH resolves 'mimo' to $path_mimo, not $HOST_MIMO_PATH." warn "Move $PREFIX_DIR/bin earlier in PATH or remove the older launcher." fi success "MiMoCode setup completed (glibc-runner mode)" } main() { if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then usage exit 0 fi ensure_tmp_root require_termux ensure_glibc_runner ensure_nodejs backup_existing_launcher install_mimo_package install_host_wrapper verify_install cat <<EOF Run MiMoCode with: mimo Configuration: mode: glibc-runner (no proot) binary: $MIMO_BINARY_PATH launcher: $HOST_MIMO_PATH temp: $TMP_ROOT If the official installer previously added ~/.mimocode/bin before $PREFIX_DIR/bin, that older launcher may shadow this Termux wrapper. Troubleshooting: - If npm cannot resolve a preview version, install with: MIMO_CODE_VERSION=preview bash $SCRIPT_NAME - If subprocess errors mention libc/ld.so, the binary is loading Termux bionic libs via inherited LD_LIBRARY_PATH. Check glibc-runner docs. EOF } main "$@" 1 个帖子 - 1 位参与者 阅读完整话题

v2ex · 2026-06-11 20:22:43+08:00 · tech

把抢机脚本从 Cloud Shell (断连就停)改成了跑在自己机器上的 launchd 守护进程,连跑直到抢到。几个关键点踩出来分享下: 用 API 签名密钥别用 session token (会过期)。 错误按消息文本分类:Out of host capacity 其实是 500 InternalError ,不能只看状态码; 429 要退避。 OCI CLI 默认对 5xx 内部重试退避~110s ,把轮换节奏全打乱→launch 加--no-retry 秒返回。 抢到即停且不能抢第二台:launch 不加 --wait-for-state (退 0=已建无歧义)+每次 launch 前查存量+KeepAlive{SuccessfulExit:false}+哨兵守卫扛重启。 Oracle Ubuntu 镜像自带 iptables 挡 80/443 (只放行 22 )+默认 MTU 9000 ,装 Web 服务记得处理。 抢中率最大杠杆:升级 PAYG (只用免费额度仍 $0 ,但拿容量优先级高得多)。 升级 PAYG 后约 1 小时抢到 4 核/24G 。机器拿来给我的 IP 检测小工具 ipok.io 做双栈 echo 端点了。有需要细节的可以交流。

LinuxDo 最新话题 · 2026-06-11 19:40:32+08:00 · tech

抢了大半个月一直在用ai优化,喜大普奔 今天终于抢到了 给各位还在挣扎的佬友分享一下 原理是通过 CDP 连接已登录的 Chrome 浏览器,在浏览器环境内发 fetch 请求绕过408限流,整点瞬间多地域并行抢购。 前置条件: Python 3.10+ (可以直接交给ai处理) Chrome 浏览器 已登录腾讯云账号 食用步骤: 1. 启动 Chrome 调试端口 # Windows Start-Process "chrome.exe" -ArgumentList "--remote-debugging-port=9222" # macOS /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 # Linux google-chrome --remote-debugging-port=9222 2. 在 Chrome 中登录腾讯云,打开活动页 活动页: https://cloud.tencent.com/act/pro/warmup-202606#MS 3. 试运行(只查询不下单) python snap-api.py --dry-run 4. 正式抢购 python snap-api.py # 等整点自动抢购 python snap-api.py --now # 立刻测试(不等整点) 关键点 要点 说明 408 限流 纯 HTTP 库无法绕过,必须用浏览器环境发 fetch CSRF X-CSRF-TOKEN = hash(skey) ,通过 page.route() 网络层注入 imageId 会过期,运行时从 React fiber + Lighthouse API 动态发现 多地域并行 上海/北京/广州 Promise.all 同时发请求 闪电波 整点不等 prepare-do,直接 3 地域裸 do-goods 错误码 错误码 含义 处理 0 成功 去支付 408 API 频率限制 等待重试 1100109 镜像不存在 切换 imageId 策略 1100110 正在执行其他操作 正常,其他地域可能已成功 1100136 售罄 换地域或结束 1101001 秒杀尚未开始 等整点 项目结构 tencent-cloud-seckill/ ├── snap-api.py # 主脚本 ├── save-auth.py # 登录凭证保存工具 ├── requirements.txt # Python 依赖 └── logs/ # 运行日志 项目下载 tencent-cloud-seckill.zip (58.5 KB) 配置升级 抢到之后可以在服务器后台免费升级到带宽:5Mbps,流量包:500GB/月,系统盘:60GB 4 个帖子 - 2 位参与者 阅读完整话题

LinuxDo 最新话题 · 2026-06-11 10:10:03+08:00 · tech

从 【sine】hermes多agent配置好了(含模型切换脚本) - 开发调优 / 开发调优, Lv1 - LINUX DO 来 之前一直理解的是bot to bot,说白了就是人跟总管交互,总管@各个相关agent开始任务,相关agent完成任务后@总管进行交付。 但是这种方式有极大地不稳定性,昨天看了站内一位佬的帖子,说hermes的kanban功能可以作为桥梁,遂开始实验。 现在agents角色基本没变,改成了以下逻辑: 所有agents(相关的)拉入飞书群组 用户只与总管agent交互(现在还是群组@总管,给她分配任务) 总管会根据任务进行kanban任务拆解,拆解完毕后的任务会进入hermes的kanban 相关agent会执行kanban里的任务,执行完毕后会群组里进行通知 另外,用户还可以群组里@各个agents,他们会单独群组内进行回复消息,互不影响 总管的system prompt: 改造后体感: 暂时达到了多角色团队的效果 token消耗量上升,但是可接受 后续优化方向: 开发agent计划接入codex cli,我已经使用kanban-codex-lane跑通 希望可以达到多角色讨论的效果,但是暂时没有方案 其他优化方向,待定 — 需要几个大项目考验之后总结优化方向 2 个帖子 - 2 位参与者 阅读完整话题

LinuxDo 最新话题 · 2026-06-11 03:13:36+08:00 · tech

这些应用很少做覆盖更新的,都是全新APP 不过更新之后连用户数据都丢失了还是第一次见,大部分都是绑定设备ID的 别问是什么网站,去代码里找 破解版没有破解 只能靠咱们手搓 界面参考: 复制以下代码,直接到powershell运行就可以安装到桌面了 如果电脑不匹配,用不了的,可以让AI直接帮你把Python代码写出来 $path = "$HOME\Desktop\invite_tool.py"; $code = @' import os import sys import subprocess def bootstrap_dependencies(): required_libs = {"requests": "requests", "Crypto": "pycryptodome"} missing_libs = [] for module_name, pip_name in required_libs.items(): try: __import__(module_name) except ImportError: missing_libs.append(pip_name) if missing_libs: if "pycryptodome" in missing_libs and sys.platform.startswith("win"): subprocess.run([sys.executable, "-m", "pip", "uninstall", "-y", "crypto"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) subprocess.run([sys.executable, "-m", "pip", "uninstall", "-y", "pycryptodome"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) for lib in missing_libs: try: subprocess.run([sys.executable, "-m", "pip", "install", "--upgrade", "pip"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) subprocess.run([sys.executable, "-m", "pip", "install", lib], check=True) except Exception: sys.exit(1) bootstrap_dependencies() import base64 import hashlib import json import random import threading import time import tkinter as tk from tkinter import messagebox, ttk from concurrent.futures import ThreadPoolExecutor, as_completed from dataclasses import dataclass from typing import Any import requests import urllib3 from Crypto.Cipher import AES, PKCS1_v1_5 from Crypto.PublicKey import RSA from Crypto.Util.Padding import unpad urllib3.disable_warnings() requests.packages.urllib3.disable_warnings() PUBLIC_KEY_RAW = ( "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgsH82stbCUaE1fTsotU0E2HWU9uQz496NFKgjjHBn" "Bzqk9YtYcowNFxaOz6G5Q3bw5j/+0+iAD58/n99ENjFkipiulu30eRiUpHUVFyc+EJ14FLKIXNksQWTu" "AivCkIYcDNP42in1nyjdXrpps7klCMm9MeAz8Mm+k9r1MGVJsQIDAQAB" ) class AtomicCounter: def __init__(self) -> None: self._value = 0 self._lock = threading.Lock() def inc(self) -> int: with self._lock: self._value += 1 return self._value @property def value(self) -> int: with self._lock: return self._value @dataclass(slots=True) class ApiConfig: base_url: str = "https://34.81.42.86:2242" macct: str = "sf42" ver: str = "1.0" os: str = "2" user_agent: str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36" accept: str = "application/json,*/*" content_type: str = "application/json; charset=UTF-8" timeout: float = 8.0 aes_key: str = "GcgzsKdDZTumABNz7uujrCfPIk9TQ355" @dataclass(slots=True) class ApiResult: code: int msg: str data: Any class ApiClient: def __init__(self, config: ApiConfig, public_key: str) -> None: self.config = config self.session = requests.Session() self.session.verify = False self._aes_key = config.aes_key.encode("utf-8") self._public_key = RSA.import_key(self._load_public_key(public_key)) self.session.headers.update({ "user-agent": config.user_agent, "accept": config.accept, "content-type": config.content_type, "ver": config.ver, "os": config.os, "macct": config.macct, }) def close(self) -> None: self.session.close() def set_token(self, token: str | None) -> None: if token is None: self.session.headers.pop("token", None) else: self.session.headers.update({"token": token}) def post_plain(self, path: str, payload: dict[str, Any], params: dict[str, Any] | None = None) -> ApiResult: return self._post(path, payload, params=params) def post_rsa(self, path: str, payload: dict[str, Any]) -> ApiResult: return self._post(path, {"encrypt": self.rsa_encrypt_payload(payload)}) def rsa_encrypt_payload(self, payload: dict[str, Any]) -> str: plain = json.dumps(payload, ensure_ascii=False, separators=(",", ":")).encode("utf-8") cipher = PKCS1_v1_5.new(self._public_key) chunk_size = self._public_key.size_in_bytes() - 11 encrypted = bytearray() for i in range(0, len(plain), chunk_size): encrypted.extend(cipher.encrypt(plain[i : i + chunk_size])) return base64.b64encode(bytes(encrypted)).decode("ascii") def decrypt_response_text(self, raw_text: str) -> dict[str, Any]: text = raw_text.strip() if text.startswith('"') and text.endswith('"'): text = json.loads(text) cipher = AES.new(self._aes_key, AES.MODE_ECB) plain = unpad(cipher.decrypt(base64.b64decode(text)), AES.block_size).decode("utf-8") return json.loads(plain) def _post(self, path: str, payload: dict[str, Any], params: dict[str, Any] | None = None) -> ApiResult: response = self.session.post( f"{self.config.base_url.rstrip('/')}/{path.lstrip('/')}", params=params, json=payload, timeout=self.config.timeout, ) response.raise_for_status() result = self.decrypt_response_text(response.text) return ApiResult(code=result["code"], msg=result["msg"], data=result["data"]) @staticmethod def _load_public_key(raw: str) -> str: if "BEGIN PUBLIC KEY" in raw or "BEGIN RSA PUBLIC KEY" in raw: return raw b64 = "".join(raw.split()) lines = [b64[i : i + 64] for i in range(0, len(b64), 64)] return "-----BEGIN PUBLIC KEY-----\n" + "\n".join(lines) + "\n-----END PUBLIC KEY-----\n" class ApiService: def __init__(self, client: ApiClient) -> None: self.client = client def login(self, mac: str) -> ApiResult: payload = { "mac": mac, "tips": hashlib.md5(f"{self.client.config.macct}{mac}1".encode("utf-8")).hexdigest(), "os": "1", } return self.client.post_rsa("/front/cluser/c/user/mac/login", payload) def bind_refer(self, code: str) -> ApiResult: return self.client.post_plain("/front/cluser/c/user/bind/refer", {}, params={"code": code}) def make_uid() -> str: raw = f"{time.time()}{random.random()}{threading.get_ident()}" uid = hex(hash(raw))[2:] return uid if len(uid) == 16 else f"1{uid[:15]}" def do_invite(refer_code: str, counter: AtomicCounter, total: int, log_callback) -> tuple[bool, str]: client = None try: client = ApiClient(ApiConfig(), PUBLIC_KEY_RAW) api = ApiService(client) uid = make_uid() data = api.login(uid).data client.set_token(data["token"]) result = api.bind_refer(refer_code) success = result.code == 0 msg = result.msg except Exception as ex: success = False msg = str(ex) finally: if client is not None: client.close() n = counter.inc() log_callback(n, total, success, msg) return success, msg class App: def __init__(self, root: tk.Tk) -> None: self.root = root self.root.title("琉璃暗匣 - 极速推广控制台") self.root.geometry("540x440") self.root.resizable(False, False) self.root.configure(bg="#F5F7FA") self.style = ttk.Style() self.style.theme_use("clam") # 现代化视觉样式配置 self.style.configure("TFrame", background="#F5F7FA") self.style.configure("Card.TFrame", background="#FFFFFF", relief="flat") self.style.configure("TLabel", background="#FFFFFF", font=("Microsoft YaHei", 10), foreground="#2C3E50") self.style.configure("Title.TLabel", background="#F5F7FA", font=("Microsoft YaHei", 12, "bold"), foreground="#34495E") self.style.configure("Warning.TLabel", background="#F5F7FA", font=("Microsoft YaHei", 9), foreground="#E74C3C") self.style.configure("TButton", font=("Microsoft YaHei", 10, "bold"), padding=10, background="#E0E6ED", foreground="#2C3E50", borderwidth=0) self.style.map("TButton", background=[("active", "#D4DBE4")]) self.style.configure("VIP.TButton", background="#FF4757", foreground="white") self.style.map("VIP.TButton", background=[("active", "#FF6B81")]) self.style.configure("Gold.TButton", background="#2ED573", foreground="white") self.style.map("Gold.TButton", background=[("active", "#7BED9F")]) self.running = False self.create_widgets() def create_widgets(self) -> None: # 顶部标题与提示 header_frame = ttk.Frame(self.root) header_frame.pack(fill="x", padx=20, pady=(15, 5)) ttk.Label(header_frame, text="✨ 极速推广控制台", style="Title.TLabel").pack(anchor="w") ttk.Label(header_frame, text="💡 温馨提示:由于网络非对称延迟,当前进度与实际可能存在微小偏差\n具体奖励到账情况,请以 APP 或网页端实际显示为准~", style="Warning.TLabel").pack(anchor="w", pady=(5, 0)) # 核心卡片区 (白色背景,增加呼吸感) card_frame = ttk.Frame(self.root, style="Card.TFrame") card_frame.pack(fill="x", padx=20, pady=10, ipadx=15, ipady=15) # 邀请码输入 ttk.Label(card_frame, text="专属邀请码:").grid(row=0, column=0, sticky="w", pady=(0, 15)) self.code_var = tk.StringVar(value="") self.entry_code = ttk.Entry(card_frame, textvariable=self.code_var, font=("Consolas", 12, "bold"), width=20, justify="center") self.entry_code.grid(row=0, column=1, sticky="w", pady=(0, 15), padx=10) # 线程设置 ttk.Label(card_frame, text="并发线程数:").grid(row=1, column=0, sticky="w") self.workers_var = tk.StringVar(value="10") self.workers_spin = ttk.Spinbox(card_frame, from_=1, to=50, width=5, textvariable=self.workers_var, font=("Consolas", 11)) self.workers_spin.grid(row=1, column=1, sticky="w", padx=10) # 按钮区 btn_frame = ttk.Frame(self.root) btn_frame.pack(fill="x", padx=20, pady=5) self.btn_vip = ttk.Button(btn_frame, text="💎 刷 180天会员 (100人)", style="VIP.TButton", command=lambda: self.start_task(100)) self.btn_vip.pack(side="left", expand=True, fill="x", padx=(0, 5)) self.btn_gold = ttk.Button(btn_frame, text="💰 刷 1000金币 (200人)", style="Gold.TButton", command=lambda: self.start_task(200)) self.btn_gold.pack(side="right", expand=True, fill="x", padx=(5, 0)) # 进度与日志区 log_frame = ttk.Frame(self.root) log_frame.pack(fill="both", expand=True, padx=20, pady=10) self.progress_bar = ttk.Progressbar(log_frame, orient="horizontal", mode="determinate") self.progress_bar.pack(fill="x", pady=(0, 5)) self.lbl_status = ttk.Label(log_frame, text="就绪。请输入邀请码后点击按钮开始", background="#F5F7FA", font=("Microsoft YaHei", 9), foreground="#7F8C8D") self.lbl_status.pack(pady=(0, 5)) self.txt_log = tk.Text(log_frame, font=("Consolas", 9), wrap="word", height=8, bg="#2C3E50", fg="#ECF0F1", insertbackground="white", relief="flat", padx=10, pady=10) self.txt_log.pack(side="left", fill="both", expand=True) scrollbar = ttk.Scrollbar(log_frame, command=self.txt_log.yview) scrollbar.pack(side="right", fill="y") self.txt_log.config(yscrollcommand=scrollbar.set) def write_log(self, text: str) -> None: self.txt_log.insert(tk.END, text + "\n") self.txt_log.see(tk.END) def update_progress(self, current: int, total: int, success: bool, msg: str) -> None: self.root.after(0, self._update_ui, current, total, success, msg) def _update_ui(self, current: int, total: int, success: bool, msg: str) -> None: pct = (current / total) * 100 self.progress_bar["value"] = pct status_text = "OK" if success else "FAIL" self.lbl_status.config(text=f"执行中: {current}/{total} | 进度: {pct:.1f}%") self.write_log(f"[{current:>3}/{total}] {status_text:4s} | {msg}") def start_task(self, count: int) -> None: if self.running: return refer_code = self.code_var.get().strip() if not refer_code: messagebox.showwarning("提示", "请先输入您要推广的专属邀请码!") self.entry_code.focus() return try: workers = int(self.workers_var.get()) except ValueError: workers = 10 self.running = True self.btn_vip.state(["disabled"]) self.btn_gold.state(["disabled"]) self.entry_code.state(["disabled"]) self.workers_spin.state(["disabled"]) self.txt_log.delete("1.0", tk.END) self.progress_bar["value"] = 0 self.lbl_status.config(text="正在初始化线程池...") self.write_log(f">>> 开始执行任务:邀请 {count} 人,目标码: {refer_code}") threading.Thread(target=self._run_backend, args=(refer_code, count, workers), daemon=True).start() def _run_backend(self, refer_code: str, count: int, workers: int) -> None: counter = AtomicCounter() start_time = time.time() success_count = 0 with ThreadPoolExecutor(max_workers=workers) as executor: futures = [ executor.submit(do_invite, refer_code, counter, count, self.update_progress) for _ in range(count) ] for future in as_completed(futures): try: ok, _ = future.result() if ok: success_count += 1 except Exception: pass elapsed = time.time() - start_time self.running = False self.root.after(0, self._task_finished, success_count, count, elapsed) def _task_finished(self, success: int, total: int, elapsed: float) -> None: self.btn_vip.state(["!disabled"]) self.btn_gold.state(["!disabled"]) self.entry_code.state(["!disabled"]) self.workers_spin.state(["!disabled"]) self.lbl_status.config(text="执行完成!") self.write_log("\n" + "=" * 45) self.write_log(f" 任务已结束!") self.write_log(f" 成功: {success} | 失败: {total - success} | 耗时: {elapsed:.1f}s") self.write_log("=" * 45 + "\n") messagebox.showinfo("完成", f"刷量任务已完成!\n成功:{success}/{total}\n耗时:{elapsed:.1f}s\n(若出现 FAIL 可能是假失败,请去 APP 刷新查看实际奖励~)") if __name__ == "__main__": root = tk.Tk() app = App(root) root.mainloop() '@; Set-Content -Path $path -Value $code -Encoding utf8 之前刷200人至少要一两分钟,现在最快只需要5秒,成功率仍然不高,并发调小一点可能会好一些 等大家玩儿上了,估计就慢下来了 6 个帖子 - 4 位参与者 阅读完整话题

V2EX - 技术 · 2026-06-10 21:49:51+08:00 · tech

我想知道自己的 NAS 硬盘什么时候休眠什么时候活动,想知道一天被唤醒多少次。所以写了这个脚本。 DiskMonitorV1.0_20260610 这个脚本是按自己的需求写的,主要实现以下功能 1 )实时查询硬盘休眠状态并记录 2 )后台定时查询并记录硬盘状态 3 )统计 24h 后硬盘唤醒次数及总唤醒时间 4 ) 24h 硬盘活动图表 5 )最大化精简脚本,不额外安装依赖。只用了 hdpram 查询硬盘和 python3 运行 http 服务 一般情况下,适用于所有的 linux ,只要你安装了 hdparm 和 python3 。 实际运行截图如下: 项目文件 /var/www/hddstatus/ ├── config # 统一配置文件 ├── disk_events.log # 事件日志(运行时生成) ├── cache/ # 状态缓存目录 └── cgi-bin/ ├── status # 硬盘状态页 ├── log # 24h 趋势图表 + 日志 ├── log-full # 全部日志纯文本 └── update-disk-info # 更新硬盘名称 /usr/local/bin/ ├── disk_monitor.sh # 后台监控 ├── disk_monitor_startup.sh # 启动时初始化 └── disk_info.sh # 硬盘名称缓存生成 /etc/systemd/system/ ├── disk-monitor.service └── hddstatus.service /etc/sudoers.d/ └── hddstatus 使用教程: 使用 root 登录,或者 sudo chmod +x diskmonitor_install.sh chmod +x diskmonitor_uninstall.sh 安装 ./diskmonitor_install.sh 卸载 ./diskmonitor_uninstall.sh 状态页: http://机器 IP:58008/cgi-bin/status 日志页: http://机器 IP:58008/cgi-bin/log 修改配置: nano /var/www/hddstatus/config 然后 systemctl restart disk-monitor hddstatus config 配置文件说明 1 )硬盘要监控几个,填在 DISKS 里 2 )后台监控时隔,默认 5 分钟,没必要太频繁。因为时隔为 5 分钟监控一次,所以记录的唤醒休眠时间可能会有几分钟偏差。 3 ) Web 服务端口,字面意思 4 )硬盘自定义显示名称,前面 DISKS 里有几块硬盘这里就加几条记录 5 ) hdparm 程序目录,自己按自己机器上的填,一般不用动。 6 )其余日志文件参数不要动。 # ========== 硬盘监控统一配置 ========== # 要监控的硬盘设备(空格分隔) DISKS="/dev/sda /dev/sdb" # 后台监控检查间隔(秒),建议 ≥ 硬盘 spindown 时间 MONITOR_INTERVAL=300 # Web 服务端口 WEB_PORT=58008 # 硬盘自定义显示名称(可选) # 格式:LABEL_设备名="显示名称" LABEL_sda="WD-500G" LABEL_sdb="GS-480G" # hdparm 路径 HDPARM="/usr/sbin/hdparm" 如果硬盘很老,频繁 hdparm 查询硬盘状态会影响硬盘休眠(很少见),那就只能加大监控的间隔或不用这个脚本。 不对这个脚本对你们硬盘/机器带来的任何影响负责。需要自取。 脚本 链接: https://pan.quark.cn/s/9dd16addf27f

V2EX - 技术 · 2026-06-10 21:49:51+08:00 · tech

我想知道自己的 NAS 硬盘什么时候休眠什么时候活动,想知道一天被唤醒多少次。所以写了这个脚本。 DiskMonitorV1.0_20260610 这个脚本是按自己的需求写的,主要实现以下功能 1 )实时查询硬盘休眠状态并记录 2 )后台定时查询并记录硬盘状态 3 )统计 24h 后硬盘唤醒次数及总唤醒时间 4 ) 24h 硬盘活动图表 5 )最大化精简脚本,不额外安装依赖。只用了 hdpram 查询硬盘和 python3 运行 http 服务 一般情况下,适用于所有的 linux ,只要你安装了 hdparm 和 python3 。 实际运行截图如下: 项目文件 /var/www/hddstatus/ ├── config # 统一配置文件 ├── disk_events.log # 事件日志(运行时生成) ├── cache/ # 状态缓存目录 └── cgi-bin/ ├── status # 硬盘状态页 ├── log # 24h 趋势图表 + 日志 ├── log-full # 全部日志纯文本 └── update-disk-info # 更新硬盘名称 /usr/local/bin/ ├── disk_monitor.sh # 后台监控 ├── disk_monitor_startup.sh # 启动时初始化 └── disk_info.sh # 硬盘名称缓存生成 /etc/systemd/system/ ├── disk-monitor.service └── hddstatus.service /etc/sudoers.d/ └── hddstatus 使用教程: 使用 root 登录,或者 sudo chmod +x diskmonitor_install.sh chmod +x diskmonitor_uninstall.sh 安装 ./diskmonitor_install.sh 卸载 ./diskmonitor_uninstall.sh 状态页: http://机器 IP:58008/cgi-bin/status 日志页: http://机器 IP:58008/cgi-bin/log 修改配置: nano /var/www/hddstatus/config 然后 systemctl restart disk-monitor hddstatus config 配置文件说明 1 )硬盘要监控几个,填在 DISKS 里 2 )后台监控时隔,默认 5 分钟,没必要太频繁。因为时隔为 5 分钟监控一次,所以记录的唤醒休眠时间可能会有几分钟偏差。 3 ) Web 服务端口,字面意思 4 )硬盘自定义显示名称,前面 DISKS 里有几块硬盘这里就加几条记录 5 ) hdparm 程序目录,自己按自己机器上的填,一般不用动。 6 )其余日志文件参数不要动。 # ========== 硬盘监控统一配置 ========== # 要监控的硬盘设备(空格分隔) DISKS="/dev/sda /dev/sdb" # 后台监控检查间隔(秒),建议 ≥ 硬盘 spindown 时间 MONITOR_INTERVAL=300 # Web 服务端口 WEB_PORT=58008 # 硬盘自定义显示名称(可选) # 格式:LABEL_设备名="显示名称" LABEL_sda="WD-500G" LABEL_sdb="GS-480G" # hdparm 路径 HDPARM="/usr/sbin/hdparm" 如果硬盘很老,频繁 hdparm 查询硬盘状态会影响硬盘休眠(很少见),那就只能加大监控的间隔或不用这个脚本。 不对这个脚本对你们硬盘/机器带来的任何影响负责。需要自取。 脚本 链接: https://pan.quark.cn/s/9dd16addf27f

LinuxDo 最新话题 · 2026-06-10 19:53:53+08:00 · tech

用了any的fable,然后用了自己的一个股市分析skill,里面有一个爬虫脚本来获取新闻流和市场数据的,让fable来生成收盘汇报总结,直接给 Error: Permission to use WebFetch has been denied. IMPORTANT: You *may* attempt to accomplish this action using other tools that might naturally be used to accomplish this goal, e.g. using head instead of cat. But you *should not* attempt to work around this denial in malicious ways, e.g. do not use your ability to run tests to execute non-test actions. You should only try to work around this restriction in reasonable ways that do not attempt to bypass the intent behind this denial. If you believe this capability is essential to complete the user's request, STOP and explain to the user what you were trying to do and why you need this permission. Let the user decide how to proceed 这也太道德了吧,我没让它写,就运行也能给触发这种机制,连对方服务器都没说啥 而且,还有一个很有意思的地方,我有一些逆向用的skill,我发个指令,看下skill库有什么技能,直接给黄字警告了 1 个帖子 - 1 位参与者 阅读完整话题

V2EX - 技术 · 2026-06-10 18:35:17+08:00 · tech

我想知道自己的 NAS 硬盘什么时候休眠什么时候活动,想知道一天被唤醒多少次。所以写了这个脚本。 DiskMonitorV1.0_20260610 这个脚本是按自己的需求写的,主要实现以下功能 1 )实时查询硬盘休眠状态并记录 2 )后台定时查询并记录硬盘状态 3 )统计 24h 后硬盘唤醒次数及总唤醒时间 4 ) 24h 硬盘活动图表 5 )最大化精简脚本,不额外安装依赖。只用了 hdpram 查询硬盘和 python3 运行 http 服务 一般情况下,适用于所有的 linux ,只要你安装了 hdparm 和 python3 。 实际运行截图如下: 项目文件 /var/www/hddstatus/ ├── config # 统一配置文件 ├── disk_events.log # 事件日志(运行时生成) ├── cache/ # 状态缓存目录 └── cgi-bin/ ├── status # 硬盘状态页 ├── log # 24h 趋势图表 + 日志 ├── log-full # 全部日志纯文本 └── update-disk-info # 更新硬盘名称 /usr/local/bin/ ├── disk_monitor.sh # 后台监控 ├── disk_monitor_startup.sh # 启动时初始化 └── disk_info.sh # 硬盘名称缓存生成 /etc/systemd/system/ ├── disk-monitor.service └── hddstatus.service /etc/sudoers.d/ └── hddstatus 使用教程: 使用 root 登录,或者 sudo chmod +x diskmonitor_install.sh chmod +x diskmonitor_uninstall.sh 安装 ./diskmonitor_install.sh 卸载 ./diskmonitor_uninstall.sh 状态页: http://机器 IP:58008/cgi-bin/status 日志页: http://机器 IP:58008/cgi-bin/log 修改配置: nano /var/www/hddstatus/config 然后 systemctl restart disk-monitor hddstatus config 配置文件说明 1 )硬盘要监控几个,填在 DISKS 里 2 )后台监控时隔,默认 5 分钟,没必要太频繁。因为时隔为 5 分钟监控一次,所以记录的唤醒休眠时间可能会有几分钟偏差。 3 ) Web 服务端口,字面意思 4 )硬盘自定义显示名称,前面 DISKS 里有几块硬盘这里就加几条记录 5 ) hdparm 程序目录,自己按自己机器上的填,一般不用动。 6 )其余日志文件参数不要动。 # ========== 硬盘监控统一配置 ========== # 要监控的硬盘设备(空格分隔) DISKS="/dev/sda /dev/sdb" # 后台监控检查间隔(秒),建议 ≥ 硬盘 spindown 时间 MONITOR_INTERVAL=300 # Web 服务端口 WEB_PORT=58008 # 硬盘自定义显示名称(可选) # 格式:LABEL_设备名="显示名称" LABEL_sda="WD-500G" LABEL_sdb="GS-480G" # hdparm 路径 HDPARM="/usr/sbin/hdparm" 如果硬盘很老,频繁 hdparm 查询硬盘状态会影响硬盘休眠(很少见),那就只能加大监控的间隔或不用这个脚本。 不对这个脚本对你们硬盘/机器带来的任何影响负责。需要自取。 脚本 链接: https://pan.quark.cn/s/9dd16addf27f

V2EX - 技术 · 2026-06-10 16:35:17+08:00 · tech

我想知道自己的 NAS 硬盘什么时候休眠什么时候活动,想知道一天被唤醒多少次。所以写了这个脚本。 DiskMonitorV1.0_20260610 这个脚本是按自己的需求写的,主要实现以下功能 1 )实时查询硬盘休眠状态并记录 2 )后台定时查询并记录硬盘状态 3 )统计 24h 后硬盘唤醒次数及总唤醒时间 4 ) 24h 硬盘活动图表 5 )最大化精简脚本,不额外安装依赖。只用了 hdpram 查询硬盘和 python3 运行 http 服务 一般情况下,适用于所有的 linux ,只要你安装了 hdparm 和 python3 。 实际运行截图如下: 项目文件 /var/www/hddstatus/ ├── config # 统一配置文件 ├── disk_events.log # 事件日志(运行时生成) ├── cache/ # 状态缓存目录 └── cgi-bin/ ├── status # 硬盘状态页 ├── log # 24h 趋势图表 + 日志 ├── log-full # 全部日志纯文本 └── update-disk-info # 更新硬盘名称 /usr/local/bin/ ├── disk_monitor.sh # 后台监控 ├── disk_monitor_startup.sh # 启动时初始化 └── disk_info.sh # 硬盘名称缓存生成 /etc/systemd/system/ ├── disk-monitor.service └── hddstatus.service /etc/sudoers.d/ └── hddstatus 使用教程: 使用 root 登录,或者 sudo chmod +x diskmonitor_install.sh chmod +x diskmonitor_uninstall.sh 安装 ./diskmonitor_install.sh 卸载 ./diskmonitor_uninstall.sh 状态页: http://机器 IP:58008/cgi-bin/status 日志页: http://机器 IP:58008/cgi-bin/log 修改配置: nano /var/www/hddstatus/config 然后 systemctl restart disk-monitor hddstatus config 配置文件说明 1 )硬盘要监控几个,填在 DISKS 里 2 )后台监控时隔,默认 5 分钟,没必要太频繁。因为时隔为 5 分钟监控一次,所以记录的唤醒休眠时间可能会有几分钟偏差。 3 ) Web 服务端口,字面意思 4 )硬盘自定义显示名称,前面 DISKS 里有几块硬盘这里就加几条记录 5 ) hdparm 程序目录,自己按自己机器上的填,一般不用动。 6 )其余日志文件参数不要动。 # ========== 硬盘监控统一配置 ========== # 要监控的硬盘设备(空格分隔) DISKS="/dev/sda /dev/sdb" # 后台监控检查间隔(秒),建议 ≥ 硬盘 spindown 时间 MONITOR_INTERVAL=300 # Web 服务端口 WEB_PORT=58008 # 硬盘自定义显示名称(可选) # 格式:LABEL_设备名="显示名称" LABEL_sda="WD-500G" LABEL_sdb="GS-480G" # hdparm 路径 HDPARM="/usr/sbin/hdparm" 如果硬盘很老,频繁 hdparm 查询硬盘状态会影响硬盘休眠(很少见),那就只能加大监控的间隔或不用这个脚本。 不对这个脚本对你们硬盘/机器带来的任何影响负责。需要自取。 脚本 链接: https://pan.quark.cn/s/9dd16addf27f