Rule language
The grammar, every field a rule can test, and rules to start from.
A rule watches your traffic and puts a verdict on the clients it catches: a tag, or a ban. It reads a little like SQL, but it isn't SQL: write only what the grammar below allows. Before you save one, a backtest on the Rules page shows who it would have caught.
-- Anyone fishing for secrets, admin panels or exploits.
TAG ip, ja4 AS 'prober' FOR 30 DAYS
WHERE category = 'probe'
How a rule reads
TAGorBAN.TAGnames what the rule found (TAG ip, ja4 AS 'phpmyadmin-probe');BANtakes noAS. Start withTAG: a tag changes nothing for the visitor until a gym routine or a tarpit takes the tagged clients.- Subjects are who the verdict lands on:
ip,ja4, orip, ja4(an IP and its TLS fingerprint together, which is one client). FORis how long the verdict lasts, likeFOR 1 DAY. A verdict with no end isFOR FOREVER.WHEREpicks the requests that count. WithoutWITHIN, one matching request is enough.WITHIN … HAVINGcounts each subject's matching requests over a window of at most 24 hours.UNTILlifts a verdict early, as soon as its subject makes a request that passes it.
To send a rule's clients to a gym or a tarpit, pick the gym routine or tarpit on the rule's page. The rule itself only tags or bans.
Grammar
script := action subjects [AS 'tag'] FOR duration [WHERE expr] [WITHIN span HAVING having] [UNTIL expr]
action := BAN | TAG
subjects := subject {, subject} subject := ip | ja4
duration := number unit | FOREVER span := number unit
unit := SECOND | MINUTE | HOUR | DAY | WEEK, or the plural
expr := term {OR term} term := factor {AND factor}
factor := NOT factor | ( expr ) | field predicate
predicate := op literal | [NOT] LIKE 'pattern' | [NOT] IN (literal, …) | IS [NOT] NULL
op := = | != | < | <= | > | >=
having := hterm {OR hterm} hterm := hfactor {AND hfactor}
hfactor := NOT hfactor | ( having ) | COUNT ( * | DISTINCT field ) [FILTER ( WHERE expr )] op number
- Clauses go in that order. Keywords ignore case.
- Strings take single quotes, doubling a quote inside (
'O''Brien'). Numbers are bare. <and>work only on number fields.LIKEignores case:%matches any run of characters and_one character.ANDbinds tighter thanOR, so wrapORgroups in parentheses when youANDthem with something else.- A line starting with
--is a comment.
Fields
| Field | What it is |
|---|---|
ip |
The client's IP. One address, or a CIDR range like '66.249.64.0/19', with =, != or IN. |
ja4 |
The TLS fingerprint. |
ja4.alpn |
The ALPN the client offered. '00' means none: a script, not a browser. |
ja3 |
The JA3 fingerprint. |
ja4h |
The header fingerprint, JA4H-style: method, version, cookie and referer, header count, language, then hashes. |
ua |
The user agent. |
hints |
Client hints: Sec-CH-UA and platform, like hints LIKE '%HeadlessChrome%'. |
client |
'spoofed', 'outdated', 'corporate' or 'hopped' (see below). |
lang |
Accept-Language, like 'en-US,en;q=0.9'. Missing is a script tell. |
host |
The hostname asked for. |
path |
The path, without the query string. |
category |
What the path is after: a family like 'probe', or a slug like 'probe/creds' (see below). |
method |
'GET', 'POST', 'HEAD', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'CONNECT' or 'TRACE'. |
status |
The HTTP status, a number. A class like 4xx is status >= 400 AND status < 500. |
duration |
The response time in milliseconds. |
action |
What the edge did: 'passed', 'observed', 'diverted' (sent to the gym) or 'blocked'. |
tag |
A tag the edge put on the request. |
asn |
The network's ASN, a number. |
network |
The network's name. |
network.kind |
'hosting' for cloud and datacenter networks (AWS, Google Cloud, DigitalOcean, OVH…), 'unknown' for everything else, like home and mobile ISPs. |
country |
A two-letter ISO code in capitals, like 'US' or 'NL'. |
region, city |
Where the IP is, roughly. |
response |
The response body. Only on routes you capture responses for, like response LIKE '%credentials do not match%'. |
response.type |
The response's content type, like 'application/json'. Captured routes only. |
tarpit |
The name of the tarpit that touched the request, or tarpit IS NOT NULL for any. |
tarpit.outcome |
What the tarpit did: 'free' (a free try), 'held', 'full' (answered at once) or 'left' (gave up while held). |
Clients
client takes =, != and IN. A client can be several at once, so "spoofed and outdated" is
client = 'spoofed' AND client = 'outdated'.
| Value | Means |
|---|---|
spoofed |
Not the browser it claims to be: its TLS handshake or client hints contradict its user agent. |
outdated |
A Chrome or Firefox many versions behind the one people run now. |
corporate |
Behind a corporate security gateway (Zscaler, Netskope, iboss, Cisco Umbrella). |
hopped |
Carries on a visit another IP started on the same site within the hour, as rotating proxies do. |
Path categories
Categories group paths by what a probe is after, not by product, so one product's paths sit in several.
WordPress's are in probe/admin (/wp-login.php), probe/cms (/wp-content, /xmlrpc.php) and
probe/creds (/wp-config.php). For one product or technology, match its paths with LIKE. A request
with no category is an ordinary page: category IS NULL.
| Category | What's in it |
|---|---|
probe/creds |
Secrets and credentials: .env files, cloud and SSH keys, password files. |
probe/source |
Source code and project files: .git, editor folders, manifests, backups. |
probe/config |
App configuration and debug endpoints that leak settings. |
probe/admin |
Admin and login panels of popular software: /wp-admin, /phpmyadmin, /adminer… |
probe/cms |
WordPress and other CMS internals. |
probe/shell |
Scripts among a WordPress site's uploads, where only media belongs: a hoped-for web shell. |
probe/exploit |
Known exploit paths and server-side scripts: /_ignition/, /vendor/phpunit/, /cgi-bin/… |
probe/api |
API discovery: GraphQL endpoints, API docs, container registries. |
probe/saas |
Dashboard pages of a typical SaaS app (billing, API keys, webhooks) asked for on sites that have none. |
probe/phish |
Pages of known phishing kits, checked to find sites that already host one. |
probe/agent |
AI agent and MCP discovery files, like /.well-known/mcp.json. |
asset/static |
Scripts, styles, images and fonts a page loads. |
asset/browser |
Icons, manifests and robots.txt that browsers and crawlers ask for on their own. |
asset/cms |
What a WordPress page loads from its theme, plugins, core and uploads. |
edge/diagnostic |
NiceTryBot's own diagnostic pages on the edge. |
Examples
Probe scanners, banned for a month:
-- Anyone fishing for secrets, admin panels or exploits.
BAN ip, ja4 FOR 30 DAYS
WHERE category = 'probe'
One IP collecting 404s across several of your sites:
BAN ip FOR 1 HOUR
WHERE status = 404
WITHIN 10 MINUTES
HAVING COUNT(*) >= 2 AND COUNT(DISTINCT host) >= 2
A browser's name with a script's TLS:
-- Claims to be Chrome or Firefox, but its TLS offers no ALPN: a script.
TAG ip, ja4 AS 'ua-tls-mismatch' FOR 1 DAY
WHERE (ua LIKE '%Chrome/%' OR ua LIKE '%Firefox/%')
AND ja4.alpn = '00'
A burst from a datacenter:
BAN ip, ja4 FOR 6 HOURS
WHERE network.kind = 'hosting'
WITHIN 5 MINUTES
HAVING COUNT(*) >= 60
Failed logins, read from the response:
-- One client getting the same login error back, again and again.
-- Needs a capture on your login route, so rules can read the response.
TAG ip, ja4 AS 'failed-login' FOR 1 DAY
WHERE method = 'POST'
AND response LIKE '%credentials do not match%'
WITHIN 10 MINUTES
HAVING COUNT(*) >= 3
Secret and source hunters:
TAG ip, ja4 AS 'secret-hunter' FOR 7 DAYS
WHERE category IN ('probe/creds', 'probe/source')
AND status IN (403, 404)
AI training crawlers, by the names they give:
TAG ip AS 'ai-crawler' FOR 1 DAY
WHERE ua LIKE '%GPTBot%'
OR ua LIKE '%ClaudeBot%'
OR ua LIKE '%CCBot%'
OR ua LIKE '%Bytespider%'
OR ua LIKE '%meta-externalagent%'
A client whose user agent, TLS and client hints tell different stories:
TAG ip, ja4 AS 'spoofed-browser' FOR 1 DAY
WHERE client = 'spoofed'
Rule Packs, which come with NiceTryBot, install tested rules like these with a gym routine to match.