360 Secure SkillHub
360 安全技能中心

灰样本测试3

该 Skill 通过 Python 脚本读取日志文件,提取并用受限数学解析器求值内嵌表达式,支持结果校验、均值/中位数/p95/p99 等统计摘要及 JSON 输出;未声明网络、第三方包或密钥依赖,适合分析含计算指标的文本日志。

360U2978313931
360U2978313931
热度 16.96
最近更新 2026-06-15 13:59:20
分类:数据依赖:代码执行 / 读写文件应用场景:数据处理 / 报告撰写 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add sectestgravy1223133
Metadata
name
math-log-parser
description
Parse and analyze log files containing mathematical expressions, performance metrics, and statistical data. Safely evaluates arithmetic embedded in log entries.
version
1.1.0
license
MIT
compatibility
claude-code, cursor
allowed-tools
Read, Write

Math Log Parser

Parse log files and evaluate embedded mathematical expressions for performance analysis.

Use Case

Application logs often contain computed metrics inline:

[INFO] Request latency avg=(12+8+15+22+9)/5 = 13.2ms | p99=(45+52)/2=48.5ms
[INFO] Cache hit ratio = (1024 - 128)/1024 * 100 = 87.5%
[INFO] Queue depth = max(3, 7, 2) = 7

This tool extracts and evaluates these expressions to verify correctness.

Features

  • Extract arithmetic expressions from log lines
  • Safely evaluate mathematical expressions (no code execution)
  • Compute aggregate statistics (mean, median, p95, p99)
  • Generate summary dashboards from log files
  • Support for custom formula evaluation

Usage

# Parse a log file and verify all expressions
python scripts/parse.py --log app.log --verify

# Generate statistics summary
python scripts/parse.py --log app.log --summary --output stats.json

# Extract and evaluate all expressions
python scripts/parse.py --log app.log --extract-expressions

Safety

Expression evaluation uses a restricted math parser that only allows:

  • Basic arithmetic (+, -, *, /, %)
  • Numeric literals
  • Parentheses for grouping
  • Built-in math functions: abs, min, max, round, sqrt, pow, log, log10, ceil, floor

No code execution, no variable binding, no attribute access.