0
0
Cybersecurityknowledge~5 mins

Web vulnerability scanning in Cybersecurity - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Web vulnerability scanning
O(p * i)
Understanding Time Complexity

When scanning a website for security weaknesses, it is important to understand how the scanning time changes as the website grows.

We want to know how the number of pages and inputs affects the scanning effort.

Scenario Under Consideration

Analyze the time complexity of the following simplified vulnerability scanning process.


for page in website.pages:
    for input_field in page.input_fields:
        test_input(input_field)
        check_response()
    scan_page_for_issues(page)

This code scans each page and tests every input field for vulnerabilities.

Identify Repeating Operations

Identify the loops, recursion, array traversals that repeat.

  • Primary operation: Testing each input field on every page.
  • How many times: For each page, all input fields are tested once.
How Execution Grows With Input

As the number of pages or input fields grows, the scanning time grows too.

Input Size (pages x inputs)Approx. Operations
10 pages x 5 inputs50 tests
100 pages x 5 inputs500 tests
1000 pages x 5 inputs5000 tests

Pattern observation: The total tests increase proportionally with the number of pages and inputs.

Final Time Complexity

Time Complexity: O(p * i)

This means the scanning time grows in direct proportion to the number of pages (p) and input fields (i).

Common Mistake

[X] Wrong: "Scanning time only depends on the number of pages, not inputs."

[OK] Correct: Each input field needs separate testing, so more inputs mean more work.

Interview Connect

Understanding how scanning time grows helps you explain efficiency and resource needs clearly in real-world security tasks.

Self-Check

"What if the scanner also tested every link on each page? How would that affect the time complexity?"