Device42 Executor¶
Category: Asset Inventory and Network Management
Script: device42.py
Integration: REST API
Faraday Plugin: Raw JSON
Website: https://www.device42.com
Description¶
Imports the device and IP address inventory from a Device42 CMDB into Faraday. Each device becomes a host with an informational asset-inventory entry, and IP records not tied to a device become hosts of their own.
Prerequisites¶
- A Device42 appliance reachable from the agent
- A Device42 user (username and password) with read access to devices and IP addresses
- Python
requestsmodule available to the agent
Configuration¶
Environment Variables (Setup)¶
| Variable | Required | Description |
|---|---|---|
D42_HOST |
Yes | Device42 host or URL (e.g., https://cmdb.mycorp.com). https:// is added if you enter a bare hostname. |
D42_USER |
Yes | Device42 username |
D42_PASSWORD |
Yes | Device42 password |
D42_PAGES |
No | Maximum number of pages to read from each list (default: 5, maximum: 50) |
These variables are also accepted as execution arguments, so a single run can override them.
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
D42_BUILDING |
string | No | Only import devices located in this building. Leave blank to import all devices. |
D42_LIMIT |
string | No | Number of records requested per page (default: 100, maximum: 1000) |
YAML Configuration Example¶
executors:
device42:
repo_executor: device42.py
max_size: 65536
varenvs:
D42_HOST: "https://cmdb.mycorp.com"
D42_USER: "<device42_user>"
D42_PASSWORD: "<device42_password>"
params:
D42_BUILDING:
mandatory: false
type: string
base: string
D42_LIMIT:
mandatory: false
type: string
base: string
How It Works¶
- Authenticates every request with HTTP Basic using
D42_USERandD42_PASSWORD - Reads devices from
GET /api/1.0/devices/all/(filtered byD42_BUILDINGif set) and IP records fromGET /api/1.0/ips/, using offset pagination - Creates one host per device, using its first non-loopback IP, name, serial number, FQDN, MAC address and an operating system/hardware/manufacturer string
- Adds an
[ASSET-INVENTORY]vulnerability with severityinfoto each host. Device42 details such as serial number, type, building and customer are added as references. - Creates a host for each IP record that does not belong to a device already imported, with the IP label or subnet as hostname
Notes¶
- Severity is always
infobecause the executor imports inventory, not vulnerabilities. - Devices without a usable IP (empty, loopback or
0.0.0.0) use IP0.0.0.0. D42_BUILDINGfilters devices only, not IP records.- The shared agent parameters (
AGENT_CONFIG_*tags and severity filters) are not applied by this executor.