noraj / OSCP-Exam-Report-Template-Markdown

:orange_book: Markdown Templates for Offensive Security OSCP, OSWE, OSCE, OSEE, OSWP exam report
https://noraj.github.io/OSCP-Exam-Report-Template-Markdown/
MIT License
3.56k stars 752 forks source link

Error generating PDF with random backslash characters inside of markdown file #58

Closed un4gi closed 3 weeks ago

un4gi commented 3 weeks ago

When attempting to generate the PDF, I noticed several areas with \ characters are causing issues with generation.

For example, if the markdown file contains NT AUTHORITY\SYSTEM, I receive the following error on generation:

[+] Generating report...
Error producing PDF.
! Undefined control sequence.
l.481 NT AUTHORITY\SYSTEM

Changing the \ to / or escaping it with \ seems to fix the issue, but there are some instances where those changes may make the information in the report inaccurate. Just curious how others handle this?

1core0 commented 3 weeks ago

For such things, use quotation or code blocks. The error message indicates an error message generated by TeX, not the script itself as the backslash are reserved characters, see here: https://en.wikibooks.org/wiki/TeX/definition/control_sequence#:~:text=A%20control%20sequence%20in%20TeX,to%20form%20a%20control%20symbol.

noraj commented 3 weeks ago

Issue

Raw unescaped \

---
title: "Offensive Security Certified Expert Exam Report"
author: ["student@youremailaddress.com", "OSID: XXXX"]
date: "2020-07-25"
subject: "Markdown"
keywords: [Markdown, Example]
subtitle: "OSCE Exam Report"
lang: "en"
titlepage: true
titlepage-color: "483D8B"
titlepage-text-color: "FFFAFA"
titlepage-rule-color: "FFFAFA"
titlepage-rule-height: 2
book: true
classoption: oneside
code-block-font-size: \scriptsize
---

I am NT AUTHORITY\SYSTEM
➜ pandoc test.md -o test.pdf --from markdown+yaml_metadata_block+raw_html --template eisvogel
Error producing PDF.
! Undefined control sequence.
l.314 I am NT AUTHORITY\SYSTEM

No issue

Unescaped \ in inline code or code block:

---
title: "Offensive Security Certified Expert Exam Report"
author: ["student@youremailaddress.com", "OSID: XXXX"]
date: "2020-07-25"
subject: "Markdown"
keywords: [Markdown, Example]
subtitle: "OSCE Exam Report"
lang: "en"
titlepage: true
titlepage-color: "483D8B"
titlepage-text-color: "FFFAFA"
titlepage-rule-color: "FFFAFA"
titlepage-rule-height: 2
book: true
classoption: oneside
code-block-font-size: \scriptsize
---

I am NT `AUTHORITY\SYSTEM`

```
AUTHORITY\SYSTEM
```
➜ pandoc test.md -o test.pdf --from markdown+yaml_metadata_block+raw_html --template eisvogel

No issue alternative

Raw escaped \:

---
title: "Offensive Security Certified Expert Exam Report"
author: ["student@youremailaddress.com", "OSID: XXXX"]
date: "2020-07-25"
subject: "Markdown"
keywords: [Markdown, Example]
subtitle: "OSCE Exam Report"
lang: "en"
titlepage: true
titlepage-color: "483D8B"
titlepage-text-color: "FFFAFA"
titlepage-rule-color: "FFFAFA"
titlepage-rule-height: 2
book: true
classoption: oneside
code-block-font-size: \scriptsize
---

I am NT AUTHORITY\\SYSTEM
➜ pandoc test.md -o test.pdf --from markdown+yaml_metadata_block+raw_html --template eisvogel
noraj commented 3 weeks ago

I documented it in the FAQ.