شعار Python Packaging Binary Audit

Python Packaging Binary Audit

مؤسسة
opendatahub-io
python-packaging-binary-audit

Scan a Python package repository for compiled/binary files using Fromager-style detection and malcontent YARA analysis, then triage findings with deterministic rules and AI reasoning to produce a structured risk report section.

نظرة عامة

الناشرopendatahub-io
المستودعai-helpers
اسم المهارةpython-packaging-binary-audit
النجوم
39
التفريعات
76
الملفات المرفقة
2
الترخيصApache-2.0
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 2

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها opendatahub-io على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Python Packaging Binary Audit في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى الإضافات → المهارات.
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/opendatahub-io/ai-helpers/tree/main/plugins/odh-python-packaging/skills/python-packaging-binary-audit
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات → المهارات → إضافة مهارة → من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/opendatahub-io/ai-helpers.git /tmp/ai-helpers
mkdir -p .claude/skills
cp -r /tmp/ai-helpers/plugins/odh-python-packaging/skills/python-packaging-binary-audit .claude/skills/python-packaging-binary-audit
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Python Packaging Binary Audit في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج Python Packaging Binary Audit تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Python Packaging Binary Audit بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تترتب أي تكلفة على المهارة غير المستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Python Packaging Binary Audit

Scans a Python package repository for compiled or binary files using Fromager-style extension and magic-header detection, then runs malcontent YARA-based analysis on any detected binaries. Produces a self-contained "Binary Scan" report section with triaged findings and a risk assessment.

Inputs

  • repo_path (required): Local filesystem path to an already-cloned repository
  • output_file (optional): Write the report section to this file path instead of returning it inline. The first line of the file must be RISK_RATING:<value> so the orchestrator can parse it without reading the full report.
  • binary_scan (optional): File path to pre-computed binary scanner JSON output (binary-scan.json). Schema: {total, findings[{path, match_type, suffix, size, magic?}]}. When provided, skip running scan_binaries.py.
  • malcontent_results (optional): File path to pre-computed malcontent JSON output (malcontent-results.json). Schema: {status, Files?}. Status values: "success", "unavailable", "timeout", "failed", "invalid", "skipped". When provided, skip running run_malcontent.py.

Step 1: Obtain Binary Scan Results

Option A - Pre-computed results (CI mode)

If binary_scan is provided and the file exists, read and parse it as JSON. Use the total and findings fields directly. Skip running scan_binaries.py and skip creating the staging directory (STAGING_DIR) since binaries are already analyzed. Each finding has: path (relative to repo root), match_type ("extension" or "magic_header"), suffix, size, and optionally magic (ELF, MachO, ar_archive, etc.).

If total is 0, skip to the Output section and note "No binary files detected" in the report.

Option B - Run binary scanner locally (standalone mode)

If binary_scan is not provided, run the binary scanner to find compiled files using Fromager-style extension and magic-header detection:

bash
STAGING_DIR=$(mktemp -d -t malcontent-staging-XXXXXX)
./scripts/scan_binaries.py --stage-to "$STAGING_DIR" "<repo-path>"

This outputs JSON to stdout with total and findings fields. Each finding has: path, match_type (extension or magic_header), suffix, size, and optionally magic (ELF, MachO, ar_archive, etc.).

The --stage-to flag copies detected binaries into a staging directory preserving relative paths for malcontent analysis in the next step.

If the scanner finds zero binaries, skip to the Output section and note "No binary files detected" in the report.

Step 2: Obtain Malcontent Results

Option A - Pre-computed results (CI mode)

If malcontent_results is provided and the file exists, read and parse it as JSON:

  • If status is "success": use the Files dict as malcontent output (keyed by file path, native malcontent --format json structure). Proceed to Step 3 (Triage).
  • If status is "unavailable", "timeout", "failed", or "invalid": treat malcontent as unavailable. Do not re-run malcontent. The CI runner already attempted execution under controlled conditions, and re-running in the agent container would likely hit the same failure. Proceed to triage using only the binary scan metadata (extension, magic header, size). Note the degraded status and any error message from the JSON in the report.
  • If status is "skipped": no binaries were detected upstream. If binary_scan.total == 0, this is consistent; skip to Output. If binary_scan.total > 0, this is a data inconsistency from the CI pipeline. treat malcontent as unavailable and triage using binary scan metadata only; note the inconsistency in the report.
  • For any other status value not listed above: treat malcontent as unavailable and triage using binary scan metadata only, noting the unrecognized status.

Mixed mode - binary_scan only

If malcontent_results is NOT provided but binary_scan WAS provided, treat malcontent as unavailable and triage using binary scan metadata only.

Option B - Run malcontent locally (standalone mode)

If neither binary_scan nor malcontent_results is provided, run malcontent analysis on the staged binaries:

bash
./scripts/run_malcontent.py "$STAGING_DIR"
malcontent_exit=$?

Check the exit code before proceeding:

  • Exit 0: malcontent ran successfully. Capture the JSON output with findings.
  • Exit 2: malcontent (mal) is not installed. Do not fail. Proceed to triage using only the binary scan metadata (extension, magic header, size). Note "malcontent unavailable" in the report output.
  • Exit 1: malcontent encountered a runtime error (timeout, invalid JSON, or execution failure). Do not fail. Proceed to triage using only the binary scan metadata. Note the error in the report output.

