elddy / NimScan

🚀 Fast Port Scanner 🚀
MIT License
381 stars 38 forks source link

cidr range is off by 1 #16

Closed m4ul3r closed 2 years ago

m4ul3r commented 2 years ago

The cidr range for 192.168.1.1/25 should include 192.168.1.1 to 192.168.1.127 inclusive. In file ip_seg.nim, the line last[3] = $(last[3].parseInt() -1) excludes the final value and should be last[3] = $(last[3].parseInt()).

This fix would allow a single IP in cidr notation (192.168.1.1/32) and correct the range to include the last ip in each cidr range

jkellnersec commented 2 years ago

You usually would not want to include the first and last IP's of a cidr. The first is going to be the network/subnet its self, and the last is going to be the networks broadcast address. There is no need to port scan the broadcast address.