pdfalyzer 1.16.0__py3-none-any.whl → 1.16.2__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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # NEXT RELEASE
2
2
 
3
+ ### 1.16.2
4
+ * Add two more PDF related YARA rules
5
+
6
+ ### 1.16.1
7
+ * Configure a `Changelog` link for `pypi` to display
8
+
3
9
  # 1.16.0
4
10
  * Upgrade `PyPDF2` 2.x to `pypdf` 5.0.1 (new name, same package)
5
11
  * Add `--image-quality` option to `combine_pdfs` tool
@@ -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|None:
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 | None, int | None]:
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 functools import partial
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|Text, **kwargs) -> None:
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
@@ -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|None = None) -> None:
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
  Metadata-Version: 2.1
2
2
  Name: pdfalyzer
3
- Version: 1.16.0
3
+ Version: 1.16.2
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
@@ -23,6 +23,7 @@ Requires-Dist: python-dotenv (>=0.21.0,<0.22.0)
23
23
  Requires-Dist: rich (>=12.5.1,<13.0.0)
24
24
  Requires-Dist: rich-argparse-plus (>=0.3.1,<0.4.0)
25
25
  Requires-Dist: yaralyzer (>=0.9.4,<0.10.0)
26
+ Project-URL: Changelog, https://github.com/michelcrypt4d4mus/pdfalyzer/blob/master/CHANGELOG.md
26
27
  Project-URL: Documentation, https://github.com/michelcrypt4d4mus/pdfalyzer
27
28
  Project-URL: Repository, https://github.com/michelcrypt4d4mus/pdfalyzer
28
29
  Description-Content-Type: text/markdown
@@ -1,4 +1,4 @@
1
- CHANGELOG.md,sha256=ojqG5GrSc6nAN3pkuRMfS2qWhrk_OcFk3kMafbnjqXI,11710
1
+ CHANGELOG.md,sha256=4PUZoK_K_Cv6O9xmyt0mOyra3Yu3xlSXNNVO78VPsPY,11825
2
2
  LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
3
3
  pdfalyzer/__init__.py,sha256=q8qSdGdyUYmTYGOp_d2bRCCFASnlVt4wa-DlBikD5-M,5362
4
4
  pdfalyzer/__main__.py,sha256=Ko_AoAyYMLIe_cmhiUSl6twheLZrGyT8aOSJ2CP7EZY,43
@@ -15,10 +15,10 @@ pdfalyzer/detection/javascript_hunter.py,sha256=_wT2vkKTMlm_RGCjYsmwcmV-ag1qep3E
15
15
  pdfalyzer/detection/yaralyzer_helper.py,sha256=_l9eJQUtMlo9RhY5h8Xq9gBLxzn1VgJsCA1nCsFDGvo,1999
16
16
  pdfalyzer/font_info.py,sha256=0NQ6g4q3pTdirwGjJhur8HkXQlC732cR7IhilO33g2A,6663
17
17
  pdfalyzer/helpers/dict_helper.py,sha256=2TP0_EJBouaWD6jfnAekrEZ4M5eHKL8Tm61FgXZtBAg,303
18
- pdfalyzer/helpers/filesystem_helper.py,sha256=wHlFz4DFzPAJt2OzMRrhsjL-O3gLJ02JhuwBRwkE958,4089
18
+ pdfalyzer/helpers/filesystem_helper.py,sha256=1clV0mqKFJUJC4xU2q_ApklpHCqCclxJAVJwRp93OF0,4110
19
19
  pdfalyzer/helpers/number_helper.py,sha256=8IlRmaOVLJsUV18VLvWRZU8SzRxL0XZjrY3sjmk2Ro4,292
20
20
  pdfalyzer/helpers/pdf_object_helper.py,sha256=Ija6cWKfFQRXCfZv2ezU1V2v0KFDn9f4ayeX8eG9GmI,1102
21
- pdfalyzer/helpers/rich_text_helper.py,sha256=s5ytOme8CZCIWAsiPHFlIi6q0KN5qZPBb0OrtTfRkq4,2254
21
+ pdfalyzer/helpers/rich_text_helper.py,sha256=j4zs41T94vjkr9e86ZVQRKYiUBjoZyZMdVJ4d4uiON8,2239
22
22
  pdfalyzer/helpers/string_helper.py,sha256=75EDEFw3UWHvWF32WtvZVBbqYY3ozO4y30dtH2qVMX0,2278
