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

cli: link to rule names to capa rules website #2338

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

williballenthin
Copy link
Collaborator

@williballenthin williballenthin commented Aug 27, 2024

closes #2337
closes #2319

Add modern terminal markup to hyperlink to resources on the web, like entries on the capa rules website.

To make this possible, use rich instead of tabulate to render tables.

image

Also update the canonical path to rules on the website, to: mandiant.github.io/rules/[rule name]/

Using the rule name from the rule header makes it very easy to generate links to the web pages, rather than using the filename of the rule.

image

Checklist

  • No CHANGELOG update needed
  • No new tests needed
  • No documentation update needed

@williballenthin williballenthin added the enhancement New feature or request label Aug 27, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Please add bug fixes, new features, breaking changes and anything else you think is worthwhile mentioning to the master (unreleased) section of CHANGELOG.md. If no CHANGELOG update is needed add the following to the PR description: [x] No CHANGELOG update needed

@mr-tz
Copy link
Collaborator

mr-tz commented Aug 27, 2024

related: #2100

@williballenthin
Copy link
Collaborator Author

it was really easy to use rich instead of tabulate. i thought there'd be more work but the switch should be painless.

@williballenthin

This comment was marked as resolved.

@williballenthin williballenthin force-pushed the feat/cli-links branch 2 times, most recently from 7c2291e to 8ed32ef Compare August 29, 2024 10:49
@github-actions github-actions bot dismissed their stale review August 29, 2024 10:49

CHANGELOG updated or no update needed, thanks! 😄

@williballenthin williballenthin force-pushed the feat/cli-links branch 2 times, most recently from cdf02ba to 838dd3d Compare August 29, 2024 10:57
@williballenthin williballenthin marked this pull request as ready for review August 29, 2024 10:57
@williballenthin
Copy link
Collaborator Author

I've migrated default rendering to rich. It worked well, and I think we can migrate the other renderers, too. But, I'd propose we all try out this PR for a little bit, and if it works, then update the other renderers.

Copy link
Collaborator

@mr-tz mr-tz left a comment

Choose a reason for hiding this comment

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

looks great, thank you!

web/public/index.html Outdated Show resolved Hide resolved
Copy link
Collaborator

@fariss fariss left a comment

Choose a reason for hiding this comment

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

Great, this works in my terminal emulator.
Thanks!

web/explorer/src/utils/urlHelpers.js Show resolved Hide resolved
capa/render/default.py Show resolved Hide resolved
@williballenthin williballenthin merged commit 729a1a8 into mandiant:master Aug 29, 2024
26 checks passed
@williballenthin williballenthin deleted the feat/cli-links branch August 29, 2024 15:07
@fariss
Copy link
Collaborator

fariss commented Aug 29, 2024

@williballenthin I think you have forgotten to omit tag from the createCapaRulesUrl(node, tag).
I also missed it in the second review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add links from CLI output to capa rules website rule app: generate redirects for non-normalized rule names
5 participants