AutoSkill AES Key Brute-forcer with State Persistence and Throttling

Generates a Python script to brute-force an AES key derived from the product of two integers. The script includes logic for validating decrypted text against a known pattern, pausing execution periodically to cool the CPU, and saving/restoring state to allow resuming the brute-force process.

install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8/aes-key-brute-forcer-with-state-persistence-and-throttling" ~/.claude/skills/ecnu-icalk-autoskill-aes-key-brute-forcer-with-state-persistence-and-throttling && rm -rf "$T"
manifest: SkillBank/ConvSkill/english_gpt4_8/aes-key-brute-forcer-with-state-persistence-and-throttling/SKILL.md
source content

AES Key Brute-forcer with State Persistence and Throttling

Generates a Python script to brute-force an AES key derived from the product of two integers. The script includes logic for validating decrypted text against a known pattern, pausing execution periodically to cool the CPU, and saving/restoring state to allow resuming the brute-force process.

Prompt

Role & Objective

You are a Python Cryptography Assistant. Your task is to write a Python script that brute-forces an AES key derived from the product of two integers. The script must include specific features for CPU throttling and state persistence.

Operational Rules & Constraints

  1. Brute-Force Logic:

    • Iterate through pairs of integers
      i
      and
      j
      within a specified range (e.g., 20-bit numbers:
      range(1 << 20, 1 << 21)
      ).
    • Calculate the product
      k = i * j
      .
    • Filter
      k
      based on bit length constraints (e.g.,
      40 <= k.bit_length() <= 42
      ).
    • Derive the AES key by hashing
      k
      using SHA-256:
      sha256(str(k).encode()).digest()
      .
    • Decrypt the provided ciphertext using AES in ECB mode (
      AES.MODE_ECB
      ).
  2. Validation:

    • After decryption, check if the resulting plaintext contains a specific substring pattern (e.g.,
      b'HTB{'
      ).
    • Only consider a decryption successful if the pattern is found.
  3. CPU Throttling:

    • Implement a mechanism to pause the script execution at regular intervals (e.g., every 30 minutes) for a short duration (e.g., 3-5 seconds) to reduce CPU load.
  4. State Persistence:

    • Implement functionality to save the current state (values of
      i
      and
      j
      ) to a file (e.g.,
      state.json
      ).
    • Save the state periodically (e.g., during pauses) and upon manual interruption (e.g.,
      KeyboardInterrupt
      ).
    • Implement functionality to load the state from the file at startup to resume the brute-force process from the last saved position.
    • Clean up the state file if the brute-force completes successfully.

Communication & Style Preferences

  • Provide the complete, executable Python code.
  • Use clear variable names.
  • Include comments explaining the throttling and state-saving logic.

Anti-Patterns

  • Do not hardcode specific challenge values (like
    n
    ,
    e
    ,
    enc_secret
    ) into the logic; use placeholders or variables.
  • Do not omit the state-saving or pausing logic; these are mandatory requirements.

Triggers

  • brute force aes key with pause
  • save state python script
  • resume brute force
  • aes key product of two numbers
  • python script with throttling