

Python code:
results = {}
for ip0 in range(256):
ip0_str = to_str( ip0 ) + '.'
for ip1 in range(256):
ip1_str = ip0_str + to_str( ip1 ) + '.'
for ip2 in range(256):
ip2_str = ip1_str + to_str( ip2 ) + '.'
for ip3 in range(256):
ip_vector = [ ip0, ip1, ip2, ip3 ]
ip_str = ip2_str + to_str( ip3 )
results[ ip_vector ] = ping( ip_str )
Might look a bit nicer using format strings instead. That map will contain on the order of 4 billion entries (one for each value of 2³²), and the actual size will depend on what format the ping function returns, 4 bytes for each key (optimized from my initial version that used the IPs as keys), plus all the internal structures for the map like key hashes and the hash table itself. Ie, this takes more memory to run than viewing OP’s full sized image and I wouldn’t suggest running it with less than 32GB of RAM. Though it would take less memory if it generated the image directly or at least making the keys implicit (which the image does, as they are encoded into the x, y coordinates rather than stored).
Edit: Let’s look at runtime, too, because why not. Assuming every single IP responds in 0.01 seconds (they’ll take longer, especially the ones that time out instead of respond), rounding the total to that nice 4 billion number get us 40 million seconds. An hour is less than 4000 seconds, so it would take over 100 hours to run this script.
Though it could be parallelized, since you can ping many targets at once. Not sure what the maximum number of pings you could have in flight is, but whatever it is, you’d be much better off using a script that did like 80% of that (to leave some margin for the rest of the system to use, also ISPs might not be happy with you maxing out your ICMP traffic).








Doh, no such luck for me. Oh well, I still have my PS2 lol.