pdfalyzer 1.16.11__py3-none-any.whl → 1.16.13__py3-none-any.whl
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.
Potentially problematic release.
This version of pdfalyzer might be problematic. Click here for more details.
- CHANGELOG.md +6 -0
- pdfalyzer/__init__.py +9 -3
- pdfalyzer/helpers/pdf_object_helper.py +8 -8
- pdfalyzer/output/tables/decoding_stats_table.py +2 -2
- {pdfalyzer-1.16.11.dist-info → pdfalyzer-1.16.13.dist-info}/METADATA +14 -7
- {pdfalyzer-1.16.11.dist-info → pdfalyzer-1.16.13.dist-info}/RECORD +9 -9
- {pdfalyzer-1.16.11.dist-info → pdfalyzer-1.16.13.dist-info}/LICENSE +0 -0
- {pdfalyzer-1.16.11.dist-info → pdfalyzer-1.16.13.dist-info}/WHEEL +0 -0
- {pdfalyzer-1.16.11.dist-info → pdfalyzer-1.16.13.dist-info}/entry_points.txt +0 -0
CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# NEXT RELEASE
|
|
2
2
|
|
|
3
|
+
### 1.16.13
|
|
4
|
+
* Bump `yaralyzer` to v1.0.7 and fix reference to yaralyzer's renamed `prefix_with_style()` method
|
|
5
|
+
|
|
6
|
+
### 1.16.12
|
|
7
|
+
* Bump `PyPDF` to v6.0.0
|
|
8
|
+
|
|
3
9
|
### 1.16.11
|
|
4
10
|
* Fix typo in `combine_pdfs` help
|
|
5
11
|
* Add some more PyPi classifiers
|
pdfalyzer/__init__.py
CHANGED
|
@@ -19,7 +19,7 @@ if not environ.get('INVOKED_BY_PYTEST', False):
|
|
|
19
19
|
from rich.columns import Columns
|
|
20
20
|
from rich.panel import Panel
|
|
21
21
|
from rich.text import Text
|
|
22
|
-
from yaralyzer.helpers.rich_text_helper import
|
|
22
|
+
from yaralyzer.helpers.rich_text_helper import prefix_with_style
|
|
23
23
|
from yaralyzer.output.file_export import invoke_rich_export
|
|
24
24
|
from yaralyzer.output.rich_console import console
|
|
25
25
|
from yaralyzer.util.logging import log_and_print
|
|
@@ -83,7 +83,7 @@ def pdfalyzer_show_color_theme() -> None:
|
|
|
83
83
|
console.print(Panel('The Pdfalyzer Color Theme', style='reverse'))
|
|
84
84
|
|
|
85
85
|
colors = [
|
|
86
|
-
|
|
86
|
+
prefix_with_style(name[:MAX_THEME_COL_SIZE], style=str(style)).append(' ')
|
|
87
87
|
for name, style in PDFALYZER_THEME_DICT.items()
|
|
88
88
|
if name not in ['reset', 'repr_url']
|
|
89
89
|
]
|
|
@@ -93,7 +93,7 @@ def pdfalyzer_show_color_theme() -> None:
|
|
|
93
93
|
|
|
94
94
|
def combine_pdfs():
|
|
95
95
|
"""
|
|
96
|
-
|
|
96
|
+
Script method to combine multiple PDFs into one. Invocable with 'combine_pdfs PDF1 [PDF2...]'.
|
|
97
97
|
Example: https://github.com/py-pdf/pypdf/blob/main/docs/user/merging-pdfs.md
|
|
98
98
|
"""
|
|
99
99
|
args = parse_combine_pdfs_args()
|
|
@@ -130,3 +130,9 @@ def combine_pdfs():
|
|
|
130
130
|
txt = Text('').append(f" -> Wrote ")
|
|
131
131
|
txt.append(str(file_size_in_mb(args.output_file)), style='cyan').append(" megabytes\n")
|
|
132
132
|
print_highlighted(txt)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# TODO: migrate this functionality from clown_sort
|
|
136
|
+
# def extract_pages_from_pdf() -> None:
|
|
137
|
+
# args = parse_pdf_page_extraction_args()
|
|
138
|
+
# PdfFile(args.pdf_file).extract_page_range(args.page_range, destination_dir=args.destination_dir)
|
|
@@ -8,19 +8,14 @@ from pypdf.generic import IndirectObject, PdfObject
|
|
|
8
8
|
from pdfalyzer.pdf_object_relationship import PdfObjectRelationship
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def pdf_object_id(pdf_object) -> Optional[int]:
|
|
12
|
-
"""Return the ID of an IndirectObject and None for everything else"""
|
|
13
|
-
return pdf_object.idnum if isinstance(pdf_object, IndirectObject) else None
|
|
14
|
-
|
|
15
|
-
|
|
16
11
|
def does_list_have_any_references(_list) -> bool:
|
|
17
12
|
"""Return true if any element of _list is an IndirectObject."""
|
|
18
13
|
return any(isinstance(item, IndirectObject) for item in _list)
|
|
19
14
|
|
|
20
15
|
|
|
21
|
-
def
|
|
22
|
-
"""
|
|
23
|
-
return
|
|
16
|
+
def pdf_object_id(pdf_object) -> Optional[int]:
|
|
17
|
+
"""Return the ID of an IndirectObject and None for everything else"""
|
|
18
|
+
return pdf_object.idnum if isinstance(pdf_object, IndirectObject) else None
|
|
24
19
|
|
|
25
20
|
|
|
26
21
|
def pypdf_class_name(obj: PdfObject) -> str:
|
|
@@ -28,3 +23,8 @@ def pypdf_class_name(obj: PdfObject) -> str:
|
|
|
28
23
|
class_pkgs = type(obj).__name__.split('.')
|
|
29
24
|
class_pkgs.reverse()
|
|
30
25
|
return class_pkgs[0].removesuffix('Object')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _sort_pdf_object_refs(refs: List[PdfObjectRelationship]) -> List[PdfObjectRelationship]:
|
|
29
|
+
"""Sort a list of PdfObjectRelationship objects by their to_obj's idnum. Only used by pytest."""
|
|
30
|
+
return sorted(refs, key=lambda ref: ref.to_obj.idnum)
|
|
@@ -5,7 +5,7 @@ from numbers import Number
|
|
|
5
5
|
|
|
6
6
|
from rich.table import Table
|
|
7
7
|
from rich.text import Text
|
|
8
|
-
from yaralyzer.helpers.rich_text_helper import CENTER, na_txt,
|
|
8
|
+
from yaralyzer.helpers.rich_text_helper import CENTER, na_txt, prefix_with_style
|
|
9
9
|
|
|
10
10
|
from pdfalyzer.binary.binary_scanner import BinaryScanner
|
|
11
11
|
from pdfalyzer.helpers.rich_text_helper import pct_txt
|
|
@@ -60,7 +60,7 @@ def build_decoding_stats_table(scanner: BinaryScanner) -> Table:
|
|
|
60
60
|
|
|
61
61
|
def _new_decoding_stats_table(title) -> Table:
|
|
62
62
|
"""Build an empty table for displaying decoding stats"""
|
|
63
|
-
title =
|
|
63
|
+
title = prefix_with_style(title, style='blue underline')
|
|
64
64
|
title.append(": Decoding Attempts Summary Statistics", style='bright_white bold')
|
|
65
65
|
|
|
66
66
|
table = Table(
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pdfalyzer
|
|
3
|
-
Version: 1.16.
|
|
3
|
+
Version: 1.16.13
|
|
4
4
|
Summary: PDF analysis tool. Scan a PDF with 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
|
|
7
|
-
Keywords: ascii art,binary,color,cybersecurity,DFIR,encoding,font,infosec,maldoc,malicious pdf,malware,malware analysis,pdf,pdfs,pdf analysis,pypdf,threat assessment,visualization,yara
|
|
7
|
+
Keywords: ascii art,binary,color,cybersecurity,DFIR,encoding,font,infosec,maldoc,malicious pdf,malware,malware analysis,pdf,pdfs,pdf analysis,pypdf,threat assessment,threat hunting,threat intelligence,threat research,threatintel,visualization,yara
|
|
8
8
|
Author: Michel de Cryptadamus
|
|
9
9
|
Author-email: michel@cryptadamus.com
|
|
10
|
-
Requires-Python: >=3.9.2,<4.0
|
|
10
|
+
Requires-Python: >=3.9.2,<4.0
|
|
11
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: Environment :: Console
|
|
13
13
|
Classifier: Intended Audience :: Information Technology
|
|
@@ -23,8 +23,8 @@ Classifier: Topic :: Artistic Software
|
|
|
23
23
|
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
24
24
|
Classifier: Topic :: Security
|
|
25
25
|
Requires-Dist: anytree (>=2.13,<3.0)
|
|
26
|
-
Requires-Dist: pypdf (>=
|
|
27
|
-
Requires-Dist: yaralyzer (>=1.0.
|
|
26
|
+
Requires-Dist: pypdf (>=6.0.0,<7.0.0)
|
|
27
|
+
Requires-Dist: yaralyzer (>=1.0.7,<2.0.0)
|
|
28
28
|
Project-URL: Changelog, https://github.com/michelcrypt4d4mus/pdfalyzer/blob/master/CHANGELOG.md
|
|
29
29
|
Project-URL: Documentation, https://github.com/michelcrypt4d4mus/pdfalyzer
|
|
30
30
|
Project-URL: Repository, https://github.com/michelcrypt4d4mus/pdfalyzer
|
|
@@ -65,10 +65,12 @@ If you're looking for one of these things this may be the tool for you.
|
|
|
65
65
|
### What It Don't Do
|
|
66
66
|
This tool is mostly for examining/working with a PDF's data and logical structure. As such it doesn't have much to offer as far as extracting text, rendering[^3], writing, etc. etc.
|
|
67
67
|
|
|
68
|
+
If you suspect you are dealing with a malcious PDF you can safely run `pdfalyze` on it; embedded javascript etc. will not be executed. If you want to actually look at the contents of a suspect PDF you can use [`dangerzone`](https://dangerzone.rocks/) to sanitize the contents with extreme prejudice before opening it.
|
|
69
|
+
|
|
68
70
|
-------------
|
|
69
71
|
|
|
70
72
|
# Installation
|
|
71
|
-
|
|
73
|
+
#### All Platforms
|
|
72
74
|
Installation with [pipx](https://pypa.github.io/pipx/)[^4] is preferred though `pip3` / `pip` should also work.
|
|
73
75
|
```sh
|
|
74
76
|
pipx install pdfalyzer
|
|
@@ -76,7 +78,12 @@ pipx install pdfalyzer
|
|
|
76
78
|
|
|
77
79
|
See [PyPDF installation notes](https://github.com/py-pdf/pypdf#installation) about `PyCryptodome` if you plan to `pdfalyze` any files that use AES encryption.
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
#### macOS Homebrew
|
|
82
|
+
If you are on macOS and use `homebrew` someone out there was kind enough to make [The Pdfalyzer available via homebrew](https://formulae.brew.sh/formula/pdfalyzer) so this should work:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
brew install pdfalyzer
|
|
86
|
+
```
|
|
80
87
|
|
|
81
88
|
### Troubleshooting
|
|
82
89
|
1. If you used `pip3` instead of `pipx` and have an issue you should try to install with `pipx`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.pdfalyzer.example,sha256=sh_qkUBw4hfJia_Dx2wB-fsqJInhx2sSgA7WJz3MHYo,3917
|
|
2
|
-
CHANGELOG.md,sha256=
|
|
2
|
+
CHANGELOG.md,sha256=U5N1_L62GbjwYRp3j1_gWDh_N6ycse0pmsk4FnXetBU,12738
|
|
3
3
|
LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
4
|
-
pdfalyzer/__init__.py,sha256=
|
|
4
|
+
pdfalyzer/__init__.py,sha256=ODRuicmuPQ2dUP05n1Wkstl43rAI_0jn5_R48-OQXAM,5617
|
|
5
5
|
pdfalyzer/__main__.py,sha256=Ko_AoAyYMLIe_cmhiUSl6twheLZrGyT8aOSJ2CP7EZY,43
|
|
6
6
|
pdfalyzer/binary/binary_scanner.py,sha256=h_qcflLWn4pu5NH9F84BuVSYemWQjA3kNxsmXVdz3fk,10211
|
|
7
7
|
pdfalyzer/config.py,sha256=4YMDZu3-t5RSGckjN9bT5LzXyhwHXcxi4QjzVQ4-N6U,2097
|
|
@@ -18,7 +18,7 @@ pdfalyzer/font_info.py,sha256=2R85iETY_1eKCeRrkqeIxfPDqXZyWfCNcHx_-aTyF0s,6682
|
|
|
18
18
|
pdfalyzer/helpers/dict_helper.py,sha256=2TP0_EJBouaWD6jfnAekrEZ4M5eHKL8Tm61FgXZtBAg,303
|
|
19
19
|
pdfalyzer/helpers/filesystem_helper.py,sha256=yAeZ8VllSdO9eudGllwd_7odUHsfoM9SseQHDGvU59k,4117
|
|
20
20
|
pdfalyzer/helpers/number_helper.py,sha256=8IlRmaOVLJsUV18VLvWRZU8SzRxL0XZjrY3sjmk2Ro4,292
|
|
21
|
-
pdfalyzer/helpers/pdf_object_helper.py,sha256=
|
|
21
|
+
pdfalyzer/helpers/pdf_object_helper.py,sha256=65BlUgnDM9brxJFw_WF8QLomWHaNh-pj88NWoxcMkoQ,1160
|
|
22
22
|
pdfalyzer/helpers/rich_text_helper.py,sha256=wTucWbrf8OuS2wVuudIH4v078NTUPQbCqU9ZJ4bDzdE,2122
|
|
23
23
|
pdfalyzer/helpers/string_helper.py,sha256=75EDEFw3UWHvWF32WtvZVBbqYY3ozO4y30dtH2qVMX0,2278
|
|
24
24
|
pdfalyzer/output/character_mapping.py,sha256=RWqIu1kGnB4bQS1E4ZcjMWtUqR9ehvTth7U9Nq99_zk,2189
|
|
@@ -26,7 +26,7 @@ pdfalyzer/output/layout.py,sha256=lAJQiu76E-_5MRghpRK7zuXqkhWI7ZjsptfadXXZQF8,21
|
|
|
26
26
|
pdfalyzer/output/pdfalyzer_presenter.py,sha256=TUsMc2GTUDjFzIGk7Ep5ZASfXcKX_WNtZzZKbQTHcfY,8580
|
|
27
27
|
pdfalyzer/output/styles/node_colors.py,sha256=rfsTAUF43K_buw21SZoP6L5c_cLy7S-xA4GUiWJsDkc,3986
|
|
28
28
|
pdfalyzer/output/styles/rich_theme.py,sha256=Y8QmuINlyZNIHvf3oD0CV3w2dC49NNKtvOChvudDCT8,1983
|
|
29
|
-
pdfalyzer/output/tables/decoding_stats_table.py,sha256=
|
|
29
|
+
pdfalyzer/output/tables/decoding_stats_table.py,sha256=HuSpTD1mwmNqNWuMlMQdOsLIislplAexNWADVgb_ckQ,3605
|
|
30
30
|
pdfalyzer/output/tables/font_summary_table.py,sha256=xfTqC7BlQd0agQf6nDDhkcJno7hru6mf9_xY1f5IDcw,2065
|
|
31
31
|
pdfalyzer/output/tables/pdf_node_rich_table.py,sha256=7G-FLb_EUP50kZmYCTbo8Q6taU4xKp2QIGNOnQtYbNg,5908
|
|
32
32
|
pdfalyzer/output/tables/stream_objects_table.py,sha256=PgQj8oTtW5_X8SMQb3FvCWDS-d4Zl6QiE44Qhiv7lTY,706
|
|
@@ -43,8 +43,8 @@ pdfalyzer/yara_rules/__init.py__,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
|
43
43
|
pdfalyzer/yara_rules/didier_stevens.yara,sha256=4XhqafU09xzYUP7LCygHHBXOpAXUblJf6Tkn37MUy0w,7253
|
|
44
44
|
pdfalyzer/yara_rules/lprat.static_file_analysis.yara,sha256=i0CwRH8pBx_QshKFTQtr1CP5n378EZelsF2FxMY2y5A,21859
|
|
45
45
|
pdfalyzer/yara_rules/pdf_malware.yara,sha256=jDqSTP5BQSi2I_1xZiFZdy68I4oVWDat2j08-qdfbto,91063
|
|
46
|
-
pdfalyzer-1.16.
|
|
47
|
-
pdfalyzer-1.16.
|
|
48
|
-
pdfalyzer-1.16.
|
|
49
|
-
pdfalyzer-1.16.
|
|
50
|
-
pdfalyzer-1.16.
|
|
46
|
+
pdfalyzer-1.16.13.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
47
|
+
pdfalyzer-1.16.13.dist-info/METADATA,sha256=MUgEcOKSKXr4l7BQfz_Cb_PAbgiNJKspBW0Ud_GsVWk,26638
|
|
48
|
+
pdfalyzer-1.16.13.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
49
|
+
pdfalyzer-1.16.13.dist-info/entry_points.txt,sha256=aZurgt-Xg3pojS7oTRI4hNLpK1hO4kTfChf0x2eQoD8,147
|
|
50
|
+
pdfalyzer-1.16.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|