{"slug": "is-that-really-gptbot-how-to-spot-fake-ai-crawlers-in-your-server-logs", "title": "Is that really GPTBot? How to spot fake AI crawlers in your server logs", "summary": "A developer at Get AI Vizible published a Python script that verifies claimed AI crawler traffic by checking log IPs against the published IP-range JSON files from OpenAI, Perplexity and Google, flagging hits that spoof user-agent strings like GPTBot or PerplexityBot as fake. The script parses combined-format access logs, matches each claimed crawler against its operator's prefixes array, and recommends reverse-then-forward DNS lookups as a fallback for crawlers without published ranges. In a three-line test log, it correctly separated one real GPTBot hit from two spoofed ones.", "body_md": "*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.*\n\nIf 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.\n\nA 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.\n\nThe good news: several AI companies now publish the IP ranges their crawlers use. You can check every hit against them.\n\nAt the time of writing (November 2026), these JSON files are live:\n\n| Crawler | What it does | IP ranges | \n|---|---|---|\n| GPTBot | OpenAI's training crawler | `https://openai.com/gptbot.json` | \n| OAI-SearchBot | Indexes pages for ChatGPT search | `https://openai.com/searchbot.json` | \n| ChatGPT-User | Fetches a page when a user's chat needs it | `https://openai.com/chatgpt-user.json` | \n| PerplexityBot | Perplexity's index crawler | `https://www.perplexity.ai/perplexitybot.json` | \n| Perplexity-User | Fetches pages on behalf of a user | `https://www.perplexity.ai/perplexity-user.json` | \n| Googlebot and Google's other crawlers | Search, AI Overviews | `https://developers.google.com/static/crawling/ipranges/common-crawlers.json` | \n\nThey all use the same shape: a `prefixes` array of objects with an `ipv4Prefix` or `ipv6Prefix`. That makes checking easy.\n\nFor 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.\n\nThis 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.\n\n``` python\nimport ipaddress, json, re, sys, urllib.request\n\nRANGES = {\n    \"GPTBot\": \"https://openai.com/gptbot.json\",\n    \"OAI-SearchBot\": \"https://openai.com/searchbot.json\",\n    \"ChatGPT-User\": \"https://openai.com/chatgpt-user.json\",\n    \"PerplexityBot\": \"https://www.perplexity.ai/perplexitybot.json\",\n    \"Perplexity-User\": \"https://www.perplexity.ai/perplexity-user.json\",\n}\n\ndef load(url):\n    with urllib.request.urlopen(url, timeout=15) as r:\n        data = json.load(r)\n    return [ipaddress.ip_network(p.get(\"ipv4Prefix\") or p.get(\"ipv6Prefix\"))\n            for p in data[\"prefixes\"]]\n\nnets = {bot: load(url) for bot, url in RANGES.items()}\n\n# Combined log format: IP is the first field, user agent is the last quoted field\nline_re = re.compile(r'^(\\S+) .*\"([^\"]*)\"$')\ncounts = {}\nfor line in open(sys.argv[1], encoding=\"utf-8\", errors=\"replace\"):\n    m = line_re.match(line.strip())\n    if not m:\n        continue\n    ip, ua = m.groups()\n    for bot in nets:\n        if bot.lower() in ua.lower():\n            addr = ipaddress.ip_address(ip)\n            real = any(addr in n for n in nets[bot])\n            key = (bot, \"verified\" if real else \"FAKE\")\n            counts[key] = counts.get(key, 0) + 1\n\nfor (bot, status), n in sorted(counts.items()):\n    print(f\"{bot:15} {status:9} {n}\")\n```\n\nRun it with `python verify_ai_bots.py /var/log/nginx/access.log`. Output looks like this:\n\n```\nGPTBot          FAKE      1\nGPTBot          verified  1\nPerplexityBot   FAKE      1\n```\n\n(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.)\n\n`$http_cf_connecting_ip` on Cloudflare, or `X-Forwarded-For` from a proxy you trust) or every hit will look fake.`creationTime` field; cache it for a day, not forever.\nIf 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.\n\n*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.*", "url": "https://wpnews.pro/news/is-that-really-gptbot-how-to-spot-fake-ai-crawlers-in-your-server-logs", "canonical_source": "https://dev.to/getvizibleonline/is-that-really-gptbot-how-to-spot-fake-ai-crawlers-in-your-server-logs-9j", "published_at": "2026-11-24 02:23:00+00:00", "updated_at": "2026-11-24 02:43:13.692304+00:00", "lang": "en", "topics": ["ai-crawlers", "generative-engine-optimization", "ai-search", "developer-tools"], "entities": ["Get AI Vizible", "OpenAI", "GPTBot", "Perplexity", "PerplexityBot", "ChatGPT-User", "Google", "Googlebot"], "also_reported_by": [], "takeaway": "Counting AI crawler visits by user-agent string alone inflates numbers and lets spoofers through; validate each hit's IP against operators' published prefixes JSON (e.g. openai.com/gptbot.json) and fall back to reverse-then-forward DNS, treating unconfirmed hits as unverified.", "recommendation": {"advice": "Validate claimed AI crawler hits against published IP-range JSON files and confirm via reverse-then-forward DNS before allow-listing; treat unverified user agents as fake.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/is-that-really-gptbot-how-to-spot-fake-ai-crawlers-in-your-server-logs", "markdown": "https://wpnews.pro/news/is-that-really-gptbot-how-to-spot-fake-ai-crawlers-in-your-server-logs.md", "text": "https://wpnews.pro/news/is-that-really-gptbot-how-to-spot-fake-ai-crawlers-in-your-server-logs.txt", "jsonld": "https://wpnews.pro/news/is-that-really-gptbot-how-to-spot-fake-ai-crawlers-in-your-server-logs.jsonld"}}