2026-07-20 10:22:05 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Osint;
|
|
|
|
|
|
|
|
|
|
use App\Osint\Runners\CrtShRunner;
|
2026-07-20 11:59:20 +03:00
|
|
|
use App\Osint\Runners\DnsRunner;
|
|
|
|
|
use App\Osint\Runners\GravatarRunner;
|
2026-07-20 11:49:09 +03:00
|
|
|
use App\Osint\Runners\HoleheRunner;
|
2026-07-20 10:22:05 +03:00
|
|
|
use App\Osint\Runners\IpApiRunner;
|
2026-07-20 12:10:27 +03:00
|
|
|
use App\Osint\Runners\OpenCorporatesRunner;
|
2026-07-20 10:22:05 +03:00
|
|
|
use App\Osint\Runners\SherlockRunner;
|
|
|
|
|
use App\Osint\Runners\TheHarvesterRunner;
|
|
|
|
|
use App\Osint\Runners\WhoisRunner;
|
|
|
|
|
|
|
|
|
|
class RunnerRegistry
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Maps a sources.key value to the Runner implementation that handles it.
|
|
|
|
|
* A source with no entry here (or a null `runner` column) isn't
|
|
|
|
|
* integrated yet.
|
|
|
|
|
*
|
|
|
|
|
* @var array<string, class-string<Runner>>
|
|
|
|
|
*/
|
|
|
|
|
private const RUNNERS = [
|
|
|
|
|
'sherlock' => SherlockRunner::class,
|
|
|
|
|
'crtsh' => CrtShRunner::class,
|
|
|
|
|
'whois' => WhoisRunner::class,
|
|
|
|
|
'ip-api' => IpApiRunner::class,
|
|
|
|
|
'theharvester' => TheHarvesterRunner::class,
|
2026-07-20 11:49:09 +03:00
|
|
|
'holehe' => HoleheRunner::class,
|
2026-07-20 11:59:20 +03:00
|
|
|
'gravatar' => GravatarRunner::class,
|
|
|
|
|
'dns' => DnsRunner::class,
|
2026-07-20 12:10:27 +03:00
|
|
|
'opencorporates' => OpenCorporatesRunner::class,
|
2026-07-20 10:22:05 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public function has(string $sourceKey): bool
|
|
|
|
|
{
|
2026-07-20 12:10:27 +03:00
|
|
|
if (! isset(self::RUNNERS[$sourceKey])) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// OpenCorporates additionally needs an API token configured before
|
|
|
|
|
// it's actually runnable — otherwise it's hidden rather than shown
|
|
|
|
|
// as a broken "Run" button that always fails.
|
|
|
|
|
if ($sourceKey === 'opencorporates') {
|
|
|
|
|
return filled(config('services.opencorporates.token'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
2026-07-20 10:22:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function resolve(string $sourceKey): Runner
|
|
|
|
|
{
|
|
|
|
|
if (! $this->has($sourceKey)) {
|
|
|
|
|
throw new RunnerException("No runner registered for source [{$sourceKey}].");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return app(self::RUNNERS[$sourceKey]);
|
|
|
|
|
}
|
|
|
|
|
}
|