Skip to content

majiayu000/spellbook / skills/claude-code-reverse

claude-code-reverse

Verified

对用户拥有或明确获授权的本机可执行文件、应用二进制和版本产物做只读静态逆向,包括 Claude Code 及其他 CLI、Mach-O、ELF、PE、Wasm 或打包应用。仅在用户明确要求“逆向、扒实现、查二进制字符串/符号/依赖、验证内部行为、比较两个版本”时使用;不要因普通提及软件而触发,也不要用于执行未知样本、绕过授权/计费、破解或再分发。

FileKindSize
SKILL.mdskill md5.7 KB
extract.shexecutablescript6.9 KB
references/claude-code.mdmarkdown2.0 KB
tests/test_extract.shexecutablescript3.2 KB

tests/test_extract.sh

View on GitHub
#!/usr/bin/env bash
set -euo pipefail

skill_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
readonly skill_dir
readonly script="$skill_dir/extract.sh"
test_root=$(mktemp -d)
test_root=$(cd "$test_root" && pwd -P)
readonly test_root
trap 'rm -rf "$test_root"' EXIT

export XDG_CACHE_HOME="$test_root/cache root"

fail() {
  printf 'FAIL: %s\n' "$*" >&2
  exit 1
}

assert_contains() {
  local output="$1"
  local expected="$2"
  [[ "$output" == *"$expected"* ]] || fail "expected output to contain: $expected"
}

assert_fails() {
  if "$@" >"$test_root/unexpected.stdout" 2>"$test_root/unexpected.stderr"; then
    fail "command unexpectedly succeeded: $*"
  fi
}

file_mode() {
  if stat -f '%Lp' "$1" >/dev/null 2>&1; then
    stat -f '%Lp' "$1"
  else
    stat -c '%a' "$1"
  fi
}

fixture_a="$test_root/fixture a.bin"
fixture_b="$test_root/fixture b.bin"
printf 'prefix\0shared anchor\0only version one\0' > "$fixture_a"
printf 'prefix\0shared anchor\0only version two\0' > "$fixture_b"

info_output=$(bash "$script" info --target "$fixture_a")
assert_contains "$info_output" "path: $fixture_a"
assert_contains "$info_output" "bytes:"
assert_contains "$info_output" "sha256:"

dump_output=$(bash "$script" dump --target "$fixture_a")
assert_contains "$dump_output" "target: $fixture_a"
cache_file=$(printf '%s\n' "$dump_output" | awk -F': ' '$1 == "cache" { print $2 }')
[[ -f "$cache_file" ]] || fail "cache file was not created"
[[ "$cache_file" == "$XDG_CACHE_HOME/claude-code-reverse/"* ]] || fail "cache escaped private cache root"
[[ "$(file_mode "$cache_file")" == "600" ]] || fail "cache file is not mode 600"

search_output=$(bash "$script" search --target "$fixture_a" "shared anchor")
assert_contains "$search_output" "shared anchor"

diff_output=$(bash "$script" diff --target-a "$fixture_a" --target-b "$fixture_b" "only version")
assert_contains "$diff_output" "only version one"
assert_contains "$diff_output" "only version two"

command_output=$(bash "$script" info --target sh)
assert_contains "$command_output" "sha256:"

help_output=$(bash "$script" --help)
assert_contains "$help_output" "--target-a"

fake_home="$test_root/fake home"
fake_versions="$fake_home/versions"
mkdir -p "$fake_home/.local/bin" "$fake_versions"
ln -s "$fixture_a" "$fake_home/.local/bin/claude"
cp "$fixture_a" "$fake_versions/1.2.3"
cp "$fixture_b" "$fake_versions/1.2.4"

legacy_dump=$(HOME="$fake_home" bash "$script")
assert_contains "$legacy_dump" "target: $fake_home/.local/bin/claude"
legacy_search=$(HOME="$fake_home" bash "$script" "shared anchor")
assert_contains "$legacy_search" "shared anchor"
legacy_diff=$(HOME="$fake_home" CLAUDE_CODE_VERSIONS_DIR="$fake_versions" bash "$script" diff 1.2.3 1.2.4 "only version")
assert_contains "$legacy_diff" "only version two"

assert_fails bash "$script" info --target "$test_root/missing.bin"
assert_fails bash "$script" search --target "$fixture_b" "shared anchor"
assert_fails bash "$script" diff --target-a "$fixture_a" --target-b "$fixture_b" ""
assert_fails bash "$script" diff --target-a "$fixture_a" wrong-flag "$fixture_b" "anchor"
assert_fails bash "$script" dump --target
assert_fails bash "$script" info --target ""

printf 'claude-code-reverse extract tests passed\n'
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall