mandiant / capa

The FLARE team's open-source tool to identify capabilities in executable files.
https://mandiant.github.io/capa/
Apache License 2.0
4.09k stars 512 forks source link

add links from CLI output to capa rules website #2337

Closed williballenthin closed 2 weeks ago

williballenthin commented 3 weeks ago

we can use a modern terminal feature to make some text a link to a URL, such as described here: https://www.willmcgugan.com/blog/tech/post/real-working-hyperlinks-in-the-terminal-with-rich/

So, for example, each rule name in the default output could be a link to the rules website, showing the rule content.

I think that for terminals that don't support this feature, the link degrades to text, just like is shown today.

The rich library that we use for rendering already has a link feature that we can use here.

williballenthin commented 3 weeks ago

other places:

williballenthin commented 3 weeks ago

image

williballenthin commented 3 weeks ago

but when combining with color characters, tabulate (i think) gets confused about the cell width:

image

we may need to migrate to rich to build the tables or hack around a bit.

williballenthin commented 3 weeks ago

image

s-ff commented 3 weeks ago

Does this feature work with all terminal emulators? I imagine only modern consoles supporting this EDIT: If unsupported consoles display normally (i.e. the output remains unaffected), this would be a great addition

williballenthin commented 3 weeks ago

Yeah, when unsupported, then the text falls back to how it's shown today. And I don't think there's logic that does this - the terminal emulator just ignores the control codes it doesn't understand.

williballenthin commented 3 weeks ago

It doesn't work under tmux but does under zellij and xterm. i can test Windows Thermal Terminal later today.