mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-09-24 02:10:55 +02:00
Add files via upload
This commit is contained in:
@@ -151,3 +151,52 @@ curl -k "https://127.0.0.1:8080/api/audit/logs/export" \
|
||||
```
|
||||
|
||||
Exported logs may contain sensitive operational data. Store encrypted.
|
||||
|
||||
## Recipe 11: Bulk Import Assets
|
||||
|
||||
Create `assets.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"source": "api-import",
|
||||
"source_query": "cmdb-export-2026-07",
|
||||
"assets": [
|
||||
{
|
||||
"domain": "app.example.com",
|
||||
"port": 443,
|
||||
"protocol": "https",
|
||||
"tags": ["production", "internet"],
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"ip": "192.0.2.10",
|
||||
"port": 22,
|
||||
"protocol": "ssh",
|
||||
"status": "active"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Submit it:
|
||||
|
||||
```bash
|
||||
curl -k https://127.0.0.1:8080/api/assets/import \
|
||||
-H "Authorization: Bearer <token>" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data-binary @assets.json
|
||||
```
|
||||
|
||||
Example response:
|
||||
|
||||
```json
|
||||
{"created":2,"updated":0,"skipped":0}
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- The caller needs `asset:write`.
|
||||
- Each asset requires at least one of `host`, `ip`, or `domain`.
|
||||
- One request supports up to 100,000 assets. For large payloads, use a file with `--data-binary` instead of embedding JSON in the command line.
|
||||
- An existing “target + port + protocol” is merged and counted in `updated`.
|
||||
- To work from XLSX/CSV, use **Asset Inventory → Bulk Import** in the Web UI. The API itself accepts JSON rather than multipart files.
|
||||
|
||||
Reference in New Issue
Block a user