Prefix.Ninja 🥷🏻 Generator

This service allows you to query the internet routing registry (IRR) for prefixes originated by a specific ASN or AS-SET. It provides two main functionalities:

The Subdomain uses a implicit syntax AS35202.v6.list.my-prefix-list.prefix.ninja, while the path uses an explicit key/value syntax prefix.ninja/asn/35202/v6/l/my-pref-list. You can also combine both options but path arguments take presedence 35202.v4.prefix.ninja/l/my-list/

⚠️ Warning: Subdomain-based queries only work over HTTP due to certificate limitations. For HTTPS, please use the Path syntax. Colon-separated AS-SET (ie AS1299:AS-TWELVE99) is only supported via path syntax too.

Prefix Analysis vs. Configuration Generation

The system operates in one of two modes, determined entirely by the presence of the list name parameter:


Available Configuration Options

Parameter Default Full Keys Short Keys Notes
ASN/AS-SET N/A (Required) asn, as (Implicit in Subdomain) Public ASNs only
List Name N/A list, prefix-list, name l Required for Configuration Mode
Address family ipv4 ipv4, ipv6 v4, v6
Sequence Start 1 start, seq-start s Must be positive integer
Sequence Step 1 step, seq-step, increment i Must be positive integer
Max Length (Mask) 0 max-length, mask, max-mask m Max mask length - 0-32 for v4, 0-128 for v6
Expanded Mode false expanded, no-aggregate e Prevents prefix aggregation
Output JSON false json, json-out j Outputs structured JSON data

Syntax and Example Outputs

Example 1: Configuration Generation (default text output with max length)

Request: AS35202.l.MY_PL.s.100.i.10.m.32.prefix.ninja

!! Generated Configuration for AS35202
!! List Name: MY_PL
!! Address Family: IPv4
!! Sequence: Start=100, Step=10. Max Mask: 32.
!! Aggregation: Enabled (Optimal Patricia Tree). Count: 1

-- START CONFIG --
ip prefix-list MY_PL seq 100 permit 5.180.116.0/22 le 32
ip prefix-list MY_PL seq 110 deny any
-- END CONFIG --

Example 2: Prefix Analysis (v6 address family)

Request: AS-OTG.v6.e.prefix.ninja

!! ANALYSIS REPORT for AS-OTG
!! Address Family: IPv6
!! Aggregation: Disabled (Expanded flag set). Count: 3

-- PREFIX LIST --
2a0a:6400:117::/48
2a0a:6400:116::/48
2a0a:6400::/29
-- END PREFIX LIST --

Example 3: JSON Output (IPv6 with restrictive Max Length)

Request: prefix.ninja/l/my-filter-list/m/30/asn/35202/v6/e/json

{
  "asn": "35202",
  "list_name": "my-filter-list",
  "address_family": 6,
  "seq_start": 1,
  "seq_step": 1,
  "max_mask_length": 30,
  "expanded": true,
  "config_lines": [
    "ipv6 prefix-list my-filter-list seq 1 permit 2a0a:6400:117::/48",
    "ipv6 prefix-list my-filter-list seq 2 permit 2a0a:6400:116::/48",
    "ipv6 prefix-list my-filter-list seq 3 permit 2a0a:6400::/29 le 30"
  ]
}

Example 4: Mixed mode subdomain and path (Analysis JSON)

Request: as-otg.v4.prefix.ninja/expanded/j

{
  "asn": "AS-OTG",
  "address_family": 4,
  "expanded": true,
  "prefixes": [
    "5.180.116.0/22", 
    "5.180.116.0/24",
    "5.180.117.0/24"
  ],
  "is_as_set": true
}