Итерация 2: сканирование сети
- Phinx миграции: network_ranges, scan_jobs, discovered_hosts, audit_log - Models: NetworkRange, ScanJob, DiscoveredHost - Repositories с CRUD для всех сущностей - NetworkScanner: ping sweep + TCP connect + ARP table + reverse DNS - PingScanner, TcpPortScanner (curl_multi для параллелизма), ArpTableReader - HostFingerprintService: vendor detection + confidence scoring - ScanJobRunner + CLI worker (bin/run-scan-worker.php) - Discovery UI: управление диапазонами, запуск скана, таблица находок - NetworkRangeController с валидацией CIDR - Обновлён public/index.php с DI конфигурацией для новых сервисов
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Domovoy\Models;
|
||||
|
||||
class ScanJob
|
||||
{
|
||||
public ?int $id = null;
|
||||
public string $type = '';
|
||||
public string $status = 'pending';
|
||||
public ?int $networkRangeId = null;
|
||||
public ?string $deviceId = null;
|
||||
public ?\DateTimeImmutable $startedAt = null;
|
||||
public ?\DateTimeImmutable $finishedAt = null;
|
||||
public ?string $errorMessage = null;
|
||||
public ?string $resultJson = null;
|
||||
public ?string $createdBy = null;
|
||||
public ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
public static function fromArray(array $data): self
|
||||
{
|
||||
$obj = new self();
|
||||
$obj->id = (int)$data['id'];
|
||||
$obj->type = $data['type'];
|
||||
$obj->status = $data['status'];
|
||||
$obj->networkRangeId = $data['network_range_id'] !== null ? (int)$data['network_range_id'] : null;
|
||||
$obj->deviceId = $data['device_id'] ?? null;
|
||||
$obj->startedAt = $data['started_at'] !== null ? new \DateTimeImmutable($data['started_at']) : null;
|
||||
$obj->finishedAt = $data['finished_at'] !== null ? new \DateTimeImmutable($data['finished_at']) : null;
|
||||
$obj->errorMessage = $data['error_message'] ?? null;
|
||||
$obj->resultJson = $data['result_json'] ?? null;
|
||||
$obj->createdBy = $data['created_by'] ?? null;
|
||||
$obj->createdAt = new \DateTimeImmutable($data['created_at']);
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user