When malcontent is unavailable or fails, the binary scan findings alone still provide value — file paths, types, and sizes are sufficient for the deterministic triage rules that do not depend on malcontent risk levels.

Step 3: Triage

Review binary findings in context. Read relevant source files to understand the purpose of detected binaries. Triage proceeds in two stages: deterministic rules first, then AI reasoning for anything unresolved.

Stage 1 — Deterministic Rules

Apply the following rules before any AI reasoning. These handle the most common clear-cut cases and make the triage reproducible.

ConditionVerdict
Binary is under third_party/, vendor/, or extern/ and malcontent risk ≤ mediumPASS — vendored dependency
Binary is under test/, tests/, benchmarks/, or examples/ and malcontent risk ≤ mediumPASS — test data
Binary suffix is .ptx, .cubin, .fatbin, or path contains triton/ or cudaPASS — GPU kernel
Malcontent risk is criticalBLOCK
Malcontent flags remote_access, exfiltration, or backdoor capabilitiesBLOCK
Binary has no malcontent findings and is only detected by extension/magic headerPASS — opaque-only
Malcontent timed outREVIEW — partial results, manual inspection recommended

When multiple findings produce different verdicts, the overall precedence is BLOCK > REVIEW > PASS — the most severe verdict wins.

Any finding not resolved by Stage 1 proceeds to Stage 2.

Stage 2 — AI Reasoning

For findings that remain unresolved after deterministic rules, classify each as:

  • Likely legitimate — binary is a known build artifact (e.g., pre-compiled protobuf, CUDA kernel)
  • Suspicious — binary has unusual capabilities for the package context (e.g., network access in a math library)
  • Critical — binary has capabilities strongly indicating malicious intent (e.g., backdoor, data exfiltration)

Step 4: Cleanup

Remove the staging directory if it was created (Step 1 Option B). When both binary_scan and malcontent_results were pre-computed, no STAGING_DIR exists and this step is a no-op.

bash
if [ -n "${STAGING_DIR}" ] && [ -d "${STAGING_DIR}" ]; then
  rm -rf -- "${STAGING_DIR}"
fi

Output Format

Produce the following markdown section:

markdown
## Binary Scan

**Binaries detected:** {N}
**Malcontent status:** {ran successfully | unavailable — findings based on binary scan only | timed out — partial results}

### BLOCK Findings

| File | Type | Size | Malcontent Risk | Capabilities | Triage |
|------|------|------|-----------------|--------------|--------|
| src/lib/backdoor.so | ELF | 24KB | critical | remote_access, exfiltration | BLOCK — critical risk with network capabilities |

### REVIEW Findings

(same table format)

### PASS Findings

(same table format, brief — included for completeness but de-emphasized)

The risk_rating for this phase is one of:

  • no_issues — No binary files detected
  • low_risk — All findings classified as "likely legitimate" or PASS
  • needs_review — One or more findings classified as "suspicious" or REVIEW
  • critical — One or more findings classified as "critical" or BLOCK

If output_file is provided, write the file with the first line as RISK_RATING:<value> followed by a blank line and then the markdown section above. If output_file is not provided, return the report section inline.

Error Handling

ScenarioBehavior
Binary scan finds zero binariesNote "No binary files detected", risk_rating = no_issues
Malcontent unavailable (exit code 2)Triage binary findings using scan metadata only (extension, magic header, size); note malcontent was unavailable
Malcontent times out (exit code 1)Report partial results; note timeout; REVIEW verdict for affected binaries
Malcontent produces invalid JSON (exit code 1)Triage binary findings using scan metadata only; note malcontent output error
Pre-computed binary_scan file path provided but file missing, unreadable, or invalid JSONReport binary scan unavailable, risk_rating = needs_review
Pre-computed malcontent_results file path provided but file missing, unreadable, or invalid JSONProceed with binary scan metadata only; note malcontent output error
Pre-computed malcontent_results has degraded status (unavailable/timeout/failed/invalid)Do not re-run malcontent; triage with binary scan metadata only; note the degraded status
Pre-computed malcontent_results has status "skipped" but binary_scan.total > 0Data inconsistency; treat malcontent as unavailable; triage with binary scan metadata; note inconsistency

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة أثناء تحميل المهارة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Python Packaging Binary Audit؟

Scan a Python package repository for compiled/binary files using Fromager-style detection and malcontent YARA analysis, then triage findings with deterministic rules and AI reasoning to produce a structured risk report section.

لماذا تستخدم Python Packaging Binary Audit على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Python Packaging Binary Audit عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Python Packaging Binary Audit في TypingMind؟

افتح الإضافات → المهارات → التثبيت من GitHub في TypingMind والصق https://github.com/opendatahub-io/ai-helpers/tree/main/plugins/odh-python-packaging/skills/python-packaging-binary-audit. يقرأ TypingMind ملف SKILL.md الخاص بها، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Python Packaging Binary Audit؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Python Packaging Binary Audit؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Python Packaging Binary Audit معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Python Packaging Binary Audit مجانية؟

نعم. نشرها opendatahub-io على GitHub بموجب ترخيص Apache-2.0. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