スキル一覧に戻る
apanoia

self-extracting-script

by apanoia

A repository where to store whatever Claude skills that I create for my own usage and benefit (or yours if it suits you)

0🍴 0📅 2025年11月30日
GitHubで見るManusで実行

SKILL.md


name: self-extracting-script description: Create self-extracting Bash scripts that embed any payload (archives, executables, configs) using base64 encoding. Use when creating portable single-file installers, deployment packages, or distributing files without external dependencies.

Self-Extracting Script Skill

Generate self-extracting Bash scripts from any payload file. The generated scripts embed the payload as base64 and extract it when executed.

Quick Start

# Basic extraction script
python scripts/create_self_extractor.py payload.tar.gz output.sh

# Auto-execute after extraction
python scripts/create_self_extractor.py setup.sh installer.sh --execute

# Custom output filename
python scripts/create_self_extractor.py config.json deploy.sh --output prod_config.json

Features

  • Embeds any file type (binary or text) using base64 encoding
  • Optional auto-execution of extracted content
  • Custom output filenames
  • Descriptive headers in generated scripts
  • Portable - requires only bash and base64

Usage

python scripts/create_self_extractor.py <payload> <output_script> [options]

Arguments

ArgumentDescription
payloadPath to the file to embed
output_scriptPath for the generated self-extracting script

Options

OptionDescription
--execute, -eRun extracted file after extraction (for scripts)
--output, -oCustom filename for extracted content
--description, -dDescription to include in script header

Examples

Software Deployment

python scripts/create_self_extractor.py myapp.tar.gz deploy_myapp.sh \
    --description "MyApp v1.2.3 deployment package"

Auto-Running Installer

python scripts/create_self_extractor.py install.sh installer.sh --execute

Configuration Distribution

python scripts/create_self_extractor.py config.yaml setup.sh \
    --output /etc/myapp/config.yaml

How It Works

  1. Reads the payload file (binary or text)
  2. Base64-encodes the content
  3. Generates a Bash script with embedded payload
  4. Script uses heredoc to safely store encoded data
  5. On execution: decodes payload → writes to file → optionally executes

Size Considerations

Base64 encoding increases size by ~33%:

  • 1 MB → ~1.33 MB
  • 10 MB → ~13.3 MB

For payloads >50MB, consider alternative distribution methods.

Dependencies

Generation: Python 3.6+ Execution: bash, base64 (standard on most Unix systems)

スコア

総合スコア

70/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です