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,16 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*/
|
||||
public function test_that_true_is_true(): void
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Osint;
|
||||
|
||||
use App\Models\Target;
|
||||
use App\Osint\Runners\CrtShRunner;
|
||||
use App\Osint\RunnerException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CrtShRunnerTest extends TestCase
|
||||
{
|
||||
public function test_parses_and_deduplicates_subdomains(): void
|
||||
{
|
||||
Http::fake([
|
||||
'crt.sh/*' => Http::response(json_encode([
|
||||
['name_value' => "www.example.com\nexample.com"],
|
||||
['name_value' => "*.example.com\nwww.example.com"],
|
||||
])),
|
||||
]);
|
||||
|
||||
$target = new Target(['type' => 'domain', 'value' => 'example.com']);
|
||||
|
||||
$result = (new CrtShRunner)->run($target);
|
||||
|
||||
$this->assertSame(
|
||||
['*.example.com', 'example.com', 'www.example.com'],
|
||||
$result->raw['subdomains']
|
||||
);
|
||||
$this->assertStringContainsString('3 unique subdomains', $result->summary);
|
||||
}
|
||||
|
||||
public function test_handles_empty_response(): void
|
||||
{
|
||||
Http::fake(['crt.sh/*' => Http::response('')]);
|
||||
|
||||
$target = new Target(['type' => 'domain', 'value' => 'nonexistent-domain-xyz.com']);
|
||||
|
||||
$result = (new CrtShRunner)->run($target);
|
||||
|
||||
$this->assertSame([], $result->raw['subdomains']);
|
||||
$this->assertSame('No certificates found.', $result->summary);
|
||||
}
|
||||
|
||||
public function test_rejects_non_domain_targets(): void
|
||||
{
|
||||
$target = new Target(['type' => 'ip', 'value' => '8.8.8.8']);
|
||||
|
||||
$this->expectException(RunnerException::class);
|
||||
|
||||
(new CrtShRunner)->run($target);
|
||||
}
|
||||
|
||||
public function test_throws_on_http_failure(): void
|
||||
{
|
||||
Http::fake(['crt.sh/*' => Http::response('', 500)]);
|
||||
|
||||
$target = new Target(['type' => 'domain', 'value' => 'example.com']);
|
||||
|
||||
$this->expectException(RunnerException::class);
|
||||
|
||||
(new CrtShRunner)->run($target);
|
||||
}
|
||||
}
|
||||
@@ -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