Files
osint/app/Osint/Runners/GravatarRunner.php
T
cedry2k1992andClaude Sonnet 5 86f73c46b2 Add Gravatar and DNS Records collectors
Two pure-PHP collectors, no Python/venv/subprocess needed:
- GravatarRunner (email): checks gravatar.com/avatar/{md5}?d=404 for a
  200 vs 404. Scoped to that binary signal since Gravatar's profile
  JSON endpoint now requires API auth even for real, public profiles
  (confirmed against Gravatar's own creator's email).
- DnsRunner (domain): dns_get_record() for A/AAAA/MX/NS/TXT/CNAME. Raw
  payload is naturally keyed by record type, which the existing
  generic list-renderer on the investigation page turns into one
  collapsible section per type with no UI changes needed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-20 11:59:20 +03:00

50 lines
1.6 KiB
PHP

<?php
namespace App\Osint\Runners;
use App\Models\Target;
use App\Osint\Runner;
use App\Osint\RunnerException;
use App\Osint\RunnerResult;
use Illuminate\Support\Facades\Http;
class GravatarRunner implements Runner
{
public function run(Target $target): RunnerResult
{
if ($target->type !== 'email') {
throw new RunnerException('Gravatar only supports "email" targets.');
}
if (! filter_var($target->value, FILTER_VALIDATE_EMAIL)) {
throw new RunnerException('Value is not a valid email address.');
}
// Gravatar's public profile JSON endpoint now requires API auth
// (returns 404 even for real profiles without a key), but the
// plain avatar-existence check is still open and reliable.
$hash = md5(strtolower(trim($target->value)));
$avatarUrl = "https://www.gravatar.com/avatar/{$hash}";
$response = Http::timeout((int) config('osint.run_timeout'))
->get($avatarUrl, ['d' => '404']);
if ($response->status() !== 200 && $response->status() !== 404) {
throw new RunnerException('Gravatar request failed with status '.$response->status().'.');
}
$hasAvatar = $response->status() === 200;
return new RunnerResult(
raw: [
'has_avatar' => $hasAvatar,
'avatar_url' => $hasAvatar ? $avatarUrl : null,
'profile_url' => "https://gravatar.com/{$hash}",
],
summary: $hasAvatar
? 'Gravatar image found — this email is registered with Gravatar.'
: 'No Gravatar found for this email.',
);
}
}