ntmemoryapi 2.3.0__tar.gz → 2.4.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ntmemoryapi
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: Add your description here
5
5
  Requires-Dist: psutil>=7.2.2
6
6
  Requires-Python: >=3.13
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ntmemoryapi"
3
- version = "2.3.0"
3
+ version = "2.4.0"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -215,7 +215,7 @@ class Process:
215
215
  if not self.is_64bit():
216
216
  raise RuntimeError("Unable to list modules for not 64 bit process using `%s` method, use another one method instead")
217
217
 
218
- # If procewss PEB retrieve failed
218
+ # If process PEB retrieve failed
219
219
  if not (process_peb := self.get_information().peb):
220
220
  raise RuntimeError("Process `%s` PEB address is null-value" % self.name)
221
221
 
@@ -380,11 +380,15 @@ class Process:
380
380
 
381
381
  return process_basic_information
382
382
 
383
- def get_module(self, name: str) -> structs.MODULEENTRY32:
383
+ def get_module(self, name: str, method: typing.Literal["pebwalk", "snapshot"] = "pebwalk") -> structs.MODULEENTRY32:
384
384
  """Get process module information."""
385
385
 
386
+ # If method is not allowed
387
+ if method.lower() not in [item.lower() for item in allowed_methods] if (allowed_methods := typing.get_args(self.list_modules.__annotations__["method"])) else True:
388
+ raise ValueError("Method literal is invalid, expected one of: `%s`" % ", ".join(allowed_methods))
389
+
386
390
  # Process modules enumeration
387
- for module in self.list_modules():
391
+ for module in self.list_modules(method):
388
392
 
389
393
  # If module have a required name
390
394
  if module.name.lower() == name.strip().lower():
File without changes