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

Display tpl contents #2906

Merged
merged 5 commits into from Nov 29, 2022
Merged

Display tpl contents #2906

merged 5 commits into from Nov 29, 2022

Conversation

vzamanillo
Copy link
Contributor

@vzamanillo vzamanillo commented Nov 24, 2022

Implements #2827

Proposed changes

  • New td flag to display the highlighted template contents in combination with tl

imagen

  • Sorted template list by path

imagen

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)

Víctor Zamanillo added 3 commits November 24, 2022 23:33
New verboseTemplate method to avoid duplicate code
Grouped (and sorted) template list per directory
The new one can't be pipelined
@ehsandeep ehsandeep linked an issue Nov 26, 2022 that may be closed by this pull request
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.

@vzamanillo thank you for working on this, few suggestions -

  • enable -tl option when -td option is used implicitly.
  • respect -no-color option to disable colors when -td is used.

Respect --no-color option to disable colors when -td is used
@vzamanillo
Copy link
Contributor Author

  • enable -tl option when -td option is used implicitly.
  • respect -no-color option to disable colors when -td is used.

@vzamanillo
Copy link
Contributor Author

By the way, I chose monokai as the default style to show the content of the template, if you think it's not the right one or you prefer another one, we have time to change it, you can try em here Chroma Playground

I have not thought about the option of being able to change it by command line, but it can also be done.

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.

./nuclei -id tls-version -silent -td
Template: /Users/geekboy/nuclei-templates/ssl/tls-version.yaml

id: tls-version

info:
  name: TLS Version
  author: pdteam
  severity: info
  tags: ssl

ssl:
  - address: "{{Host}}:{{Port}}"

    extractors:
      - type: json
        json:
          - ".tls_version"

@forgedhallpass
Copy link
Contributor

The -td flag could also accept an optional int parameter to only show a specific number of lines in case you want to look up the descriptions of multiple templates (as shown in the first screenshot in the ticket).

@vzamanillo
Copy link
Contributor Author

vzamanillo commented Nov 28, 2022

The -td flag could also accept an optional int parameter to only show a specific number of lines in case you want to look up the descriptions of multiple templates (as shown in the first screenshot in the ticket).

Yep, forgot that.

You mean using an optional integer value of td or a new one in combination with td,? e.g: nl (number of lines)

@vzamanillo
Copy link
Contributor Author

I see, there is no optional value flags for goflags

projectdiscovery/goflags#11

@forgedhallpass
Copy link
Contributor

@vzamanillo yes, you are right, I forgot that it wasn't yet implemented.

In this case you can either:

  1. leave it as-is and post a comment in the goflags ticket with the follow-up work
  2. require a number from start where anything <= 0 would mean "show the whole content", otherwise the parameter should indicate the desired amount of template lines

@vzamanillo
Copy link
Contributor Author

@forgedhallpass I am going to investigate how to add the optional flags, it is the optimal solution.

@ehsandeep
Copy link
Member

@vzamanillo, we can adapt the changes once projectdiscovery/goflags#11 is implemented.

@ehsandeep ehsandeep merged commit 9c17284 into projectdiscovery:dev Nov 29, 2022
@vzamanillo vzamanillo deleted the display-tpl-contents branch December 7, 2022 08:12
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 option to display the contents of a template
4 participants