23
23
  pdfalyzer/output/character_mapping.py,sha256=MtC3jKdtMaugi5038fne0T_SFSo9QU4lZl_s7bW7gzI,2092
24
24
  pdfalyzer/output/layout.py,sha256=E58T9Tl6BYZTDsj6ouMr1J5SSUiXa7timUNxnOI2IzI,2149
@@ -32,16 +32,16 @@ pdfalyzer/output/tables/stream_objects_table.py,sha256=nzCTci8Kqs8Pyghad3L5KWHDd
32
32
  pdfalyzer/pdf_object_relationship.py,sha256=ug-338eoXFdD4YtDWPdzcfxP2fQDQa-GE8I3m3a01TA,5339
33
33
  pdfalyzer/pdfalyzer.py,sha256=6JflqQJb2crXXaVA6DHHgWB45w2MBFB3pqE3AlZO5WI,11013
34
34
  pdfalyzer/util/adobe_strings.py,sha256=F1MOBtSyIuF5HPmzWDr8MgnLyVodOsZSy4AFFCMHq_Y,5033
35
- pdfalyzer/util/argument_parser.py,sha256=_8bhYkrw_lH9ce-ZnagcCtn9iqjeUW4dbbyQicB5hqE,11902
35
+ pdfalyzer/util/argument_parser.py,sha256=zVblR_lkqfjbfF7nvRjnQCEkYdA14tpLIpBno-CocIg,11917
36
36
  pdfalyzer/util/debugging.py,sha256=nE64VUQbdu2OQRC8w8-AJkMtBOy8Kf3mjozuFslfWsw,156
37
37
  pdfalyzer/util/exceptions.py,sha256=XLFFTdx1n6i_VCmvuzvIOCa-djJvGEitfo9lhy3zq0k,98
38
38
  pdfalyzer/util/pdf_parser_manager.py,sha256=FVRYAYsCd0y5MAm--qvXnwCZnDtB3x85FdJtb-gpyw4,3109
39
- pdfalyzer/yara_rules/PDF.yara,sha256=fBMKYmJgBLiCq-kpVzsTP9zUJEBep6yi_QVKmC-FdY0,38611
39
+ pdfalyzer/yara_rules/PDF.yara,sha256=ht4J7auMYwzGXD5c0E9fTq7MFo0ep375lva3E2XCsl8,39670
40
40
  pdfalyzer/yara_rules/PDF_binary_stream.yara,sha256=oWRPLe5yQiRFMvi3BTHNTlB6T7NcAuxKn0C9OSvgJSM,804
41
41
  pdfalyzer/yara_rules/__init.py__,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  pdfalyzer/yara_rules/lprat.static_file_analysis.yara,sha256=i0CwRH8pBx_QshKFTQtr1CP5n378EZelsF2FxMY2y5A,21859
43
- pdfalyzer-1.16.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
44
- pdfalyzer-1.16.0.dist-info/METADATA,sha256=IEEZrNEL7fdybwE9t7PasjPu-0XQkglaS_vfIfbLBGU,25716
45
- pdfalyzer-1.16.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
46
- pdfalyzer-1.16.0.dist-info/entry_points.txt,sha256=aZurgt-Xg3pojS7oTRI4hNLpK1hO4kTfChf0x2eQoD8,147
47
- pdfalyzer-1.16.0.dist-info/RECORD,,
43
+ pdfalyzer-1.16.2.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
44
+ pdfalyzer-1.16.2.dist-info/METADATA,sha256=ET2EJiWpis1oN1jVenh4VXQZTMhAeHi5qLgn03q94g4,25812
45
+ pdfalyzer-1.16.2.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
46
+ pdfalyzer-1.16.2.dist-info/entry_points.txt,sha256=aZurgt-Xg3pojS7oTRI4hNLpK1hO4kTfChf0x2eQoD8,147
47
+ pdfalyzer-1.16.2.dist-info/RECORD,,