Skip to content

Commit

Permalink
Fix infinite loop when printing certain charmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
ashariyar committed Oct 18, 2022
1 parent c2cd82e commit de453cd
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# NEXT RELEASE

### 1.13.2

### 1.13.1
* Add **all** the possible PDF internal commands that can lead to JavaScript execution or local/remote command exection to `DANGEROUS_PDF_KEYS` list.

Expand Down
Binary file modified doc/svgs/rendered_images/pdfalyze_help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pdfalyzer/helpers/rich_text_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def quoted_text(
) -> Text:
"""Wrap _string in 'quote_char'. Style 'quote_char' with 'quote_char_style'."""
quote_char_txt = Text(quote_char, style=quote_char_style)
txt = quote_char_txt.append(_string, style=style).append_text(quote_char_txt)
txt = quote_char_txt + Text(_string, style=style) + quote_char_txt
txt.justify = 'center'
return txt

Expand Down
1 change: 1 addition & 0 deletions pdfalyzer/yara_rules/PDF.yara
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "math"
// meta:
// author = "Jaume Martin"
// description = "Matches '%PDF' to '%%EOF'. Works even on raw bytes (e.g. raw dd image of a drive)"
// reference = "https://github.com/Xumeiquer/yara-forensics/blob/bccefe4bac824956cd0694b6681a2d555bf6b0fe/raw/pdf.yar"

// strings:
// $pdf_start = {25 50 44 46}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pdfalyzer"
version = "1.13.1"
version = "1.13.2"
description = "A PDF analysis toolkit. Scan a PDF with relevant YARA rules, visualize its inner tree-like data structure in living color (lots of colors), force decodes of suspicious font binaries, and more."
authors = ["Michel de Cryptadamus <michel@cryptadamus.com>"]
license = "GPL-3.0-or-later"
Expand Down
2 changes: 1 addition & 1 deletion scripts/test_against_all_pdfs_in_Documents_folder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pdfalyze_doc() {
return
fi

cmd="$PDFALYZER_EXECUTABLE -r -t -d \"$pdf_full_path\""
cmd="$PDFALYZER_EXECUTABLE -f -t \"$pdf_full_path\""
echo -e "\nCommand to run: $cmd"

eval $cmd
Expand Down
8 changes: 8 additions & 0 deletions tests/pdfalyzer/helpers/test_rich_text_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from rich.text import Text

from pdfalyzer.helpers.rich_text_helper import quoted_text


def test_quoted_text():
assert quoted_text('xyz').plain == "'xyz'"
assert quoted_text('-1', quote_char='"').plain == '"-1"'

0 comments on commit de453cd

Please sign in to comment.