sonar-ip-addresses

Queries the list of IP addresses registered as assets. When run without options, it returns all registered asset IPs. When the cve option is used, it returns only the asset IPs that have a specific CVE vulnerability registered.

Command properties

ItemDescription
Command typeDriver query
Required permissionNone
License usageNot counted
Parallel executionNot supported
Distributed executionNot supported

Syntax

sonar-ip-addresses [cve=STR]

Options

cve=STR
Returns only asset IPs that have the specified CVE ID registered as a vulnerability. Specify in CVE-YYYY-NNNNN format.

Output fields

FieldTypeDescription
guidstringAsset IP GUID
ipstringIP address
category_namestringAsset category name
category_guidstringAsset category GUID
hostnamestringHostname
workgroupstringWorkgroup or domain
descriptionstringAsset description
priorityintegerAsset priority
emp_namestringPrimary contact name
emp_name2stringSecondary contact name
emp_guidstringPrimary contact GUID
emp_guid2stringSecondary contact GUID
emp_keystringPrimary contact key
emp_key2stringSecondary contact key
dept_namestringPrimary contact department name
dept_name2stringSecondary contact department name
os_namestringOperating system name
os_verstringOperating system version
confidentialityintegerConfidentiality rating (CIA triad)
integrityintegerIntegrity rating (CIA triad)
availabilityintegerAvailability rating (CIA triad)
createdtimestampAsset registration timestamp
updatedtimestampAsset last modified timestamp
macstringMAC address
locationstringAsset location
installedtimestampInstallation date
site_namestringSite name
site_guidstringSite GUID
ext0ext9stringUser-defined extension fields 0 through 9

Error codes

Parse errors
Error codeMessageDescription
300101Invalid sonar session.Raised when executed in an invalid session
300142Invalid CVE ID format.Raised when the cve option value is not a valid CVE ID format
Runtime errors

N/A

Description

sonar-ip-addresses queries IP addresses registered as asset IPs in Sonar. Internally, it retrieves all asset IPs in pages of 1,000 records at a time and returns them sequentially.

When the cve option is used, only asset IPs with the specified CVE vulnerability registered are returned. The CVE ID is case-insensitive and is converted to uppercase internally.

You can combine the results with other event data using join, or use it alongside iplookup to look up detailed information about the asset where an event occurred.

Usage examples

  1. Query all registered asset IPs

    sonar-ip-addresses
    
  2. Query only asset IPs with a specific CVE vulnerability registered

    sonar-ip-addresses cve="CVE-2024-12345"
    | fields ip, hostname, os_name, os_ver, dept_name
    
  3. Join asset IPs with events to look up asset information for events

    table duration=1h sonar_events
    | join dst_ip [ sonar-ip-addresses | rename ip as dst_ip ]
    | fields _time, src_ip, dst_ip, hostname, dept_name
    
  4. Aggregate the number of asset IPs by operating system

    sonar-ip-addresses
    | stats count by os_name
    | sort -count
    

Compatibility

The sonar-ip-addresses command is available since version 5.0.2603.0.

Related