0

Im working on RIPE Delegation Stats

and each line in the file is in the following format:

registry|cc|type|start|value|date|status[|extensions...]

where start and value means the following:

start: This is the IPv4 'first address' of the range.

value: In the case of IPv4 address the count of hosts for this range. This count does not have to represent a CIDR range.

examples for start and value:

196.4.163.0|768

41.74.0.0|4096

195.35.104.64|192 

198.54.38.0|1536

216.252.155.0|256

141.226.144.0|10240 

93.242.1.0|20224 

193.53.200.0|11520

How can I know which IP to end up with?

Thank you so much!

--- Update ----

I figured out how to solve this problem.

convert the first IP to a decimal number then add the value to it then convert back to ip < like that I will get both start and end IP for the range

Duha
  • 92
  • 1
  • 9
  • Many of the address ranges can not be converted to CIDR notation. Only networks the size of 2^n and and starting at multiple of it can be. – Klaus D. Feb 23 '20 at 07:06

1 Answers1

0

ipcalc, sipcalc, or just pure Bash will do the trick.

For more answers, including with examples, see: https://serverfault.com/q/54981

As for Python, you can just use the builtin https://docs.python.org/3/library/ipaddress.html or just struct and socket builtins https://stackoverflow.com/a/44043448

A T
  • 13,008
  • 21
  • 97
  • 158