mirror of
https://github.com/j3ssie/osmedeus.git
synced 2026-08-29 19:29:45 +02:00
- Add ssh_exec() and ssh_rsync() functions for remote command execution and file transfer with connection pooling - Add db_import_dns_asset() to import DNS zone records and group by domain with A/AAAA records stored separately - Add db_import_custom_asset() for flexible JSONL asset import with direct field mapping, supporting tags and custom asset types - Extend Asset model with ExternalURL, Remarks (string array), Language, Size, and LOC fields for better metadata tracking - Add backward compatibility layer for legacy JSON formats (string remarks, tags array merging) - Register new functions in function registry with proper documentation and usage examples
212 lines
6.0 KiB
Plaintext
212 lines
6.0 KiB
Plaintext
---
|
|
title: "Assets"
|
|
description: "Query discovered assets and asset diff snapshots"
|
|
---
|
|
|
|
# Assets
|
|
|
|
## List Assets
|
|
|
|
Get a paginated list of assets with optional workspace filtering.
|
|
|
|
**List all assets:**
|
|
```bash
|
|
curl http://localhost:8002/osm/api/assets \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
**List assets with pagination:**
|
|
```bash
|
|
curl "http://localhost:8002/osm/api/assets?offset=0&limit=100" \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
**Filter by workspace:**
|
|
```bash
|
|
curl "http://localhost:8002/osm/api/assets?workspace=example.com" \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
**Combine workspace filter with pagination:**
|
|
```bash
|
|
curl "http://localhost:8002/osm/api/assets?workspace=example.com&offset=50&limit=25" \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"data": [
|
|
{
|
|
"id": 1,
|
|
"workspace": "example.com",
|
|
"asset_value": "api.example.com",
|
|
"url": "https://api.example.com",
|
|
"input": "api.example.com",
|
|
"scheme": "https",
|
|
"method": "GET",
|
|
"path": "/",
|
|
"status_code": 200,
|
|
"content_type": "application/json",
|
|
"content_length": 4523,
|
|
"title": "API Documentation",
|
|
"words": 523,
|
|
"lines": 89,
|
|
"host_ip": "93.184.216.34",
|
|
"a": ["93.184.216.34", "93.184.216.35"],
|
|
"tls": "TLS 1.3",
|
|
"asset_type": "web",
|
|
"tech": ["nginx/1.21.0", "nodejs", "express"],
|
|
"time": "245ms",
|
|
"remarks": ["production"],
|
|
"source": "httpx",
|
|
"created_at": "2025-01-15T10:30:00Z",
|
|
"updated_at": "2025-01-15T10:30:00Z"
|
|
},
|
|
{
|
|
"id": 2,
|
|
"workspace": "example.com",
|
|
"asset_value": "admin.example.com",
|
|
"url": "https://admin.example.com",
|
|
"input": "admin.example.com",
|
|
"scheme": "https",
|
|
"method": "GET",
|
|
"path": "/login",
|
|
"status_code": 401,
|
|
"content_type": "text/html",
|
|
"content_length": 2156,
|
|
"title": "Admin Login - Example Corp",
|
|
"words": 156,
|
|
"lines": 45,
|
|
"host_ip": "93.184.216.36",
|
|
"a": ["93.184.216.36"],
|
|
"tls": "TLS 1.2",
|
|
"asset_type": "web",
|
|
"tech": ["nginx/1.20.0", "php/8.1", "wordpress"],
|
|
"time": "312ms",
|
|
"remarks": ["admin-panel"],
|
|
"source": "httpx",
|
|
"created_at": "2025-01-15T10:31:00Z",
|
|
"updated_at": "2025-01-15T10:31:00Z"
|
|
}
|
|
],
|
|
"pagination": {
|
|
"total": 500,
|
|
"offset": 0,
|
|
"limit": 20
|
|
}
|
|
}
|
|
```
|
|
|
|
**Asset Fields Reference:**
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| `id` | int | Unique asset identifier |
|
|
| `workspace` | string | Workspace/scan target name |
|
|
| `asset_value` | string | Primary asset identifier (hostname/subdomain) |
|
|
| `url` | string | Full URL of the asset |
|
|
| `input` | string | Original input value |
|
|
| `scheme` | string | Protocol scheme (http, https) |
|
|
| `method` | string | HTTP method used |
|
|
| `path` | string | URL path |
|
|
| `status_code` | int | HTTP response status code |
|
|
| `content_type` | string | Response content type |
|
|
| `content_length` | int | Response body size in bytes |
|
|
| `title` | string | HTML page title |
|
|
| `words` | int | Word count in response |
|
|
| `lines` | int | Line count in response |
|
|
| `host_ip` | string | Resolved IP address |
|
|
| `a` | array | DNS A records |
|
|
| `tls` | string | TLS version information |
|
|
| `asset_type` | string | Asset type classification |
|
|
| `tech` | array | Detected technologies |
|
|
| `time` | string | Response time |
|
|
| `remarks` | array | Custom labels/tags/remarks |
|
|
| `language` | string | Repository/source language |
|
|
| `size` | int | Repository/file size in bytes |
|
|
| `loc` | int | Lines of code (for repository assets) |
|
|
| `blob_content` | string | Large content (raw files, keys, etc.) |
|
|
| `source` | string | Discovery source (httpx, nuclei, etc.) |
|
|
| `created_at` | timestamp | Creation timestamp |
|
|
| `updated_at` | timestamp | Last update timestamp |
|
|
|
|
---
|
|
|
|
## List Asset Diff Snapshots
|
|
|
|
Get a paginated list of stored asset diff snapshots. These snapshots capture changes in assets over time.
|
|
|
|
**List all asset diff snapshots:**
|
|
```bash
|
|
curl http://localhost:8002/osm/api/assets/diffs \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
**List with pagination:**
|
|
```bash
|
|
curl "http://localhost:8002/osm/api/assets/diffs?offset=0&limit=50" \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
**Filter by workspace:**
|
|
```bash
|
|
curl "http://localhost:8002/osm/api/assets/diffs?workspace=example.com" \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
**Combine workspace filter with pagination:**
|
|
```bash
|
|
curl "http://localhost:8002/osm/api/assets/diffs?workspace=example.com&offset=0&limit=25" \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"data": [
|
|
{
|
|
"id": 1,
|
|
"workspace_name": "example.com",
|
|
"from_time": "2025-01-14T00:00:00Z",
|
|
"to_time": "2025-01-15T00:00:00Z",
|
|
"total_added": 15,
|
|
"total_removed": 3,
|
|
"total_changed": 7,
|
|
"diff_data": "{\"added\":[...],\"removed\":[...],\"changed\":[...]}",
|
|
"created_at": "2025-01-15T10:30:00Z"
|
|
},
|
|
{
|
|
"id": 2,
|
|
"workspace_name": "example.com",
|
|
"from_time": "2025-01-15T00:00:00Z",
|
|
"to_time": "2025-01-16T00:00:00Z",
|
|
"total_added": 8,
|
|
"total_removed": 1,
|
|
"total_changed": 12,
|
|
"diff_data": "{\"added\":[...],\"removed\":[...],\"changed\":[...]}",
|
|
"created_at": "2025-01-16T10:30:00Z"
|
|
}
|
|
],
|
|
"pagination": {
|
|
"total": 30,
|
|
"offset": 0,
|
|
"limit": 20
|
|
}
|
|
}
|
|
```
|
|
|
|
**Asset Diff Snapshot Fields Reference:**
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| `id` | int | Unique snapshot identifier |
|
|
| `workspace_name` | string | Workspace name for this diff |
|
|
| `from_time` | timestamp | Start time of the diff period |
|
|
| `to_time` | timestamp | End time of the diff period |
|
|
| `total_added` | int | Number of new assets added |
|
|
| `total_removed` | int | Number of assets removed |
|
|
| `total_changed` | int | Number of assets that changed |
|
|
| `diff_data` | string | JSON serialized diff data containing added, removed, and changed assets |
|
|
| `created_at` | timestamp | When the snapshot was created |
|