Dev.to AI ๐Ÿค– Ai ๐Ÿ‘ 0 ๐Ÿ“– 3 min read

Is that really GPTBot? How to spot fake AI crawlers in your server logs

Disclosure: I work on Get AI Vizible, which includes AI crawler analytics. Everything below works with a log file and the Python standard library. This post was drafted by an AI agent for our team; the script was run aga

Disclosure: I work on Get AI Vizible, which includes AI crawler analytics. Everything below works with a log file and the Python standard library. This post was drafted by an AI agent for our team; the script was run against a test log before publishing.

If you grep your access logs for GPTBot, PerplexityBot or ChatGPT-User, you'll probably find hits. The question is how many of them are real.

A user-agent string is just text. Anyone can send GPTBot/1.2 in a header, and scrapers do, because some sites allow AI crawlers that they'd block for an unknown bot. So if you count AI crawler visits by user agent alone, the number is inflated, and if you allow-list by user agent alone, you're letting in whoever claims the name.

The good news: several AI companies now publish the IP ranges their crawlers use. You can check every hit against them.

Where the ranges are published

At the time of writing (November 2026), these JSON files are live:

Crawler What it does IP ranges
GPTBot OpenAI's training crawler https://openai.com/gptbot.json
OAI-SearchBot Indexes pages for ChatGPT search https://openai.com/searchbot.json
ChatGPT-User Fetches a page when a user's chat needs it https://openai.com/chatgpt-user.json
PerplexityBot Perplexity's index crawler https://www.perplexity.ai/perplexitybot.json
Perplexity-User Fetches pages on behalf of a user https://www.perplexity.ai/perplexity-user.json
Googlebot and Google's other crawlers Search, AI Overviews https://developers.google.com/static/crawling/ipranges/common-crawlers.json

They all use the same shape: a prefixes array of objects with an ipv4Prefix or ipv6Prefix. That makes checking easy.

For crawlers whose operator doesn't publish a list, the fallback is a reverse DNS lookup followed by a forward lookup to confirm. If neither works, treat the hit as unverified rather than real.

A short checker

This reads a log in the common "combined" format (nginx and Apache default), finds hits that claim to be an AI crawler, and checks the IP against the published ranges.

import ipaddress, json, re, sys, urllib.request

RANGES = {
    "GPTBot": "https://openai.com/gptbot.json",
    "OAI-SearchBot": "https://openai.com/searchbot.json",
    "ChatGPT-User": "https://openai.com/chatgpt-user.json",
    "PerplexityBot": "https://www.perplexity.ai/perplexitybot.json",
    "Perplexity-User": "https://www.perplexity.ai/perplexity-user.json",
}

def load(url):
    with urllib.request.urlopen(url, timeout=15) as r:
        data = json.load(r)
    return [ipaddress.ip_network(p.get("ipv4Prefix") or p.get("ipv6Prefix"))
            for p in data["prefixes"]]

nets = {bot: load(url) for bot, url in RANGES.items()}

# Combined log format: IP is the first field, user agent is the last quoted field
line_re = re.compile(r'^(\S+) .*"([^"]*)"$')
counts = {}
for line in open(sys.argv[1], encoding="utf-8", errors="replace"):
    m = line_re.match(line.strip())
    if not m:
        continue
    ip, ua = m.groups()
    for bot in nets:
        if bot.lower() in ua.lower():
            addr = ipaddress.ip_address(ip)
            real = any(addr in n for n in nets[bot])
            key = (bot, "verified" if real else "FAKE")
            counts[key] = counts.get(key, 0) + 1

for (bot, status), n in sorted(counts.items()):
    print(f"{bot:15} {status:9} {n}")

Run it with python verify_ai_bots.py /var/log/nginx/access.log. Output looks like this:

GPTBot          FAKE      1
GPTBot          verified  1
PerplexityBot   FAKE      1

(That's from a three-line test log: one real GPTBot IP, one documentation IP pretending to be GPTBot, and one public DNS IP pretending to be PerplexityBot.)

Things to watch for

  • Behind a CDN or proxy, the first field is the proxy's IP, not the visitor's. Log the real client IP ($http_cf_connecting_ip on Cloudflare, or X-Forwarded-For from a proxy you trust) or every hit will look fake.
  • Download the ranges regularly. They change. Each file has a creationTime field; cache it for a day, not forever.
  • Some AI crawlers don't publish ranges. Report those as unverified instead of guessing.
  • Blocking fakes is a separate decision. Verifying first tells you how big the problem is before you write firewall rules.

Why it matters for AI visibility

If you're trying to get your site cited by ChatGPT or Perplexity, the useful question isn't "did a bot visit?" but "did the real crawler fetch the pages I care about, and did it get a 200?" Real OAI-SearchBot and PerplexityBot hits on your key pages are a good sign. Lots of fake ones and no real ones means the AI engines probably haven't seen your content yet, whatever the raw user-agent counts say.

If you'd rather not run this yourself, Get AI Vizible's crawler analytics does the same check continuously (getvizible.online). The script above is free to use and needs nothing but Python.

๐Ÿ“ฐ Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.