AI YARA and Sigma rules

Draft YARA and Sigma rules, then test

Paste a sample’s extracted strings or a short log excerpt into minimax-m3.1-flash-cybersecurity at https://api.pentestllm.ai/v1 and get a draft YARA or Sigma rule back, with a line on why each condition is there. Treat it as a first pass that is ready only after yara and sigma-cli have run it against files and logs whose answer you already know.

Prices per token

Get a keyTry it free in the browser
python
1from openai import OpenAI
2
3client = OpenAI(base_url="https://api.pentestllm.ai/v1", api_key="sk-ptl-live-…")
4
5reply = client.chat.completions.create(
6 model="auto/security",
7 messages=[{"role": "user", "content": "Explain this advisory and list what to check on an affected host."}],
8)
9print(reply.model) # the build that answered
10print(reply.choices[0].message.content)

What the model needs from you

A rule is only as good as the evidence you hand over. For YARA, give the strings you already pulled from the file, the file type, a rough size range and the kind of clean files it must never match. For Sigma, give a few raw events with the field names exactly as your pipeline stores them, the log source (for example Windows process creation from Sysmon) and one sentence on the behaviour you want to catch.

Say where the rule will run. A line like "exercise detection for the Q4 purple team, client lab, signed rules of engagement" gets a tighter answer than a bare request, and keeps the work inside the scope you agreed. The offensive half of that exercise lives on red team; if you do not have a written scope yet, the rules of engagement builder is a quick place to start one.

Prompt template: YARA from strings

Ask for one rule with a meta block, a one-line reason for each string you kept, the strings dropped as too common and why, and two clean file types the rule could still hit by accident. The per-string reasons are what let you spot library names and compiler banners that appear in thousands of clean files.

text
1You write YARA rules for a detection engineering team.
2Context: purple team exercise under signed scope. The rule scans files on lab hosts.
3
4Strings extracted from the target file (one per line):
5<paste strings>
6
7File type: <PE / ELF / Office / script / text>
8Size range: <e.g. under 2 MB>
9Must not match: <e.g. our standard developer workstation image>
10
11Return: one YARA rule with a meta block; one line per kept string on why it is specific;
12the strings you dropped as too common; two clean file types this rule could still hit.

Worked YARA example: a planted marker

The cleanest way to test a YARA workflow end to end is a canary: a string you plant yourself in a test file, so there is nothing to analyse and no doubt about the right answer. Ask for a rule that matches the marker in ASCII or UTF-16 and ignores case, then prove it both ways. Run the same two checks on every rule the model writes for a real sample: one known-positive file, one folder of known-clean files. If the clean folder prints anything, send the hit back to the model with the file type and ask which string caused it. Pulling the strings out of a sample is analysis work, covered on malware analysis.

shell
1echo "build tag ptl-purple-canary-2026" > canary.txt
2yara --fail-on-warnings -s canary.yar canary.txt # expect one hit with the matched string
3yara --fail-on-warnings -r canary.yar ./clean-set/ # expect no output at all

Worked Sigma example: a tool fetching a URL

certutil.exe is a Windows certificate utility that can also download files, which makes it a well-known detection idea; SigmaHQ publishes a rule for it. Hand the model your own Sysmon events from a lab host, ask for a draft, and compare its logic with the public rule afterwards. Validate the draft, then turn it into a query for your SIEM. sigma check catches structure and rule-quality issues but does not run the rule against events, so the last test happens in your SIEM: confirm the query fires on the lab event you reproduced, then run it over a week of normal logs and count the noise.

shell
1sigma check certutil_url.yml
2sigma plugin install splunk
3sigma convert -t splunk -p sysmon certutil_url.yml

Where drafts usually go wrong

Strings too common
Library names and compiler banners appear in thousands of clean files; the per-string reasons make these easy to spot.
Field names not in your data
The model writes Sigma taxonomy names; the pipeline you pass with -p maps them to your fields, so check the converted query, not only the YAML.
Single-value all
The Sigma spec does not allow all on a single value; sigma check tells you, so fix it rather than suppress it.
No negative test
A rule that matched the sample has proved half of what you need; always run the clean-set folder too.
No file constraints
A YARA rule that matches a string anywhere scans every log and archive on the host; ask for a file-type check or a filesize limit when the format is known.
Unversioned drafts
Keep each draft, its test results and the model id in one commit, so you can tell later which rules a person wrote and which a model proposed.

Call it from a script

Any OpenAI-compatible client works; keys come from the console and per-token rates are on pricing. For Python and TypeScript setup, see the setup guides. Use this for authorized detection-engineering and purple-team work on data you are allowed to handle.

python
1from openai import OpenAI
2client = OpenAI(base_url="https://api.pentestllm.ai/v1", api_key="sk-ptl-live-...")
3reply = client.chat.completions.create(
4 model="minimax-m3.1-flash-cybersecurity",
5 messages=[
6 {"role": "system", "content": "You write YARA rules for a detection engineering team."},
7 {"role": "user", "content": "Strings: PTL-PURPLE-CANARY-2026. Text file. One rule, a reason per string."},
8 ],
9)
10print(reply.choices[0].message.content)

16 security builds, priced per token

USD per million tokens, live on 2026-11-27; auto/security bills at the build that answers.

Detected refusals and invalid non-streamed JSON qualify for automatic refunds within the daily cap. Verify your receipt.

Uncensored models and their prices per million tokens
Wire formats
Qwen3.8 27B Cybersecurityqwen3.8-27b-cybersecuritySecurity$0.40$2.40262Kopenai
Uncensored Qwen3.8 27b Cybersecurityqwen3.8-27b-cybersecurity-uncensoredSecurity$0.40$2.40262Kopenai
Gemma 4 26B A4B Cybersecuritygemma-4-26b-a4b-it-cybersecuritySecurity$0.4224$1.3376262Kopenai
Gemma 4 26B A4B Cybersecurity (Uncensored)gemma-4-26b-a4b-it-cybersecurity-uncensoredSecurity$0.48$1.52262Kopenai
GLM-5.3 Flash Cybersecurityglm-5.3-flash-cybersecuritySecurity$0.4935$1.6451049Kopenai
GLM-5.3 Flash Cybersecurity (Uncensored)glm-5.3-flash-cybersecurity-uncensoredSecurity$0.5093$1.69751049Kopenai
Red Team (Flash)uplink-red-team-flashSecurity$0.90$3.001000Kopenai
Red Team (Pro)uplink-red-team-proSecurity$1.50$6.00–openai
OrcaCyber MiniMax M3.1 Flashminimax-m3.1-flash-cybersecuritySecurity$2.00$4.00262Kopenai
OrcaCyber MiniMax M3.1 Flash (Uncensored)minimax-m3.1-flash-cybersecurity-uncensoredSecurity$2.00$4.00262Kopenai
OrcaCyber Qwen3.8 Flash Next (Uncensored)orcacyber-qwen3.8-flash-next-uncensoredSecurity$2.00$4.00262Kopenai
OrcaCyber Qwen3.8 Flash Nextqwen3.8-flash-next-cybersecuritySecurity$2.00$4.00262Kopenai
Uncensored Qwen3.8 Flash Next Cybersecurityqwen3.8-flash-next-cybersecurity-uncensoredSecurity$2.00$4.00262Kopenai
Cyber Frontiercyber-frontierSecurity$5.25$15.751049Kopenai
OrcaCyber Zero 1.5orca-zero-1.5-cybersecuritySecurity$7.50$18.75999Kopenai
OrcaCyber Zero 1.5 (Uncensored)orca-zero-1.5-cybersecurity-uncensoredSecurity$7.50$18.75999Kopenai

Full price list and tool fees · Every model · API docs

Questions

Can an AI write YARA rules I can deploy?

It can write a draft that compiles and often matches the sample. Whether it is deployable depends on your tests: one known-positive file, a folder of known-clean files and yara with fail-on-warnings. Deploy only what passes all three.

Does sigma-cli test a rule against my logs?

No. sigma check validates the rule and sigma convert produces a query for a backend such as Splunk. You run that query in your SIEM against a reproduced lab event and against normal traffic.

Which model should I use for detection rules?

Start with minimax-m3.1-flash-cybersecurity, or send auto/security and let the router pick. No public benchmark compares these builds on rule writing yet, so keep your canary and clean-set tests as the judge.

Is this an offensive tool?

No. Drafting YARA and Sigma rules is detection and defence work for authorized purple-team exercises. The page describes testing the rules, not evading them, and asks you to keep the exercise inside a signed scope.

Read next

Facts about other products and tools on this page were read from their own pages on 21 November 2026: YARA command-line docs, sigma-cli (GitHub), Sigma specification. They change; check the source before relying on a figure.

One key, from $3

For systems you own or may test in writing: acceptable use.

Get a key

Join on TelegramHelp