-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: added auto proxy based test generation for templates #5014
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
base: dev
Are you sure you want to change the base?
Conversation
… add-template-proxy-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm -left -optional- comments
|
|
||
| flagSet.CreateGroup("tests", "Tests", | ||
| flagSet.BoolVarP(&options.AutogenerateTests, "autogenerate-tests", "agt", false, "enable autogeneration of nuclei test-cases (http only now)"), | ||
| flagSet.BoolVarP(&options.RunNucleiTests, "run-tests", "rts", false, "run generated nuclei test-cases"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can rename it to something more descriptive, such as RunAutoGeneratedTests or RunTemplateTests
| } | ||
| store.Load() | ||
|
|
||
| if len(store.Templates()) > 1 && r.options.AutogenerateTests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also check whether the given template is http or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge conflict
|
bump |
Proposed changes
Closes #4996
Added automated http protocol test generation by using a proxy (embedded proxify).
Added two new flags -
-agt, -autogenerate-tests enable autogeneration of nuclei test-cases (http only now) -rts, -run-tests run generated nuclei test-casesTo generate a test case, use the below command -
./nuclei -id CVE-2017-12615 -agt -u http://localhost:8080 11:17:57 PM __ _ ____ __ _______/ /__ (_) / __ \/ / / / ___/ / _ \/ / / / / / /_/ / /__/ / __/ / /_/ /_/\__,_/\___/_/\___/_/ v3.2.3 projectdiscovery.io [INF] Using 127.0.0.1:53932 as proxy server for automatic test-generation [INF] Current nuclei version: v3.2.3 (latest) [INF] Current nuclei-templates version: v9.8.1 (latest) [WRN] Scan results upload to cloud is disabled. [INF] New templates added in latest release: 77 [INF] Templates loaded for current scan: 1 [INF] Executing 1 signed templates from projectdiscovery/nuclei-templates [INF] Targets loaded for current scan: 1 [CVE-2017-12615] [http] [high] http://localhost:8080/poc.jsp?cmd=cat+%2Fetc%2Fpasswd [INF] Writing test template=CVE-2017-12615 and target=http://localhost:8080 to CVE-2017-12615.yaml.nuclei_testThis writes a file in the same directory as template with
.nuclei_testextension.Example -
This supports interactsh, multi-step requests etc as well. The mocking is done entirely locally.
To run the pre-generated test, run it as below
Checklist