PyQBDI 0.12.1__cp312-cp312-win32.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.
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyQBDI
3
+ Version: 0.12.1
4
+ Summary: Python binding for QBDI
5
+ Author: Nicolas Surbayrole
6
+ Author-email: qbdi@quarkslab.com
7
+ License: apache2
8
+ Project-URL: Documentation, https://qbdi.readthedocs.io/
9
+ Project-URL: Source, https://github.com/QBDI/QBDI
10
+ Project-URL: Homepage, https://qbdi.quarkslab.com/
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: C++
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Security
24
+ Classifier: Topic :: Software Development :: Debuggers
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/x-rst
27
+ License-File: LICENSE.txt
28
+ Dynamic: license-file
29
+
30
+ Introduction
31
+ ============
32
+
33
+ .. image:: https://readthedocs.org/projects/qbdi/badge/?version=stable
34
+ :target: https://qbdi.readthedocs.io/en/stable/?badge=stable
35
+ :alt: Documentation Status
36
+
37
+ .. image:: https://img.shields.io/github/v/release/QBDI/QBDI
38
+ :target: https://github.com/QBDI/QBDI/releases
39
+
40
+ .. image:: https://img.shields.io/pypi/pyversions/PyQBDI
41
+ :target: https://pypi.org/project/PyQBDI/
42
+
43
+ .. image:: https://img.shields.io/pypi/v/PyQBDI
44
+ :target: https://pypi.org/project/PyQBDI/
45
+
46
+ QuarkslaB Dynamic binary Instrumentation (QBDI) is a modular, cross-platform and cross-architecture
47
+ DBI framework. It aims to support Linux, macOS, Android, iOS and Windows operating systems running on
48
+ x86, x86-64, ARM and AArch64 architectures. In addition of C/C++ API, Python and JS/frida bindings are
49
+ available to script QBDI. Information about what is a DBI framework and how QBDI
50
+ works can be found in the `documentation introduction <https://qbdi.readthedocs.io/en/stable/intro.html>`_.
51
+
52
+ QBDI modularity means it doesn't contain a preferred injection method and it is designed to be
53
+ used in conjunction with an external injection tool. QBDI includes a tiny (``LD_PRELOAD`` based)
54
+ Linux and macOS injector for dynamic executables (QBDIPreload).
55
+ QBDI is also fully integrated with `Frida <https://frida.re>`_, a reference dynamic instrumentation toolkit,
56
+ allowing anybody to use their combined powers.
57
+
58
+ A current limitation is that QBDI doesn't handle signals, multithreading (it doesn't deal with new
59
+ threads creation) and C++ exception mechanisms.
60
+ However, those system-dependent features will probably not be part of the core library (KISS),
61
+ and should be integrated as a new layer (to be determined how).
62
+
63
+ Status
64
+ ++++++
65
+
66
+ .. role:: green
67
+ .. role:: yellow
68
+ .. role:: orange
69
+ .. role:: red
70
+
71
+ ======= ============================== ================== =========================
72
+ CPU Operating Systems Execution Memory Access Information
73
+ ======= ============================== ================== =========================
74
+ x86-64 Android, Linux, macOS, Windows :green:`Supported` :green:`Supported`
75
+ x86 Android, Linux, macOS, Windows :green:`Supported` :green:`Supported`
76
+ ARM Android, Linux :green:`Supported` :green:`Supported`
77
+ AArch64 Android, Linux, macOS, IOs (*) :green:`Supported` :green:`Supported`
78
+ ======= ============================== ================== =========================
79
+
80
+ \* IOs support is unstable and need a jailbroken device.
81
+
82
+ Installation
83
+ ============
84
+
85
+ Python API (PyQBDI)
86
+ +++++++++++++++++++
87
+
88
+ PyQBDI is available through PyPI. The wheel package can be either `downloaded <https://pypi.org/project/PyQBDI/#files>`__ or installed with the following command:
89
+
90
+ pip install PyQBDI
91
+
92
+ The PyQBDI package is self-contained so completely independent from the C/C++ package.
93
+
94
+ Devel packages
95
+ ++++++++++++++
96
+
97
+ There is no strict development timeline or scheduled release plan for the QBDI project.
98
+ All the new features and fixes are merged onto the ``dev-next`` branch.
99
+ Devel packages can be downloaded in the artefacts of `Github Actions <https://github.com/QBDI/QBDI/actions/workflows/python.yml?query=branch%3Adev-next>`__.
100
+
101
+ Compilation
102
+ ===========
103
+
104
+ The PyQDBI library (apart from the wheel package) can be built by solely passing the **'-DQBDI_TOOLS_PYQBDI=ON'** option to the CMake build system.
105
+
106
+ However, if you want to build the wheel package, you can run these commands::
107
+
108
+ git clone https://github.com/QBDI/QBDI.git
109
+ python -m pip install --upgrade pip
110
+ python -m pip install setuptools wheel build
111
+ python -m build -w
112
+
113
+ A 32-bit version of Python is mandatory for the X86 architecture whereas a 64-bit one is required for the X86-64 architecture.
@@ -0,0 +1,9 @@
1
+ pyqbdi.pyd,sha256=3WQj1SiswPcjMG-aN0OIMHFCVoo_YPGuDW2A5TZ2qi4,7343104
2
+ pyqbdiWinPreloader.exe,sha256=EJLISki_pkdNO-I9LGDJ4KABIr3kPyMVJxhE7gDK4y8,11776
3
+ pyqbdipreload.py,sha256=hANOaHha85XUt4Kub8f2lsKZhIErsfkKNAq4O6PZ3lA,5814
4
+ pyqbdipreloadlib.cp312-win32.pyd,sha256=TrzGE7pmbr5W_nvRofC8UqAFKuN8LUISbiWg50-We3s,7356928
5
+ pyqbdi-0.12.1.dist-info/licenses/LICENSE.txt,sha256=gOUvR_mAOk85D4IBVtoFVh5kieG_u0_0yKXHcETHd34,12687
6
+ pyqbdi-0.12.1.dist-info/METADATA,sha256=_Bell7CFOs0T_ilQI8QJjvTO6syoXB_Ti5dvCevysWc,5001
7
+ pyqbdi-0.12.1.dist-info/WHEEL,sha256=LwxTQZ0gyDP_uaeNCLm-ZIktY9hv6x0e22Q-hgFd-po,97
8
+ pyqbdi-0.12.1.dist-info/top_level.txt,sha256=vaVfPcyi2OkulsN7QdaZiIKzq2GbFV2q24OujHZlbRc,7
9
+ pyqbdi-0.12.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-win32
5
+
@@ -0,0 +1,225 @@
1
+ ################################################################################
2
+ QBDI package license
3
+ ################################################################################
4
+
5
+ QBDI binaries and packages can be statically linked with the followed source:
6
+
7
+ - QBDI under the Apache License v2.0
8
+ - LLVM under the Apache License v2.0 with LLVM Exceptions
9
+ https://releases.llvm.org/10.0.0/LICENSE.TXT
10
+ - spdlog under the MIT License
11
+ https://github.com/gabime/spdlog/blob/v1.x/LICENSE
12
+ - fmtlib under the MIT License
13
+ https://github.com/fmtlib/fmt/blob/master/LICENSE.rst
14
+ - Catch2 under the Boost Software License 1.0
15
+ https://github.com/catchorg/Catch2/blob/devel/LICENSE.txt
16
+ - Pybind11 under a BSD-style license
17
+ https://github.com/pybind/pybind11/blob/master/LICENSE
18
+ - A sha256 implementation under GPLv3 / Apache License v2.0
19
+ https://github.com/aguinet/sha256_literal#licensing
20
+
21
+ ################################################################################
22
+ QBDI source code is under the Apache License v2.0
23
+ ################################################################################
24
+
25
+ Apache License
26
+ Version 2.0, January 2004
27
+ http://www.apache.org/licenses/
28
+
29
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
30
+
31
+ 1. Definitions.
32
+
33
+ "License" shall mean the terms and conditions for use, reproduction,
34
+ and distribution as defined by Sections 1 through 9 of this document.
35
+
36
+ "Licensor" shall mean the copyright owner or entity authorized by
37
+ the copyright owner that is granting the License.
38
+
39
+ "Legal Entity" shall mean the union of the acting entity and all
40
+ other entities that control, are controlled by, or are under common
41
+ control with that entity. For the purposes of this definition,
42
+ "control" means (i) the power, direct or indirect, to cause the
43
+ direction or management of such entity, whether by contract or
44
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
45
+ outstanding shares, or (iii) beneficial ownership of such entity.
46
+
47
+ "You" (or "Your") shall mean an individual or Legal Entity
48
+ exercising permissions granted by this License.
49
+
50
+ "Source" form shall mean the preferred form for making modifications,
51
+ including but not limited to software source code, documentation
52
+ source, and configuration files.
53
+
54
+ "Object" form shall mean any form resulting from mechanical
55
+ transformation or translation of a Source form, including but
56
+ not limited to compiled object code, generated documentation,
57
+ and conversions to other media types.
58
+
59
+ "Work" shall mean the work of authorship, whether in Source or
60
+ Object form, made available under the License, as indicated by a
61
+ copyright notice that is included in or attached to the work
62
+ (an example is provided in the Appendix below).
63
+
64
+ "Derivative Works" shall mean any work, whether in Source or Object
65
+ form, that is based on (or derived from) the Work and for which the
66
+ editorial revisions, annotations, elaborations, or other modifications
67
+ represent, as a whole, an original work of authorship. For the purposes
68
+ of this License, Derivative Works shall not include works that remain
69
+ separable from, or merely link (or bind by name) to the interfaces of,
70
+ the Work and Derivative Works thereof.
71
+
72
+ "Contribution" shall mean any work of authorship, including
73
+ the original version of the Work and any modifications or additions
74
+ to that Work or Derivative Works thereof, that is intentionally
75
+ submitted to Licensor for inclusion in the Work by the copyright owner
76
+ or by an individual or Legal Entity authorized to submit on behalf of
77
+ the copyright owner. For the purposes of this definition, "submitted"
78
+ means any form of electronic, verbal, or written communication sent
79
+ to the Licensor or its representatives, including but not limited to
80
+ communication on electronic mailing lists, source code control systems,
81
+ and issue tracking systems that are managed by, or on behalf of, the
82
+ Licensor for the purpose of discussing and improving the Work, but
83
+ excluding communication that is conspicuously marked or otherwise
84
+ designated in writing by the copyright owner as "Not a Contribution."
85
+
86
+ "Contributor" shall mean Licensor and any individual or Legal Entity
87
+ on behalf of whom a Contribution has been received by Licensor and
88
+ subsequently incorporated within the Work.
89
+
90
+ 2. Grant of Copyright License. Subject to the terms and conditions of
91
+ this License, each Contributor hereby grants to You a perpetual,
92
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
93
+ copyright license to reproduce, prepare Derivative Works of,
94
+ publicly display, publicly perform, sublicense, and distribute the
95
+ Work and such Derivative Works in Source or Object form.
96
+
97
+ 3. Grant of Patent License. Subject to the terms and conditions of
98
+ this License, each Contributor hereby grants to You a perpetual,
99
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
100
+ (except as stated in this section) patent license to make, have made,
101
+ use, offer to sell, sell, import, and otherwise transfer the Work,
102
+ where such license applies only to those patent claims licensable
103
+ by such Contributor that are necessarily infringed by their
104
+ Contribution(s) alone or by combination of their Contribution(s)
105
+ with the Work to which such Contribution(s) was submitted. If You
106
+ institute patent litigation against any entity (including a
107
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
108
+ or a Contribution incorporated within the Work constitutes direct
109
+ or contributory patent infringement, then any patent licenses
110
+ granted to You under this License for that Work shall terminate
111
+ as of the date such litigation is filed.
112
+
113
+ 4. Redistribution. You may reproduce and distribute copies of the
114
+ Work or Derivative Works thereof in any medium, with or without
115
+ modifications, and in Source or Object form, provided that You
116
+ meet the following conditions:
117
+
118
+ (a) You must give any other recipients of the Work or
119
+ Derivative Works a copy of this License; and
120
+
121
+ (b) You must cause any modified files to carry prominent notices
122
+ stating that You changed the files; and
123
+
124
+ (c) You must retain, in the Source form of any Derivative Works
125
+ that You distribute, all copyright, patent, trademark, and
126
+ attribution notices from the Source form of the Work,
127
+ excluding those notices that do not pertain to any part of
128
+ the Derivative Works; and
129
+
130
+ (d) If the Work includes a "NOTICE" text file as part of its
131
+ distribution, then any Derivative Works that You distribute must
132
+ include a readable copy of the attribution notices contained
133
+ within such NOTICE file, excluding those notices that do not
134
+ pertain to any part of the Derivative Works, in at least one
135
+ of the following places: within a NOTICE text file distributed
136
+ as part of the Derivative Works; within the Source form or
137
+ documentation, if provided along with the Derivative Works; or,
138
+ within a display generated by the Derivative Works, if and
139
+ wherever such third-party notices normally appear. The contents
140
+ of the NOTICE file are for informational purposes only and
141
+ do not modify the License. You may add Your own attribution
142
+ notices within Derivative Works that You distribute, alongside
143
+ or as an addendum to the NOTICE text from the Work, provided
144
+ that such additional attribution notices cannot be construed
145
+ as modifying the License.
146
+
147
+ You may add Your own copyright statement to Your modifications and
148
+ may provide additional or different license terms and conditions
149
+ for use, reproduction, or distribution of Your modifications, or
150
+ for any such Derivative Works as a whole, provided Your use,
151
+ reproduction, and distribution of the Work otherwise complies with
152
+ the conditions stated in this License.
153
+
154
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
155
+ any Contribution intentionally submitted for inclusion in the Work
156
+ by You to the Licensor shall be under the terms and conditions of
157
+ this License, without any additional terms or conditions.
158
+ Notwithstanding the above, nothing herein shall supersede or modify
159
+ the terms of any separate license agreement you may have executed
160
+ with Licensor regarding such Contributions.
161
+
162
+ 6. Trademarks. This License does not grant permission to use the trade
163
+ names, trademarks, service marks, or product names of the Licensor,
164
+ except as required for reasonable and customary use in describing the
165
+ origin of the Work and reproducing the content of the NOTICE file.
166
+
167
+ 7. Disclaimer of Warranty. Unless required by applicable law or
168
+ agreed to in writing, Licensor provides the Work (and each
169
+ Contributor provides its Contributions) on an "AS IS" BASIS,
170
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
171
+ implied, including, without limitation, any warranties or conditions
172
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
173
+ PARTICULAR PURPOSE. You are solely responsible for determining the
174
+ appropriateness of using or redistributing the Work and assume any
175
+ risks associated with Your exercise of permissions under this License.
176
+
177
+ 8. Limitation of Liability. In no event and under no legal theory,
178
+ whether in tort (including negligence), contract, or otherwise,
179
+ unless required by applicable law (such as deliberate and grossly
180
+ negligent acts) or agreed to in writing, shall any Contributor be
181
+ liable to You for damages, including any direct, indirect, special,
182
+ incidental, or consequential damages of any character arising as a
183
+ result of this License or out of the use or inability to use the
184
+ Work (including but not limited to damages for loss of goodwill,
185
+ work stoppage, computer failure or malfunction, or any and all
186
+ other commercial damages or losses), even if such Contributor
187
+ has been advised of the possibility of such damages.
188
+
189
+ 9. Accepting Warranty or Additional Liability. While redistributing
190
+ the Work or Derivative Works thereof, You may choose to offer,
191
+ and charge a fee for, acceptance of support, warranty, indemnity,
192
+ or other liability obligations and/or rights consistent with this
193
+ License. However, in accepting such obligations, You may act only
194
+ on Your own behalf and on Your sole responsibility, not on behalf
195
+ of any other Contributor, and only if You agree to indemnify,
196
+ defend, and hold each Contributor harmless for any liability
197
+ incurred by, or claims asserted against, such Contributor by reason
198
+ of your accepting any such warranty or additional liability.
199
+
200
+ END OF TERMS AND CONDITIONS
201
+
202
+ APPENDIX: How to apply the Apache License to your work.
203
+
204
+ To apply the Apache License to your work, attach the following
205
+ boilerplate notice, with the fields enclosed by brackets "[]"
206
+ replaced with your own identifying information. (Don't include
207
+ the brackets!) The text should be enclosed in the appropriate
208
+ comment syntax for the file format. We also recommend that a
209
+ file or class name and description of purpose be included on the
210
+ same "printed page" as the copyright notice for easier
211
+ identification within third-party archives.
212
+
213
+ Copyright 2017 - 2025 Quarkslab
214
+
215
+ Licensed under the Apache License, Version 2.0 (the "License");
216
+ you may not use this file except in compliance with the License.
217
+ You may obtain a copy of the License at
218
+
219
+ http://www.apache.org/licenses/LICENSE-2.0
220
+
221
+ Unless required by applicable law or agreed to in writing, software
222
+ distributed under the License is distributed on an "AS IS" BASIS,
223
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224
+ See the License for the specific language governing permissions and
225
+ limitations under the License.
@@ -0,0 +1 @@
1
+ pyqbdi
pyqbdi.pyd ADDED
Binary file
pyqbdiWinPreloader.exe ADDED
Binary file
pyqbdipreload.py ADDED
@@ -0,0 +1,160 @@
1
+ #!/usr/bin/env python3
2
+
3
+ # This file is part of pyQBDI (python binding for QBDI).
4
+ #
5
+ # Copyright 2017 - 2025 Quarkslab
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ import platform
20
+ import pyqbdi
21
+ from ctypes import util as ctypesutil
22
+ import sys
23
+ import os
24
+ import argparse
25
+ import subprocess
26
+
27
+ def get_preloadlib():
28
+ if platform.system() == 'Windows':
29
+ import importlib
30
+ # ['.py', '.pyw', '.pyc', '.cp310-win_amd64.pyd', '.pyd']
31
+ # find correct extension on windows like .cp310-win_amd64.pyd
32
+ for ext in importlib.machinery.all_suffixes():
33
+ preloadlib = os.path.join(
34
+ os.path.dirname(pyqbdi.__file__),
35
+ f"pyqbdipreloadlib{ext}")
36
+ if os.path.isfile(preloadlib):
37
+ return preloadlib
38
+ else:
39
+ preloadlib = os.path.join(
40
+ os.path.dirname(pyqbdi.__file__),
41
+ os.path.basename(pyqbdi.__file__).replace("pyqbdi", "pyqbdipreloadlib"))
42
+
43
+ if not os.path.isfile(preloadlib):
44
+ print("Cannot find pyqbdi preload library : {}".format(preloadlib))
45
+ exit(1)
46
+ return preloadlib
47
+
48
+ def find_binary(environ, binary, canFail=False):
49
+ # https://docs.python.org/3.8/library/os.html#os.execve:
50
+ # "execve will not use the PATH variable to locate the executable; path must contain an appropriate absolute or relative path."
51
+ # seach the binary path in PATH if needed
52
+ binarypath = None
53
+ if '/' in binary or '\\' in binary:
54
+ # absolute or relative path
55
+ binarypath = binary
56
+ else:
57
+ if os.path.isfile(binary): # case for current dir on windows
58
+ return binary
59
+ if "PATH" in environ:
60
+ for p in environ["PATH"].split(os.pathsep):
61
+ if os.path.isfile(os.path.join(p, binary)):
62
+ binarypath = os.path.join(p, binary)
63
+ break
64
+
65
+ if not binarypath or not os.path.isfile(binarypath):
66
+ if canFail:
67
+ return None
68
+ print("Cannot find binary {} make sure its in your PATH env".format(binary))
69
+ exit(1)
70
+
71
+ return binarypath
72
+
73
+ def find_windows_inject_binary(environ):
74
+
75
+ listPreloader = [
76
+ os.path.join(os.path.dirname(pyqbdi.__file__), "pyqbdiWinPreloader.exe"),
77
+ "QBDIWinPreloader.exe"]
78
+
79
+ for binary in listPreloader:
80
+ binarypath = find_binary(environ, binary, True)
81
+ if binarypath is not None:
82
+ return binarypath
83
+
84
+ print("Cannot find Windows injector binary (within {}), make sure one of them are available".format(listPreloader))
85
+ exit(1)
86
+
87
+
88
+ def run():
89
+
90
+ parser = argparse.ArgumentParser()
91
+
92
+ parser.add_argument("script", type=str, help="PyQBDI script")
93
+ parser.add_argument("target", type=str, help="command to instrument")
94
+ parser.add_argument("args", type=str, help="command arguments", nargs='*')
95
+
96
+ args = parser.parse_args()
97
+
98
+ script = args.script
99
+ binary = args.target
100
+ execargs = [args.target] + args.args
101
+ environ = os.environ.copy()
102
+
103
+ preloadlib = get_preloadlib()
104
+ binarypath = find_binary(environ, binary)
105
+
106
+ # add LD_PRELOAD or DYLD_INSERT_LIBRARIES
107
+ if platform.system() == 'Darwin':
108
+
109
+ environ["DYLD_INSERT_LIBRARIES"] = preloadlib
110
+ environ["DYLD_LIBRARY_PATH"] = os.path.join(sys.base_prefix, 'lib')
111
+ environ["DYLD_BIND_AT_LAUNCH"] = "1"
112
+ elif platform.system() == 'Linux':
113
+ libpythonname = "python{}.{}".format(
114
+ sys.version_info.major, sys.version_info.minor)
115
+ libpython = ctypesutil.find_library(libpythonname)
116
+ if not libpython:
117
+ libpythonname = "python{}.{}{}".format(
118
+ sys.version_info.major, sys.version_info.minor, sys.abiflags)
119
+ libpython = ctypesutil.find_library(libpythonname)
120
+ if not libpython:
121
+ print("PyQBDI in PRELOAD mode need lib{}.so".format(libpythonname))
122
+ exit(1)
123
+
124
+ for s in [libpython, preloadlib]:
125
+ for c in [" ", ";", os.pathsep]:
126
+ if c in s:
127
+ print(f"Error: found character '{c}' in {s}")
128
+ print(f"PyQBDIPrelaod is based on ld.so, which didn't accept '{c}' in LD_PRELOAD.")
129
+ print("Please check your installation to avoid ' ' and ';' in file path")
130
+ exit(1)
131
+
132
+
133
+ environ["LD_PRELOAD"] = os.pathsep.join([libpython, preloadlib])
134
+ environ["LD_BIND_NOW"] = "1"
135
+ elif platform.system() == 'Windows':
136
+ targetbinary = binarypath
137
+ binarypath = find_windows_inject_binary(environ)
138
+ execargs = [binarypath, preloadlib, targetbinary] + execargs[1:]
139
+ else:
140
+ print("PyQBDI in PRELOAD mode is not supported on this platform")
141
+ exit(1)
142
+
143
+ # add PYQBDI_TOOL
144
+ if not os.path.isfile(script):
145
+ print("Cannot find {} script".format(script))
146
+ exit(1)
147
+ else:
148
+ environ["PYQBDI_TOOL"] = script
149
+
150
+ if platform.system() == 'Windows':
151
+ proc = subprocess.run(execargs, env=environ)
152
+ exit(proc.returncode)
153
+ else:
154
+ os.execve(binarypath, execargs, environ)
155
+ print("Fail execve")
156
+ exit(1)
157
+
158
+
159
+ if __name__ == "__main__":
160
+ run()
Binary file