Add Bot.long_reply() that sends lines directly when under threshold, or creates a FlaskPaste paste with preview + link when over. Refactor abuseipdb, alert history, crtsh, dork, exploitdb, and subdomain plugins to use long_reply(). Configurable paste_threshold (default: 4). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91 lines
2.7 KiB
Python
91 lines
2.7 KiB
Python
"""Plugin: Google dork query builder."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from derp.plugin import command
|
|
|
|
# {t} is replaced with the user-supplied target domain/keyword.
|
|
_DORKS: dict[str, tuple[str, str]] = {
|
|
"admin": (
|
|
'site:{t} inurl:admin | inurl:login | inurl:panel',
|
|
"Admin/login panels",
|
|
),
|
|
"files": (
|
|
'site:{t} ext:pdf | ext:doc | ext:xls | ext:ppt | ext:csv',
|
|
"Exposed documents",
|
|
),
|
|
"dirs": (
|
|
'site:{t} intitle:"index of" | intitle:"directory listing"',
|
|
"Open directory listings",
|
|
),
|
|
"config": (
|
|
'site:{t} ext:xml | ext:conf | ext:cnf | ext:ini | ext:env | ext:yml',
|
|
"Configuration files",
|
|
),
|
|
"backup": (
|
|
'site:{t} ext:bak | ext:old | ext:backup | ext:sql | ext:tar | ext:gz',
|
|
"Backup/archive files",
|
|
),
|
|
"login": (
|
|
'site:{t} inurl:signin | inurl:auth | inurl:sso | intitle:"sign in"',
|
|
"Authentication pages",
|
|
),
|
|
"exposed": (
|
|
'site:{t} inurl:phpinfo | inurl:debug | inurl:test | intitle:"phpinfo()"',
|
|
"Debug/test pages",
|
|
),
|
|
"creds": (
|
|
'site:{t} ext:log | ext:env "password" | "passwd" | "secret"',
|
|
"Credential leaks in logs/env",
|
|
),
|
|
"cloud": (
|
|
'site:{t} site:s3.amazonaws.com | site:blob.core.windows.net'
|
|
' | site:storage.googleapis.com',
|
|
"Cloud storage buckets",
|
|
),
|
|
"errors": (
|
|
'site:{t} "sql syntax" | "fatal error" | "stack trace" | "traceback"',
|
|
"Error/debug messages",
|
|
),
|
|
}
|
|
|
|
|
|
@command("dork", help="Google dork builder: !dork list | !dork <category> <target>")
|
|
async def cmd_dork(bot, message):
|
|
"""Generate Google dork queries for a target.
|
|
|
|
Usage:
|
|
!dork list
|
|
!dork admin example.com
|
|
!dork files target.org
|
|
"""
|
|
parts = message.text.split(None, 3)
|
|
if len(parts) < 2:
|
|
await bot.reply(message, "Usage: !dork list | !dork <category> <target>")
|
|
return
|
|
|
|
subcmd = parts[1].lower()
|
|
|
|
if subcmd == "list":
|
|
lines = ["Dork categories:"]
|
|
lines.extend(f" {k:<10} {desc}" for k, (_, desc) in sorted(_DORKS.items()))
|
|
await bot.long_reply(message, lines, label="dork categories")
|
|
return
|
|
|
|
if len(parts) < 3:
|
|
cats = ", ".join(sorted(_DORKS))
|
|
await bot.reply(message, f"Usage: !dork <category> <target> -- categories: {cats}")
|
|
return
|
|
|
|
category = subcmd
|
|
target = parts[2]
|
|
|
|
if category not in _DORKS:
|
|
cats = ", ".join(sorted(_DORKS))
|
|
await bot.reply(message, f"Unknown category '{category}' -- available: {cats}")
|
|
return
|
|
|
|
template, desc = _DORKS[category]
|
|
query = template.replace("{t}", target)
|
|
await bot.reply(message, f"[{category}] {desc} -> {query}")
|