A short script to get all prefixes from AS by number:
$ASN = Read-Host "Enter AS Number numerals"
# Replace 'API_URL' with the actual URL of the API.
$apiUrl = "https://stat.ripe.net/data/ris-prefixes/data.json?resource=$ASN&list_prefixes=true"
# Perform the GET request and convert the JSON response into a PowerShell object.
$response = Invoke-RestMethod -Uri $apiUrl -Method Get
# Extract the 'prefix' field from each element in the 'ipv4_prefixes' array.
$prefixes = $response.data.prefixes.v4.originating
# Print the prefixes with desired format.
foreach ($prefix in $prefixes) {
Write-Output "/ip route add dst-address=$prefix gateway=10.10.0.1 comment=AS$ASN"
}
