Why proactive scanning finds weaknesses in Cybersecurity - Performance Analysis
We want to understand how the time needed for proactive scanning changes as the system size grows.
How does scanning more parts affect the time it takes to find weaknesses?
Analyze the time complexity of the following simplified scanning process.
for each host in network:
for each port in host:
scan port for vulnerabilities
if vulnerability found:
log weakness
end for
end for
This code scans every port on every host in a network to find weaknesses.
Look at what repeats in the scanning process.
- Primary operation: Scanning each port on each host.
- How many times: Number of hosts times number of ports per host.
As the number of hosts or ports increases, the scanning time grows quickly.
| Input Size (hosts x ports) | Approx. Operations |
|---|---|
| 10 hosts x 10 ports | 100 scans |
| 100 hosts x 100 ports | 10,000 scans |
| 1000 hosts x 1000 ports | 1,000,000 scans |
Pattern observation: Doubling hosts and ports multiplies the work by four, showing a fast growth.
Time Complexity: O(n * m)
This means the scanning time grows proportionally to the number of hosts times the number of ports scanned.
[X] Wrong: "Scanning more hosts only adds a little extra time because scans happen fast."
[OK] Correct: Each host adds a full set of port scans, so time grows much faster than expected.
Understanding how scanning time grows helps you explain real-world security testing challenges clearly and confidently.
"What if the scanner only checks a fixed number of ports per host regardless of total ports? How would the time complexity change?"