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

Add error log option #1204

Merged
merged 7 commits into from
Oct 30, 2021
Merged

Conversation

zerodivisi0n
Copy link
Contributor

@zerodivisi0n zerodivisi0n commented Oct 30, 2021

Proposed changes

Implements error log feature (#1187)

Original issue checklist:

  • Updating id to template-path to include template path information instead of id (933ed24, 463c1c0)
  • Updating url JSON field input to make it uniform for all types of template (933ed24)
  • Updating HTTP and FILE type error to include only final error information (1eb0378)

Differences from the original issue:

  • The absolute path to the template is displayed, not the relative path as in the example. Does this need to be fixed?
  • I made the original error message for all protocols since it can be done uniformly in one place. Also, I am doing recursive Unwrap to get the last wrapped error. I don't know how bad it is.
  • I also did some refactoring to improve the testability of outputs. This is done in the last three commits (cd2db28, b8ebbc2, bccc8e9). If it's unnecessary, I can remove it.

Example of output:

$ echo "https://exxmple.com/tcpconfig.html" | ./nuclei -t misconfiguration/tcpconfig.yaml -error-log error.log
$ cat error.log | jq                                                                                                               
{
  "template": "/home/zerodivisi0n/nuclei-templates/misconfiguration/tcpconfig.yaml",
  "input": "https://exxmple.com/tcpconfig.html/tcpconfig.html",
  "error": "no address found for host",
  "type": "http"
}

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)

@ehsandeep ehsandeep linked an issue Oct 30, 2021 that may be closed by this pull request
3 tasks
Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

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

Everything working well as described in the issue @zerodivisi0n 👏🏻

@ehsandeep ehsandeep added the Status: Review Needed The issue has a PR attached to it which needs to be reviewed label Oct 30, 2021
Copy link
Member

@Ice3man543 Ice3man543 left a comment

Choose a reason for hiding this comment

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

The PR looks good to me, very nice work @zerodivisi0n!

@ehsandeep ehsandeep added hacktoberfest-accepted and removed Status: Review Needed The issue has a PR attached to it which needs to be reviewed labels Oct 30, 2021
@Ice3man543
Copy link
Member

Regarding showing absolute paths, i guess it's okay for us to show absolute paths since those would be easy to open through the error log. Also unwrapping like that is the accepted way of getting the last error, so It shouldn't be an issue.
The tests for output layer also can be merged!

@zerodivisi0n
Copy link
Contributor Author

@ehsandeep , @Ice3man543 , great! Thanks for the quick review!

@ehsandeep ehsandeep merged commit c1cd04f into projectdiscovery:dev Oct 30, 2021
@ehsandeep ehsandeep linked an issue Oct 30, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to write scan error logs to file Report hosts that errored out
3 participants