mirror of
https://github.com/frida/frida-python
synced 2026-06-08 14:16:17 +00:00
Add frida.__version__ constant
This commit is contained in:
@@ -1657,6 +1657,8 @@ MOD_INIT (_frida)
|
||||
|
||||
MOD_DEF (module, "_frida", "Frida", NULL);
|
||||
|
||||
PyModule_AddStringConstant (module, "__version__", frida_version_string ());
|
||||
|
||||
Py_INCREF (&PyDeviceManagerType);
|
||||
PyModule_AddObject (module, "DeviceManager", (PyObject *) &PyDeviceManagerType);
|
||||
|
||||
|
||||
+24
-22
@@ -1,8 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import threading
|
||||
try:
|
||||
import _frida
|
||||
except Exception as ex:
|
||||
import colorama
|
||||
from colorama import Back, Fore, Style
|
||||
import sys
|
||||
colorama.init(autoreset=True)
|
||||
print("")
|
||||
print("***")
|
||||
if str(ex).startswith("No module named "):
|
||||
print(Back.RED + Fore.WHITE + Style.BRIGHT + "Frida native extension not found" + Style.RESET_ALL)
|
||||
print(Fore.WHITE + Style.BRIGHT + "Please check your PYTHONPATH." + Style.RESET_ALL)
|
||||
else:
|
||||
print(Back.RED + Fore.WHITE + Style.BRIGHT + "Failed to load the Frida native extension: %s" % ex + Style.RESET_ALL)
|
||||
if sys.version_info[0] == 2:
|
||||
current_python_version = "%d.%d" % sys.version_info[:2]
|
||||
else:
|
||||
current_python_version = "%d.x" % sys.version_info[0]
|
||||
print(Fore.WHITE + Style.BRIGHT + "Please ensure that the extension was compiled for Python " + current_python_version + "." + Style.RESET_ALL)
|
||||
print("***")
|
||||
print("")
|
||||
raise ex
|
||||
|
||||
|
||||
__version__ = _frida.__version__
|
||||
|
||||
def spawn(command_line, device_id = None):
|
||||
return get_device_manager().get_device(device_id).spawn(command_line)
|
||||
|
||||
@@ -60,27 +84,5 @@ def get_device_manager():
|
||||
global _device_manager
|
||||
if _device_manager is None:
|
||||
from . import core
|
||||
try:
|
||||
import _frida
|
||||
except Exception as ex:
|
||||
import colorama
|
||||
from colorama import Back, Fore, Style
|
||||
import sys
|
||||
colorama.init(autoreset=True)
|
||||
print("")
|
||||
print("***")
|
||||
if str(ex).startswith("No module named "):
|
||||
print(Back.RED + Fore.WHITE + Style.BRIGHT + "Frida native extension not found" + Style.RESET_ALL)
|
||||
print(Fore.WHITE + Style.BRIGHT + "Please check your PYTHONPATH." + Style.RESET_ALL)
|
||||
else:
|
||||
print(Back.RED + Fore.WHITE + Style.BRIGHT + "Failed to load the Frida native extension: %s" % ex + Style.RESET_ALL)
|
||||
if sys.version_info[0] == 2:
|
||||
current_python_version = "%d.%d" % sys.version_info[:2]
|
||||
else:
|
||||
current_python_version = "%d.x" % sys.version_info[0]
|
||||
print(Fore.WHITE + Style.BRIGHT + "Please ensure that the extension was compiled for Python " + current_python_version + "." + Style.RESET_ALL)
|
||||
print("***")
|
||||
print("")
|
||||
raise ex
|
||||
_device_manager = core.DeviceManager(_frida.DeviceManager())
|
||||
return _device_manager
|
||||
|
||||
Reference in New Issue
Block a user