Get all IP addresses from a given IP address and subnet mask
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 06:15 AM
Hi Team,
We have a requirement to run a loop and scan all the IPs which are present in a subnet .
A subnet can have a number of IPs associated to it.
We need to have a javascript code to scan all the IPs within a subnet.
Thanks
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 06:28 AM
Hi Shraddha,
If i understand well you need to figure out what the IP addresses are, right?
E.g. for
34.103.160.30/28
you want to calculate usable Host IP range?
From top of my head I can think of two options
a. Use some existing API to get the data, by quick google search this might be useful https://subnet.im/api.html
b. Convert the IP and mask to binary and and do a calculation per octet to figure out the ranges (you may need a bit of networking experience or knowledge how the subnets are being calculated)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 09:03 AM
Hi, what exactly scan are you going to perform with each IP from the range? Just trying to understand your use case better.
Hope it helps