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

issue 5212 timeout added to trace and error logs using ts switch #5292

Conversation

oscarintherocks
Copy link
Contributor

Proposed changes

Enhance proposed in issue #5212
Added Timestamp field to both trace log and error log only if -ts switch is enabled

Before this PR, trace log and error log look like:
nuclei -tlog t1.log -tags postgresql -u https://www.example.com -elog e1.log -ts
{"template":"pgsql-extensions-rce","type":"javascript","input":"www.example.com:5432","address":"www.example.com:5432","error":"port closed or filtered","kind":"network-permanent-error"}

After the PR, using -ts switch:
nuclei -tlog t1.log -tags postgresql -u https://www.example.com -elog e1.log -ts
{"template":"pgsql-extensions-rce","type":"javascript","input":"www.example.com:5432","timestamp":"2024-06-14T17:47:05.3112785+02:00","address":"www.example.com:5432","error":"port closed or filtered","kind":"network-permanent-error"}

Without -ts switch, trace and error log don't include timestamp field

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)

@oscarintherocks
Copy link
Contributor Author

if you guide me I can create unit tests. It's only 2 checks:

  • execute nuclei with -tlog and -ts and check if trace file contains the keyword "timestamp"
  • execute nuclei with -tlog but without -ts and check if trace file doesn't contain the keyword "timestamp"

@tarunKoyalwar tarunKoyalwar self-requested a review June 14, 2024 16:35
Copy link
Member

@tarunKoyalwar tarunKoyalwar 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 think we can skip unit test for this , since the logic is very simple and straightforward

@ehsandeep ehsandeep merged commit baf7e36 into projectdiscovery:dev Jun 14, 2024
12 checks passed
@oscarintherocks oscarintherocks deleted the issue-5212-add-timestamp-to-trace-error-logs branch June 15, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add timestamp to error-log and trace-log json files
3 participants