From 264b56f4f3f40de3c915baaeeef78ceb90d11549 Mon Sep 17 00:00:00 2001 From: cosine0 Date: Thu, 27 Oct 2022 10:07:30 +0900 Subject: [PATCH] fix/update old api use --- dllhook/hooker.py | 5 ++--- dllhook/main.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dllhook/hooker.py b/dllhook/hooker.py index 917b8da..8b94dfd 100644 --- a/dllhook/hooker.py +++ b/dllhook/hooker.py @@ -8,7 +8,6 @@ import re import struct import time import types -from typing import Union import capstone import cffi @@ -138,8 +137,8 @@ def hook_dll(module_name, target_export_name_or_offset, timeout_seconds=5): install_jump(decorator_scope_vars['target_address'], decorator_scope_vars['invoker_address']) # make c wrapper for callbacker - argspec = inspect.getargspec(callback) - if argspec.varargs is not None or argspec.keywords is not None: + argspec = inspect.getfullargspec(callback) + if argspec.varargs is not None or argspec.varkw is not None: raise ValueError("Varargs are not allowed in 'callback'") callbacker_c_wrapper = ctypes.CFUNCTYPE(None, *[ctypes.c_uint32] * len(argspec.args)) diff --git a/dllhook/main.py b/dllhook/main.py index dc4229d..3d23523 100644 --- a/dllhook/main.py +++ b/dllhook/main.py @@ -43,7 +43,7 @@ def main(): if os.path.basename(INTERPRETER_DIR).lower() == 'scripts': # in venv - library_path = INTERPRETER_DIR / 'lib' / 'site-packages' + library_path = INTERPRETER_DIR.parent / 'lib' / 'site-packages' venv_setup = f'import sys\nsys.path.append(' \ f'{library_path.absolute().as_posix()!r})' with open(INTERPRETER_DIR.parent / 'pyvenv.cfg') as f: