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

[feature] Add feature to remove timestamp from results #911

Closed
Tedixx opened this issue Aug 6, 2021 · 11 comments
Closed

[feature] Add feature to remove timestamp from results #911

Tedixx opened this issue Aug 6, 2021 · 11 comments
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Enhancement Most issues will probably ask for additions or changes.
Projects

Comments

@Tedixx
Copy link

Tedixx commented Aug 6, 2021

Is your feature request related to a problem? Please describe.
Due to the timestamp, it is hard to sort unique vulnerabilities, e.g. with anew.

Describe the solution you'd like
Add flag -no-timestamp flag to remove the timestamp from output

@geeknik
Copy link
Contributor

geeknik commented Aug 6, 2021

Just in case it takes a few cycles for them to pick up this request, this is an easy post-process fix:

cat nuclei-output | sed -r 's/\[[0-9]{1,10}:[0-9]{2}:[0-9]{2}\]//' | anew

Good luck out there! \m/

@Tedixx
Copy link
Author

Tedixx commented Aug 7, 2021

Just in case it takes a few cycles for them to pick up this request, this is an easy post-process fix:

cat nuclei-output | sed -r 's/\[[0-9]{1,10}:[0-9]{2}:[0-9]{2}\]//' | anew

Good luck out there! \m/

Thanks for your comment! However, while using this command, the output still remains with the timestamp (and causes anew to fail)

@ehsandeep ehsandeep added the Type: Enhancement Most issues will probably ask for additions or changes. label Aug 7, 2021
@geeknik
Copy link
Contributor

geeknik commented Aug 7, 2021

Thanks for your comment! However, while using this command, the output still remains with the timestamp (and causes anew to fail)

Yeah, that's my bad, I failed to take into account the date in the timestamp, try this instead:

sed -r 's/\[[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{1,10}:[0-9]{2}:[0-9]{2}\]//'

@forgedhallpass
Copy link
Contributor

forgedhallpass commented Aug 8, 2021

Hello @Tedixx,

This can be achieved easily in multiple ways. One would be what @geeknik showed, but the easiest is probably to use:
cat nuclei-putput | sort -k 3 # sort based on the 3rd column (default separator is the space character
cat nuclei-ouput | cut -f 3- -d' ' | sort # only shows columns starting from the 3rd column until the end, where the delimiter is a space character
cat nuclei-ouput | awk '{for(i=3;i<=NF;i++)printf $i""FS; print ""}' | sort # awk removes the first 2 columns, then sorts the result

Example outputs:

$ cat nucleiOutput-14.txt
[2021-06-16 19:16:22] [wordpress-directory-listing] [http] [info] http://localhost/wp-includes/
[2021-06-16 19:16:26] [tech-detect:wordpress] [http] [info] http://localhost
[2021-06-16 19:16:26] [tech-detect:apache] [http] [info] http://localhost
[2021-06-16 19:16:26] [tech-detect:php] [http] [info] http://localhost
[2021-06-16 19:16:30] [wp-license-file] [http] [info] http://localhost/license.txt

$ cat nucleiOutput-14.txt | sort -k3
[2021-06-16 19:16:26] [tech-detect:apache] [http] [info] http://localhost
[2021-06-16 19:16:26] [tech-detect:php] [http] [info] http://localhost
[2021-06-16 19:16:26] [tech-detect:wordpress] [http] [info] http://localhost
[2021-06-16 19:16:22] [wordpress-directory-listing] [http] [info] http://localhost/wp-includes/
[2021-06-16 19:16:30] [wp-license-file] [http] [info] http://localhost/license.txt

$ cat nucleiOutput-14.txt | cut -f 3- -d' ' | sort
[tech-detect:apache] [http] [info] http://localhost
[tech-detect:php] [http] [info] http://localhost
[tech-detect:wordpress] [http] [info] http://localhost
[wordpress-directory-listing] [http] [info] http://localhost/wp-includes/
[wp-license-file] [http] [info] http://localhost/license.txt
admin@ip-172-31-14-91:/var/lib/jenkins/workspace/test-maste

In my opinion it does not worth adding a new flag to achieve this.

@forgedhallpass forgedhallpass added the Type: Discussion Some ideas need to be planned and disucssed to come to a strategy. label Aug 8, 2021
@Tedixx
Copy link
Author

Tedixx commented Aug 8, 2021

Thanks for your feedback @geeknik and @forgedhallpass . Your commands are helpful and get most of the job done. However, I still feel like the -no-timestamp command is needed due to the following reasons;

  1. Ease of use; nuclei is a flexible tool which allows to search for vulnerabilities quickly and easy. The -no-timestamp command will help users to automate their workflow (e.g. /w anew), without the hassle of using regex/awk/cut.
  2. Minimizing errors: The output of nuclei templates changes continiously, which could cause regex/awl/cut to fail. For example; I've used your ack command to parse a large nuclei result list. I've encountered this error;
awk: cmd. line:1: (FILENAME=- FNR=81) fatal: not enough arguments to satisfy format string
        `https://sub.example.com/%c0 '
                                      ^ ran out for this one

This caused that only half of my results were being shown. By introducing a -no-timestamp flag, this error could have been prevented.

In my opinion, those two reasons show it is worth adding a new flag.

@forgedhallpass
Copy link
Contributor

As mentioned in my previous comment, the easiest way is just to use sort -k3 or use cut -f 3- -d' '. Adding CLI flags for every little thing would very rapidly become unsustainable. A better option in this case would rather be to let a logger pattern control the output from within the configuration file, so then you could define your output structure the way you want. For example something like: [%yyyy-%MM-%dd %HH:%mm:%ss] [%tid] [%proto] %url

p.s. I'd like to take a look at an anonymized outputfile of yours to figure out what the actual problem with my awk comment was...just for the sake of curiousity.

@ehsandeep
Copy link
Member

It looks like the timestamp information was intended to add into JSON output only - #468 as such we can also consider to remove this information from CLI output to make it automation friendly.

@geeknik
Copy link
Contributor

geeknik commented Aug 8, 2021

It looks like the timestamp information was intended to add into JSON output only - #468 as such we can also consider to remove this information from CLI output to make it automation friendly.

I hope that means a -no-time or -timestamp flag as we specifically requested the time stamp for CLI output in addition to the JSON output. 👍🏻

@Tedixx
Copy link
Author

Tedixx commented Aug 9, 2021

In my opinion, every command would do, as long as nuclei prints output without timestamp (and no additional command is needed). A config approach like [%yyyy-%MM-%dd %HH:%mm:%ss] [%tid] [%proto] %url seems like a fair solution, which also allows further modification for automation. But also I'm quite font of -no-time or -timestamp due the ease of use.

@forgedhallpass I will send you the output file later today/tomorrow.

@ehsandeep ehsandeep added Status: Completed Nothing further to be done with this issue. Awaiting to be closed. and removed Type: Discussion Some ideas need to be planned and disucssed to come to a strategy. labels Aug 29, 2021
@ehsandeep
Copy link
Member

@Tedixx This flag has been added to disable printing time-stamp information to CLI here b7e3eec, we are also considering having a single CLI flag in the future that can define/control all the information gets printed to CLI, so in that way, users can have complete control over all the fields printed to CLI.

@ehsandeep ehsandeep added this to Done in v2.5.0 Aug 31, 2021
@Tedixx
Copy link
Author

Tedixx commented Sep 4, 2021

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Enhancement Most issues will probably ask for additions or changes.
Projects
No open projects
Development

No branches or pull requests

4 participants