pygments-lexer-yara-l
A Pygments plugin providing syntax highlighting for YARA-L 2.0, a language used to create detection rules for Google Security Operations (SecOps).
Features
- Syntax highlighting for all YARA-L 2.0 constructs
- Supports section keywords (
rule,meta,events,match,outcome,condition,options,order,limit,stage,dedup,select,unselect) - Supports operator keywords (
and,or,not,nocase,over,before,after,of,in,any,all,if,regex,cidr,by,asc,desc,AND,OR) - Supports boolean/null constants (
true,false,null) - Highlights all built-in namespaced functions (
strings.*,re.*,math.*,net.*,timestamp.*,arrays.*,cast.*,hash.*,bytes.*,window.*,metrics.*,optimization.*) - Highlights aggregate functions (
count,count_distinct,sum,avg,max,min,stddev,array,array_distinct,group) - Highlights UDM/graph field paths (
$e.principal.hostname→ variable + attribute tokens) - Handles all string types: double-quoted strings with escape sequences, back-quoted raw strings, and regex literals
- Handles line comments (
//) and block comments (/* */) - Auto-detection heuristics based on common YARA-L patterns
- Registered as a Pygments plugin via
pygments.lexersentry point
Installation
pip install pygments-lexer-yara-l
Usage
Once installed, the lexer is automatically available to Pygments via the plugin entry point. You can use it with any Pygments-compatible tool.
Command line (pygmentize)
pygmentize -l yaral my_rule.yaral
pygmentize -l yara-l my_rule.yaral
Python API
from pygments import highlight
from pygments.formatters import TerminalFormatter
from pygments_lexer_yaral import YaraLLexer
code = open('my_rule.yaral').read()
print(highlight(code, YaraLLexer(), TerminalFormatter()))
Terminal preview
python preview.py
DEBUG=1 python preview.py # Print each token and its type
Visual preview server
pip install 'pygments-lexer-yara-l[server]'
python server.py
# Then open http://localhost:8080
Supported aliases
| Alias | Description |
|---|---|
yaral |
Primary alias |
yara-l |
Alternative alias |
File extension
.yaral
MIME type
text/x-yaral
Development
git clone https://github.com/seanthegeek/pygments-lexer-yara-l.git
cd pygments-lexer-yara-l
pip install -e ".[dev,server]"
make test
License
MIT License. See LICENSE for details.
Links
Metadata
Release files for pygments-lexer-yara-l 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pygments_lexer_yara_l-0.1.0.tar.gz | 6.5 kB | Without provenance | Details for pygments_lexer_yara_l-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pygments_lexer_yara_l-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pygments_lexer_yara_l-0.1.0-py3-none-any.whl |
Total release size: 13.1 kB
Release files / pygments_lexer_yara_l-0.1.0.tar.gz
| Download URL | pygments_lexer_yara_l-0.1.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21604f54d7bb679949292a0615c866f93e0799f85624395d72bc670887759833
|
|
BLAKE2b-256 checksum How to use checksums |
a3292b819e2b4bc81c45f328cf579d612233c1f852c283a1d22860ef8b93f468
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Release files / pygments_lexer_yara_l-0.1.0-py3-none-any.whl
| Download URL | pygments_lexer_yara_l-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d13077df6d2ba4422e426a2f88238e7181543b8931c97e14ecc395262c45a81a
|
|
BLAKE2b-256 checksum How to use checksums |
8ab5378babd11a66a3327ec50194e5e23088cda4a3a650d29ece9589ae1f6701
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Security for pygments-lexer-yara-l 0.1.0
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.