User Tools

Site Tools


howtos:get_all_danish_ip_subenets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howtos:get_all_danish_ip_subenets [d/m/Y H:i] (current)
Line 1: Line 1:
 +Get the whole list:
  
 +<code>
 +wget ftp://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-latest
 +</code>
 +
 +Parse it with the following script:
 +
 +<code>
 +grep DK.ipv4 delegated-ripencc-latest | awk -F'|' -vOFS=/ '{print $4,32- log($5)/log(2)}' | while read network; do whois --verbose -h whois.ripe.net -T route -x $network >>danske_netblokke 2>&1; sleep 2; done
 +</code>
 +
 +Now extract the IP subents:
 +
 +<code>
 +cat danske_netblokke |grep route: | cut -d: -f2| sed 's/[[:space:]]//g'
 +</code>
 +
 +
 +
 +
 +One-liner for DK:
 +<code>
 +curl --silent https://stat.ripe.net/data/country-resource-list/data.json?resource=dk |grep -Eo  '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/([0-9]|[1-3][0-9])'| column -c 280
 +
 +</code>
 +
 +Change the resource=xx to the country you would like to extract (https://en.wikipedia.org/wiki/ISO_3166-2). 
 +
 +The last part "column -c 280" can be excluded to get the list in one row.
howtos/get_all_danish_ip_subenets.txt · Last modified: d/m/Y H:i (external edit)