Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds scan strategy #3075

Merged
merged 1 commit into from
Dec 27, 2022
Merged

adds scan strategy #3075

merged 1 commit into from
Dec 27, 2022

Conversation

tarunKoyalwar
Copy link
Member

@tarunKoyalwar tarunKoyalwar commented Dec 22, 2022

Proposed changes

  • Adds scan-strategy flag to nuclei
    • If value is host-spray all templates are iterated over each host
    • If value is template-spray all hosts are iterated over each template
    • If value is auto . [This is only a placeholder of template-spray for now] strategy should be selected based on given parameters and inputs.

Before this PR template-spray strategy was used and current default is template-spray

closes #3065

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@tarunKoyalwar
Copy link
Member Author

Flag Usage

User should select strategy based on targets . Each strategy has its own cons and pros

  1. When targets < 1000 . template-spray should be used . template spray type of scan is slightly faster but uses more RAM than host spray and should be used when targets < 1000 .

  2. When targets > 1000 . host-spray should be used . host spray type of scan uses less RAM than template-spray and reuses connections and other small details which have major impact when targets > 1000 .

Note:

the only criteria is target count . and whatever the scan strategy is selected nuclei performance will depend on below two parameters

-bs -bulk-size : max number of hosts to scan in parallel
-c concurrency : max number of templates in parallel for 'given hosts'

whatever the scan type is -bs < -c

@tarunKoyalwar
Copy link
Member Author

Integration Test fails due to code protocol and is not related to this PR

Running test cases for "code" protocol
[✘] Test "code/test.yaml" failed: incorrect number of results: 0 (actual) vs 1 (expected) 

@tarunKoyalwar tarunKoyalwar self-assigned this Dec 22, 2022
@Mzack9999 Mzack9999 added the Type: Enhancement Most issues will probably ask for additions or changes. label Dec 22, 2022
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - I'm proposing the following follow ups and missing TODOs:

Create the following follow up tickets:

  • Implementing auto strategy selection
  • Tune http.Transport and Network settings for single-host scan (ideally no HTTP connection should be closed if RFC-compliant)

@ehsandeep
Copy link
Member

@tarunKoyalwar useful addition 🎉

@Mzack9999 merging this PR as requested changes have been updated and fail tests are the result of another known issue in GH CI - #2969

@ehsandeep ehsandeep merged commit ff17d12 into dev Dec 27, 2022
@ehsandeep ehsandeep deleted the issue-3065-scan-strategy branch December 27, 2022 20:48
@ehsandeep ehsandeep removed the Status: Revision Needed Submitter of PR needs to revise the PR related to the issue. label Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
3 participants