-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: added auto proxy based test generation for templates #5014
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
@@ -415,6 +415,11 @@ on extensive configurability, massive extensibility and ease of use.`) | |||
flagSet.BoolVarP(&options.PreFetchSecrets, "prefetch-secrets", "ps", false, "prefetch secrets from the secrets file"), | |||
) | |||
|
|||
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
@@ -508,6 +513,14 @@ func (r *Runner) RunEnumeration() error { | |||
return nil // exit | |||
} | |||
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
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-cases
To generate a test case, use the below command -
This writes a file in the same directory as template with
.nuclei_test
extension.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