pwndoc / pwndoc

Pentest Report Generator
https://pwndoc.github.io/pwndoc
MIT License
2.29k stars 424 forks source link

Styling Code Snippets & Command Output #333

Open nitek29 opened 2 years ago

nitek29 commented 2 years ago

Hey,

It will be great if we can somehow mark/style parts of text in a command output or source snippet so they can stand out. Ideally, we can either bold them, change their color, or distinguish them in another way. The problem is that it is not possible to format the text in the code and code block styles in the UI. For example, highlighting the vulnerable header in an HTTP request. It's not a question of style functionnality in the .docx template. Whatever is easier to implement, I am sure we can get it to work.

Thanks!

yeln4ts commented 2 years ago

This is because code blocks in the application will result in a specific style in Word document. It would be possible to add syntax highlighting in the application but it won't be added in the generated report. So to be coherent between both the application and the report it was not added.

nitek29 commented 2 years ago

Thank for your reply. In this case, is it not possible to update the style in Word document too ?

yeln4ts commented 2 years ago

I did not find a way to do that easily. Also the fact that the application is common to everyone and the Word document is specific to everyone makes it too complex to maintain consistency across everyone

mrnfrancesco commented 2 years ago

Hi @yeln4ts, I get your point on adding code styling in pwndoc and using the document's styles is a good idea. Unfortunately it is not supported by google docs (it natively supports just normal text and headings from h1 to h6). This lead to code not be styled at all.

Considering the widespread of using google services, is there any chance you can reconsider the option to add some sort of styling directly in the app?

Even something default like Consolas font, white text, black background should be fine. In this way who use word and the defined code style will continue to see the code using the defined style, who do not use word will see something that at least looks like code instead of normal text.

yeln4ts commented 2 years ago

There already is a style in the application for code blocks and code. image

mrnfrancesco commented 2 years ago

Yeah, sure. Unfortunately those two apply a style in the docx based on a style. In case you use Google docs such style doesn't exists and the code is just formatted as normal text.

yeln4ts commented 2 years ago

I don't think there is any solution to your issue then if Google docs does not apply styles.

nitek29 commented 2 years ago

@mrnfrancesco Use table or paragraph with border instead of the codeblock style can be a solution. What do you thing about that ?

mrnfrancesco commented 2 years ago

Using a table/paragraph with borders make easier to isolate the code to the other text, but it still need at least a monospace font to render correctly.

For me the correct solution to match everyone needs is to use syntax highlight or any other code formatting directly as HTML in the app without using a document style. Basically the same that happens when you copy/paste code from VSCode into Word.

nitek29 commented 1 year ago

FYI #355