Initial commit: Laravel OSINT platform
Multi-user OSINT investigation tool with owner-controlled per-user and per-group access grants. Includes Sherlock, theHarvester, crt.sh, WHOIS, and ip-api.com collectors wired through a pluggable Runner/queue pipeline, investigation search, and printable/CSV/JSON reporting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Osint;
|
||||
|
||||
use App\Models\Target;
|
||||
use App\Osint\Runners\IpApiRunner;
|
||||
use App\Osint\RunnerException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
class IpApiRunnerTest extends TestCase
|
||||
{
|
||||
public function test_parses_successful_lookup(): void
|
||||
{
|
||||
Http::fake([
|
||||
'ip-api.com/*' => Http::response([
|
||||
'status' => 'success',
|
||||
'country' => 'United States',
|
||||
'regionName' => 'Virginia',
|
||||
'city' => 'Ashburn',
|
||||
'isp' => 'Google LLC',
|
||||
'org' => 'Google Public DNS',
|
||||
'query' => '8.8.8.8',
|
||||
]),
|
||||
]);
|
||||
|
||||
$target = new Target(['type' => 'ip', 'value' => '8.8.8.8']);
|
||||
|
||||
$result = (new IpApiRunner)->run($target);
|
||||
|
||||
$this->assertSame('Ashburn, Virginia, United States (Google LLC)', $result->summary);
|
||||
$this->assertSame('8.8.8.8', $result->raw['query']);
|
||||
}
|
||||
|
||||
public function test_throws_when_lookup_reports_failure(): void
|
||||
{
|
||||
Http::fake([
|
||||
'ip-api.com/*' => Http::response([
|
||||
'status' => 'fail',
|
||||
'message' => 'private range',
|
||||
'query' => '10.0.0.1',
|
||||
]),
|
||||
]);
|
||||
|
||||
$target = new Target(['type' => 'ip', 'value' => '10.0.0.1']);
|
||||
|
||||
$this->expectException(RunnerException::class);
|
||||
$this->expectExceptionMessage('private range');
|
||||
|
||||
(new IpApiRunner)->run($target);
|
||||
}
|
||||
|
||||
public function test_rejects_non_ip_targets(): void
|
||||
{
|
||||
$target = new Target(['type' => 'domain', 'value' => 'example.com']);
|
||||
|
||||
$this->expectException(RunnerException::class);
|
||||
|
||||
(new IpApiRunner)->run($target);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user