Add TCP port scan persistence and API endpoint.

Probe configured ports for alive hosts, persist port states, and expose scan port results via REST.

Made-with: Cursor
This commit is contained in:
Andrey Lutsenko
2026-04-09 21:54:17 +10:00
parent 9afbbbb762
commit e9452dcc0a
6 changed files with 159 additions and 1 deletions
+7
View File
@@ -9,6 +9,7 @@
- `GET /api/scans` - список сканов.
- `GET /api/scans/{id}` - просмотр созданного задания.
- `GET /api/scans/{id}/hosts` - результаты проверки хостов по скану.
- `GET /api/scans/{id}/ports` - результаты проверки TCP-портов по скану.
- Валидация CIDR и exclude IP.
- Два backend-хранилища: in-memory и PostgreSQL.
- После создания scan запускается фоновый discovery с обновлением статуса и прогресса.
@@ -137,6 +138,12 @@ curl -s http://localhost:8080/api/scans?limit=20
curl -s http://localhost:8080/api/scans/<scan_id>/hosts?limit=200
```
Получить результаты по портам:
```bash
curl -s http://localhost:8080/api/scans/<scan_id>/ports?limit=500
```
## Запуск как сервис на Linux (systemd)
1. Собрать бинарник: