pdfalyzer 1.16.1__tar.gz → 1.16.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/CHANGELOG.md +6 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/PKG-INFO +1 -1
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/helpers/filesystem_helper.py +3 -3
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/helpers/rich_text_helper.py +2 -3
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/util/argument_parser.py +3 -3
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/yara_rules/PDF.yara +31 -2
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pyproject.toml +1 -1
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/LICENSE +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/README.md +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/__init__.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/__main__.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/binary/binary_scanner.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/config.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/decorators/document_model_printer.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/decorators/indeterminate_node.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/decorators/pdf_object_properties.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/decorators/pdf_tree_node.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/decorators/pdf_tree_verifier.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/detection/constants/binary_regexes.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/detection/constants/javascript_reserved_keywords.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/detection/javascript_hunter.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/detection/yaralyzer_helper.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/font_info.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/helpers/dict_helper.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/helpers/number_helper.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/helpers/pdf_object_helper.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/helpers/string_helper.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/output/character_mapping.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/output/layout.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/output/pdfalyzer_presenter.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/output/styles/node_colors.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/output/styles/rich_theme.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/output/tables/decoding_stats_table.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/output/tables/font_summary_table.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/output/tables/pdf_node_rich_table.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/output/tables/stream_objects_table.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/pdf_object_relationship.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/pdfalyzer.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/util/adobe_strings.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/util/debugging.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/util/exceptions.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/util/pdf_parser_manager.py +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/yara_rules/PDF_binary_stream.yara +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/yara_rules/__init.py__ +0 -0
- {pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/yara_rules/lprat.static_file_analysis.yara +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pdfalyzer
|
|
3
|
-
Version: 1.16.
|
|
3
|
+
Version: 1.16.3
|
|
4
4
|
Summary: 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.
|
|
5
5
|
Home-page: https://github.com/michelcrypt4d4mus/pdfalyzer
|
|
6
6
|
License: GPL-3.0-or-later
|
|
@@ -3,7 +3,7 @@ Some helpers for stuff with the local filesystem.
|
|
|
3
3
|
"""
|
|
4
4
|
import re
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Union
|
|
6
|
+
from typing import Optional, Union
|
|
7
7
|
|
|
8
8
|
from yaralyzer.output.rich_console import console
|
|
9
9
|
|
|
@@ -45,7 +45,7 @@ def do_all_files_exist(file_paths: list[Union[str, Path]]) -> bool:
|
|
|
45
45
|
return all_files_exist
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
def extract_page_number(file_path: Union[str, Path]) -> int
|
|
48
|
+
def extract_page_number(file_path: Union[str, Path]) -> Optional[int]:
|
|
49
49
|
"""Extract the page number from the end of a filename if it exists."""
|
|
50
50
|
match = NUMBERED_PAGE_REGEX.match(str(file_path))
|
|
51
51
|
return int(match.group(1)) if match else None
|
|
@@ -56,7 +56,7 @@ def file_size_in_mb(file_path: Union[str, Path], decimal_places: int = 2) -> flo
|
|
|
56
56
|
return round(Path(file_path).stat().st_size / 1024.0 / 1024.0, decimal_places)
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
def set_max_open_files(num_filehandles: int = DEFAULT_MAX_OPEN_FILES) -> tuple[int
|
|
59
|
+
def set_max_open_files(num_filehandles: int = DEFAULT_MAX_OPEN_FILES) -> tuple[Optional[int], Optional[int]]:
|
|
60
60
|
"""
|
|
61
61
|
Sets the OS level max open files to at least 'num_filehandles'. Current value can be seen with 'ulimit -a'.
|
|
62
62
|
Required when you might be opening more than DEFAULT_MAX_OPEN_FILES file handles simultaneously
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Functions for miscellaneous Rich text/string operations.
|
|
3
3
|
"""
|
|
4
|
-
from
|
|
5
|
-
from typing import List
|
|
4
|
+
from typing import List, Union
|
|
6
5
|
|
|
7
6
|
from pypdf.generic import PdfObject
|
|
8
7
|
from rich.console import Console
|
|
@@ -17,7 +16,7 @@ from pdfalyzer.output.styles.node_colors import get_label_style, get_class_style
|
|
|
17
16
|
pdfalyzer_console = Console(color_system='256')
|
|
18
17
|
|
|
19
18
|
|
|
20
|
-
def print_highlighted(msg: str
|
|
19
|
+
def print_highlighted(msg: Union[str, Text], **kwargs) -> None:
|
|
21
20
|
"""Print 'msg' with Rich highlighting."""
|
|
22
21
|
pdfalyzer_console.print(msg, highlight=True, **kwargs)
|
|
23
22
|
|
|
@@ -4,7 +4,7 @@ from collections import namedtuple
|
|
|
4
4
|
from functools import partial, update_wrapper
|
|
5
5
|
from importlib.metadata import version
|
|
6
6
|
from os import getcwd, path
|
|
7
|
-
from typing import List
|
|
7
|
+
from typing import List, Optional
|
|
8
8
|
|
|
9
9
|
from rich_argparse_plus import RichHelpFormatterPlus
|
|
10
10
|
from rich.prompt import Confirm
|
|
@@ -80,7 +80,7 @@ select.add_argument('-r', '--rich', action='store_true',
|
|
|
80
80
|
help='show much larger / more detailed tree visualization (one row per PDF object property)')
|
|
81
81
|
|
|
82
82
|
select.add_argument('-f', '--fonts', action='store_true',
|
|
83
|
-
help="show info about fonts
|
|
83
|
+
help="show info about fonts including character mappings for embedded font binaries")
|
|
84
84
|
|
|
85
85
|
select.add_argument('-y', '--yara', action='store_true',
|
|
86
86
|
help="scan the PDF with the included malicious PDF YARA rules and/or your custom YARA rules")
|
|
@@ -254,7 +254,7 @@ def ask_to_proceed() -> None:
|
|
|
254
254
|
exit_with_error()
|
|
255
255
|
|
|
256
256
|
|
|
257
|
-
def exit_with_error(error_message: str
|
|
257
|
+
def exit_with_error(error_message: Optional[str] = None) -> None:
|
|
258
258
|
"""Print 'error_message' and exit with status code 1."""
|
|
259
259
|
if error_message:
|
|
260
260
|
print_highlighted(Text('').append('ERROR', style='bold red').append(f': {error_message}'))
|
|
@@ -1030,17 +1030,46 @@ rule malware_MaldocinPDF {
|
|
|
1030
1030
|
labs_reference = "N/A"
|
|
1031
1031
|
labs_pivot = "N/A"
|
|
1032
1032
|
samples = "ef59d7038cfd565fd65bae12588810d5361df938244ebad33b71882dcf683058"
|
|
1033
|
-
|
|
1034
1033
|
strings:
|
|
1035
1034
|
$docfile2 = "<w:WordDocument>" ascii nocase
|
|
1036
1035
|
$xlsfile2 = "<x:ExcelWorkbook>" ascii nocase
|
|
1037
1036
|
$mhtfile0 = "mime" ascii nocase
|
|
1038
1037
|
$mhtfile1 = "content-location:" ascii nocase
|
|
1039
1038
|
$mhtfile2 = "content-type:" ascii nocase
|
|
1040
|
-
|
|
1041
1039
|
condition:
|
|
1042
1040
|
(uint32(0) == 0x46445025) and
|
|
1043
1041
|
(1 of ($mhtfile*)) and
|
|
1044
1042
|
( (1 of ($docfile*)) or
|
|
1045
1043
|
(1 of ($xlsfile*)) )
|
|
1046
1044
|
}
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
rule EXPLOIT_PDFJS_CVE_2024_4367 {
|
|
1048
|
+
meta:
|
|
1049
|
+
description = "Detects PDFs that exploit CVE-2024-4367"
|
|
1050
|
+
author = "spaceraccoon, Eugene Lim"
|
|
1051
|
+
blog_reference = "https://codeanlabs.com/blog/research/cve-2024-4367-arbitrary-js-execution-in-pdf-js/"
|
|
1052
|
+
reference = "https://github.com/spaceraccoon/detect-cve-2024-4367"
|
|
1053
|
+
date = "2024-05-23"
|
|
1054
|
+
modified = "2024-05-23"
|
|
1055
|
+
score = 75
|
|
1056
|
+
id = "bb000216-17b5-41eb-a144-2982131fbf45"
|
|
1057
|
+
strings:
|
|
1058
|
+
$re1 = /\/FontMatrix\s+\[\.\-\d\s]*\(/
|
|
1059
|
+
condition:
|
|
1060
|
+
any of them
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
rule QakbotPDF {
|
|
1065
|
+
meta:
|
|
1066
|
+
description = "This is a rule to detect Qakbot"
|
|
1067
|
+
hash = "ce0b6e49d017a570bdaa463e51893014a7378fb4586e33fabbc6c4832c355663"
|
|
1068
|
+
filename = "Necessitatibus.pdf"
|
|
1069
|
+
author = "Motawkkel Abdulrhman AKA RY0D4N"
|
|
1070
|
+
reference = "https://github.com/xRY0D4N/Yara-Rules/blob/main/Qakbot/rule.yar"
|
|
1071
|
+
strings:
|
|
1072
|
+
$url = "/URI (http://gurtek.com.tr/exi/exi.php)" nocase ascii wide
|
|
1073
|
+
condition:
|
|
1074
|
+
$url
|
|
1075
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pdfalyzer"
|
|
3
|
-
version = "1.16.
|
|
3
|
+
version = "1.16.3"
|
|
4
4
|
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."
|
|
5
5
|
authors = ["Michel de Cryptadamus <michel@cryptadamus.com>"]
|
|
6
6
|
license = "GPL-3.0-or-later"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdfalyzer-1.16.1 → pdfalyzer-1.16.3}/pdfalyzer/detection/constants/javascript_reserved_keywords.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|