Report templatesFunctions

filterIpsFromScope

Filter scope list to return only IP addresses

Usage

The filterIpsFromScope function processes an array of scope items and returns only those that are valid IPv4 addresses.

Syntax

{scope | filterIpsFromScope}

Parameters

  • input (array): An array of objects, each containing an endpoint property with a URL or IP address

Returns

An array of endpoint strings that are valid IPv4 addresses

Examples

Basic filtering

{[{endpoint: "example.com"}, {endpoint: "192.168.1.1"}, {endpoint: "10.0.0.1"}] | filterIpsFromScope}
// Returns: ["192.168.1.1", "10.0.0.1"]

Processing project scope

{project.scope | filterIpsFromScope}
// Returns only IP address endpoints from project scope

Mixed endpoints

{[
  {endpoint: "10.0.0.1"},
  {endpoint: "subdomain.example.org"},
  {endpoint: "255.255.255.255"},
  {endpoint: "localhost"},
  {endpoint: "192.168.100.50"}
] | filterIpsFromScope}
// Returns: ["10.0.0.1", "255.255.255.255", "192.168.100.50"]

Using in network diagrams

{infrastructure.assets | filterIpsFromScope | joinWith:", "}
// Returns comma-separated list of IP addresses

Valid IP ranges

{[
  {endpoint: "0.0.0.0"},
  {endpoint: "255.255.255.255"},
  {endpoint: "192.168.1.256"}, // Invalid - out of range
  {endpoint: "10.10.10.10"}
] | filterIpsFromScope}
// Returns: ["0.0.0.0", "255.255.255.255", "10.10.10.10"]

Use Cases

  • Network infrastructure assessments
  • Creating IP-only target lists
  • Firewall rule documentation
  • Network segmentation reporting
  • Infrastructure penetration test scoping