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>
76 lines
2.2 KiB
PHP
76 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Investigation;
|
|
use App\Models\Source;
|
|
use App\Osint\RunnerRegistry;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class InvestigationController extends Controller
|
|
{
|
|
public function index(Request $request): View
|
|
{
|
|
$investigations = Investigation::query()
|
|
->accessibleBy($request->user())
|
|
->withCount('targets')
|
|
->latest()
|
|
->get();
|
|
|
|
return view('investigations.index', compact('investigations'));
|
|
}
|
|
|
|
public function create(): View
|
|
{
|
|
$this->authorize('create', Investigation::class);
|
|
|
|
return view('investigations.create');
|
|
}
|
|
|
|
public function store(Request $request): RedirectResponse
|
|
{
|
|
$this->authorize('create', Investigation::class);
|
|
|
|
$data = $request->validate([
|
|
'name' => ['required', 'string', 'max:255'],
|
|
'description' => ['nullable', 'string', 'max:5000'],
|
|
]);
|
|
|
|
$investigation = Investigation::create([
|
|
...$data,
|
|
'owner_id' => $request->user()->id,
|
|
'status' => 'open',
|
|
]);
|
|
|
|
return redirect()->route('investigations.show', $investigation);
|
|
}
|
|
|
|
public function show(Request $request, Investigation $investigation, RunnerRegistry $registry): View
|
|
{
|
|
$this->authorize('view', $investigation);
|
|
|
|
$investigation->load(['owner', 'targets.creator', 'targets.findings.source']);
|
|
|
|
$sources = Source::where('enabled', true)->orderBy('name')->get();
|
|
|
|
return view('investigations.show', [
|
|
'investigation' => $investigation,
|
|
'canEdit' => $investigation->isEditableBy($request->user()),
|
|
'canManageAccess' => $request->user()->can('manageAccess', $investigation),
|
|
'sources' => $sources,
|
|
'runnableSourceKeys' => $sources->filter(fn (Source $s) => $registry->has($s->key))->pluck('key'),
|
|
]);
|
|
}
|
|
|
|
public function destroy(Investigation $investigation): RedirectResponse
|
|
{
|
|
$this->authorize('delete', $investigation);
|
|
|
|
$investigation->delete();
|
|
|
|
return redirect()->route('investigations.index');
|
|
}
|
|
}
|