fix(ns-scan): block network scan for large network (/19 or lower) #1493
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request enhances the network scanning functionality by adding subnet size validation and improving interface information. The most important changes are:
Network scanning improvements:
scanfunction to take bothdeviceandinterfaceparameters, and added logic to block ARP scans on subnets smaller than /20, returning a validation error if the subnet is too large.netmask_to_cidr_notationhelper function to convert a netmask (e.g., 255.255.0.0) into CIDR notation (e.g., 16), using theipaddressmodule.Interface listing enhancements:
list_interfacesfunction to include the netmask in CIDR notation for each interface in its output.Command-line interface updates:
interfaceparameter for scans, ensuring the new validation logic is used.Refs: #1434