freelabz / secator

secator - the pentester's swiss knife
https://docs.freelabz.com
Other
868 stars 73 forks source link

feat: auto-detect local CIDR using IP config #447

Open ocervell opened 1 month ago

ocervell commented 1 month ago

It would be nice to quickly scan a local network that we are connect to with no targets (or a special target called 'localnet') that would find the local CIDR of the network we are connected to.

To do this, we can use:

netstat -rn # package net-tools

or

ip route show # available by default in Debian

and ignore docker-* (docker interface) and br-* (bridge interfaces)

We then need to 0-out the last bit before the /, i.e if the command returns 10.0.1.4/24, the CIDR range is 10.0.1.0/24