Commit Graph

335 Commits

Author SHA1 Message Date
lazymio
cdae57fb3d
Generate bindings 2022-04-26 01:17:58 +02:00
lazymio
fbf4078d65
Fix wrong python binding for UC_CTL_TB_REMOVE_CACHE 2022-04-26 01:17:57 +02:00
lazymio
185a6fec9e
Bump bindings version to 2.0.0-rc7 2022-04-17 16:48:12 +02:00
lazymio
8fd9ee3dd0
Bump unicorn version 2022-04-17 16:47:37 +02:00
lazymio
5a79d7879c
Generate bindings 2022-04-16 17:50:32 +02:00
Ilya Leoshkevich
28c4c665f0 Add "holes" to where the removed x86 registers used to be
A number of x86 registers were removed for #1440, causing a change in
numbering for many other registers. This is causing inconveniences at
the moment, e.g. it's not possible to use the Unicorn2 shared library
as a drop-in replacement for the Unicorn1 one.

Restore the old numbering.

Fixes #1492.
2022-03-22 11:31:58 +01:00
lazymio
7f8ff1af6a
Update sample for MRS hook 2022-02-27 15:28:32 +01:00
lazymio
dd96cab9bf
Update bindings 2022-02-27 15:28:32 +01:00
Bet4
504b31b928 Update constants of bindings 2022-02-19 21:24:40 +08:00
lazymio
3ed9dbda13
Update bindings 2022-02-15 22:08:27 +01:00
lazymio
c10639fd46
Bump version in bindings 2022-02-13 11:03:57 +01:00
lazymio
16e9efa4f5
Bump version 2022-02-13 09:56:10 +01:00
lazymio
15f3b58d9b
Implement coprocessor register read/write for python bindings 2022-02-11 23:03:56 +01:00
lazymio
89a1da9a33
Update bindings 2022-02-11 22:42:31 +01:00
mio
f57467e7ed
Generate bindings 2022-01-19 20:10:09 +01:00
mio
7095605607
Merge branch 'dev' into systemz 2022-01-18 21:10:55 +01:00
mio
c84dbac9a8
Rename build dir for python bindings 2022-01-18 20:15:28 +01:00
mio
28e791a37f
Add debug tracing feature
It's disabled by default, use -DUNICORN_TRACER=on to enable it
2022-01-18 19:35:43 +01:00
lazymio
06be6fdc24
Merge pull request #1537 from gerph/clear-pending-hook-exception-before-emulation
Clear Python pending hook exception before we enter the emulation.
2022-01-15 22:13:24 +01:00
lazymio
459a595a98
Merge branch 'dev' into s390x
Mostly for bindings update.
2022-01-15 20:56:39 +01:00
lazymio
dfb0446137
Update bindings 2022-01-15 20:56:24 +01:00
Charles Ferguson
1ba59ed70a Clear Python pending hook exception before we enter the emulation.
The pending exception hook is set when the hook raised an exception
and wants to report it outside the emulation loop. However, it is
never cleared back to None. This means that after an exception is
raised in a hook, all subsequent execution (even if successful) will
raise the exception.

This change clears the exception before we start another emulation,
which should ensure that if we have _hook_exception set, it really
is from hooks in this emulation run.
2022-01-15 17:45:45 +00:00
lazymio
71f044ca50
Merge branch 'dev' into s390x 2022-01-10 15:17:42 +01:00
lazymio
c671efe798
Update bindings 2022-01-05 22:00:59 +01:00
lazymio
c4b4189857
Update bindings 2022-01-04 21:12:52 +01:00
mio
8b0285e135
Add python support for s390x 2022-01-01 00:58:10 +01:00
lazymio
3184d3fcdf
Update python bindings 2021-12-22 20:46:14 +01:00
lazymio
10d88e89a5
Fix uc_version and bump again 2021-11-25 18:19:46 +01:00
lazymio
9a4d5d0be8
Bump bindings version to 2.0.0-rc5 2021-11-25 14:29:41 +01:00
mid-kid
2d665aa752 Accomodate for setting a different CMAKE_GENERATOR in the environment.
This makes sure the right build utility is called, depending on the
value of the CMAKE_GENERATOR environment.
2021-11-13 13:34:11 +01:00
lazymio
0714fb5760
Bump bindings version 2021-11-09 00:23:19 +01:00
lazymio
9abbba173c
Update python bindings 2021-11-07 21:00:05 +01:00
lazymio
923b4ad3cc
Update python bindings 2021-11-04 21:47:30 +01:00
lazymio
b9c0066a47
Format and naming 2021-11-04 20:04:57 +01:00
lazymio
db90f39ac6
Generate bindings 2021-11-04 20:01:19 +01:00
Bet4
aaf340d9e4 Merge branch 'dev' into patch 2021-11-02 18:36:22 +08:00
lazymio
090686f8ed
uc_ctl proposal (#1473)
* Add uc_ctl

* Add comments

* Slightly changed for bindings generation

* Generate bindings
2021-10-30 10:45:32 +08:00
lazymio
9e1443013b
Fix gen_const 2021-10-26 13:10:59 +02:00
lazymio
e695686c15
Remove AFL Integration by reverting 2021-10-26 11:22:21 +02:00
lazymio
17963ff4aa
Update python bindings for afl 2021-10-25 01:27:51 +02:00
lazymio
f08b7d6b5b
Make gen_const work and updates constants 2021-10-25 00:57:32 +02:00
insane-shane
47ecfc1b2c Handle exceptions raised in Python hook functions (#1387) 2021-10-12 08:35:52 +08:00
mio
8f7ecfe48b
Support configure threads by environment variable 2021-10-10 23:46:22 +02:00
lazymio
ad3c0a5b32
Bump python bindings version 2021-10-06 12:37:13 +02:00
mio
2474f9513b
Sync docs from wiki and remove cmake.sh 2021-10-05 15:26:13 +02:00
mio
5668fd9c42
Set zip_safe and is_pure to False and trigger another build 2021-10-05 15:11:59 +02:00
mio
59deed7484
Simply the setup.py 2021-10-05 14:46:04 +02:00
mio
aff9c9dc48
Clean debug print and make it compatible with python3.5 2021-10-05 13:48:26 +02:00
mio
e1204d8977
Specify the content type 2021-10-04 18:09:44 +02:00
chfl4gs
e571dc278a PyPI publishing 2021-10-04 22:22:41 +08:00
Nguyen Anh Quynh
e8bd7ca087 bindings: update X86 register constants 2021-10-04 19:41:41 +08:00
mio
ebb468d042
Fix msvc build 2021-10-04 10:44:30 +02:00
Nguyen Anh Quynh
aaaea14214 import Unicorn2 2021-10-03 22:14:44 +08:00
Nguyen Anh Quynh
2874435d2f bump version to 1.0.3 2021-05-16 21:38:08 +08:00
insane-shane
4f9a6cfcf3
Handle exceptions raised in Python hook functions (#1387) 2021-04-26 00:35:56 +08:00
w4kfu-synacktiv
21ec6e8f83
Add ARM BE8 support (#1369)
Co-authored-by: w4kfu <gw4kfu@gmail.com>
2021-03-31 21:22:35 +08:00
lazymio
1044403d38
Implement uc_context_free (#1336)
* Implement uc_context_free

* Use uc_context_free for python bindings

* Format code

* Simplify code

* Move next,context inside while loop

* Add my name to CREDITS.TXT
2020-09-24 22:28:55 +08:00
lazymio
4441394258
Fix context saving (#1335)
* Fix context size

* Make UcContext convertible to bytes and picklable

Fix when updaing context

* Test context pickling

* Fix double free when the context is pickled from bytes
2020-09-24 00:53:23 +08:00
☃ Stephen Shkardoon ☃
b1459f7554
Fix failing test caused by removal of UC_ERR_TIMEOUT (#1305)
Caused by fbef45b18f.
Now the code assumes if it completes without an error, it was
successful.
2020-09-21 10:37:38 +08:00
chfl4gs
c03f50f76a
Fixing installation on cygwin, Travis-ci cache adjustment (#1322)
* Adding Travis-CI cmake static

* fix 64-bit fstenv (#1300)

* fix 64-bit fstenv

* fix fstenv

* safe_zip to false and travis adjustment

* Fixed zip_safe and cygwin setup

Co-authored-by: liangjs <761232680@qq.com>
2020-09-10 10:01:13 +08:00
Nguyen Anh Quynh
564ae2b14a python: correct a comment on hooking on sample_arm64.py. fix #1292 2020-06-10 17:56:01 +08:00
chfl4gs
9288b4a845
adding pypi workflow (#1280)
* adding pypi workflow

* PyPI distribution packages workflow
2020-06-06 12:53:31 +08:00
Nguyen Anh Quynh
2e0f753e6f save cpu->jmp_env in saving context, so uc_emu_start() can be reentrant. also improved Python binding on handling context 2020-06-05 20:12:44 +08:00
Nguyen Anh Quynh
99be837364 python: add long description to setup.py 2020-05-29 11:56:24 +08:00
Nguyen Anh Quynh
fbef45b18f remove UC_ERR_TIMEOUT, so timeout on uc_emu_start() is not considered error. added UC_QUERY_TIMEOUT to query exit reason 2020-05-24 23:54:45 +08:00
Nguyen Anh Quynh
cf3451c37a bindings: update ARM64 registers 2020-05-10 21:51:14 +08:00
Dominik Maier
625399774c
X64 base regs (#1166)
* x86: setup FS & GS base

* Fixed base register writes for x64, removed then for x16/x32 (the don't exist there?)

* FS reg comes before GS so the base regs do so, too

* added shebang to const_generator.py

* Added base regs to and added 'all' support to const_generator

Co-authored-by: naq <aquynh@gmail.com>
2020-05-05 08:34:51 +08:00
Pedro Tammela
18aa2627f7
fix binding install on python2 (#1231) 2020-04-24 17:15:12 +08:00
Saagar Jha
d69ebfa55c
Make it easier to link against libunicorn on macOS (#1195)
Adding @rpath to the install name to make it possible to link against
the library without modifying it with install_name_tool. Copying both
the versioned and unversioned dylibs simplifies linking.
2020-02-12 14:16:34 +08:00
Nguyen Anh Quynh
810bd34eef python: handle UC_ERR_TIMEOUT, so sample_x86.py behaves like sample_x86.c 2020-01-01 10:11:16 +08:00
Nguyen Anh Quynh
b0d5837c61 bindings: add UC_ERR_TIMEOUT 2019-12-29 00:19:34 +08:00
Audrey Dutcher
3cea38bff7 restrict msbuild to win32 platform (#1172) 2019-11-20 00:34:56 +08:00
naq
3b17db0d84 bindings: update after the last commit on adding ARM modes 2019-10-26 05:02:39 +08:00
Audrey Dutcher
fd3ccb2ef7 Python packaging logic for msvc build (#1151)
* remove bundling of DLLs we no longer need!

* Add logic for building with msvc in python setup

* Also include the msvc build scripts with sdist
2019-10-10 22:00:42 +08:00
Azertinv
07f94ad1fc Added an invalid instruction hook (#1132)
* first draft for an invalid instruction hook

* Fixed documentation on return value of invalid insn hook
2019-09-23 01:53:06 +08:00
AeonLucid
c46e745338 Fixes #1143 (#1144) 2019-09-16 01:58:08 +08:00
BAYET
8987ad0fff Handle serialization of cpu context save (#1129)
* Handle the cpu context save in a more pythonic way, so the context can be serialized and reuse in an other process using the same emulator architecture and modes

* Fix type error ; mistakes a size_t uint64_t ; breaks in 32bit...
2019-09-07 19:09:17 +08:00
kj.xwings.l
24f55a7973 Removed hardcoded CP0C3_ULRI (#1098)
* activate CP0C3_ULRI for CONFIG3, mips

* updated with mips patches

* updated with mips patches

* remove hardcoded config3

* git ignore vscode

* fix spacing issue and turn on floating point
2019-07-06 17:53:02 +08:00
Lukas Dresel
55d8d073bd support for YMM registers ymm8-ymm15 (#1079) 2019-04-01 11:00:34 +08:00
Nguyen Anh Quynh
07cafff76a bindings: update for latest ARM registers addition 2019-03-07 08:38:41 +08:00
Nguyen Anh Quynh
6d47b38b7f bindings: update after recent addition of ARM_REG_IPSR 2019-02-28 09:56:29 +08:00
Nguyen Anh Quynh
738d102989 bindings: add newly added register MXCSR 2019-02-15 13:01:27 +08:00
kj.xwings.l
8c6cbe3f3c update python binding samples, shellcode.py with 64bit syscall (#1052)
* update python binding samples, shellcode.py with 64bit syscall

* fix with quynh comments

* fix with more q comments

* reformatted

* reformatted and moved file

* reformatted and moved file

* delete file

* delete dead code

* deleted more dead code

* deleted more dead code / fix bugs

* fix 64bit eip intno eax

* rearrage rip

* Inconsistent print
2019-01-15 14:57:11 +08:00
Disconnect3d
19ffa83d43 Fix naming in Python sample_x86.py (#961) 2018-05-07 09:44:27 +08:00
Nguyen Anh Quynh
41cc047b87 bindings: update after #922 2017-12-20 22:13:29 +08:00
Andrew Dutcher
12642c2555 Cleanups/fixes for the library issue conglomerate (#897)
* Python: Disable distribution of static library on linux and macos; add environment variable LIBUNICORN_PATH to let user specify location of native library; prevent build of native library if this option is enabled; closes #869

* Python: Update README.TXT to describe how to manage the building and usage of the native library
2017-09-24 22:33:01 +08:00
Benno Fünfstück
b0b5f8442d python: Fix exception in finalizer at exit (#873)
Sometimes, the finalizer for an `UcRef` runs so late that the members of the
module have already been set to `None`. We need to make sure that we don't
depend on anything in the module, or we risk getting a Exception when we try
to access the `release_handle` method of `None` (`Uc`).
2017-09-15 22:21:25 +07:00
Andrew Dutcher
744c34261f Don't error during sdist if config-host.mak doesn't exist (#846) 2017-05-31 11:36:33 +08:00
misson20000
3fdb2d2442 add architecture query (#842) 2017-05-21 09:47:02 +08:00
Fangrui Song
85e0a54e35 Fix Python 3 samples (#836) 2017-05-15 09:11:22 +08:00
misson20000
014ccfb94a Aarch64 add thread registers (#834)
* add thread registers to AArch64

* update bindings to add AArch64 thread registers

* fix indentation for register read/write switch-case in unicorn_aarch64.c
2017-05-14 14:42:49 +07:00
Samuel Groß
5385baba39 Implemented read and write access to the YMM registers (#819) 2017-05-05 09:02:58 +08:00
zhangwm
4a62409949 arm64eb: arm64 big endian also using little endian instructions. (#816)
* arm64eb: arm64 big endian also using little endian instructions.

* arm64: using another example that depends on endians.

example:
1. store a word: 0x12345678
2. load a byte:
   * little endian : 0x78
   * big endian    : 0x12
2017-05-04 20:00:48 +08:00
Ryan Hileman
187b470245 add arm64 CPACR_EL1 register support (#814) 2017-05-02 14:51:19 +08:00
Nguyen Anh Quynh
2bd40b9c91 update armeb & arm64eb samples 2017-04-25 12:55:26 +08:00
zhangwm
2e973a13f0 arm64eb: add support for ARM64 big endian. 2017-04-24 23:30:01 +08:00
Nguyen Anh Quynh
5dbc640b9a bump UC_VERSION_EXTRA to 1 2017-04-20 14:14:24 +08:00
Nguyen Anh Quynh
7441cfe4e5 Update unicorn.py
space
2017-04-18 07:46:12 +08:00
tylerni7
4f07910eae handle not having a path (#798) 2017-04-18 07:44:48 +08:00
zhangwm
d2740b17ce armeb: add C sample for armeb. 2017-03-13 23:19:09 +08:00
zhangwm
d8fe34a2e8 armeb: Add support for ARM big endian. 2017-03-13 22:32:44 +08:00
feliam
0150ca24b1 Add support for ARM application flags - APSR register (#776) 2017-03-09 22:28:03 +08:00
stevielavern
b3a5eae81c uc_reg_read & uc_reg_write now support ARM64 Neon registers (#774)
* uc_reg_read & uc_reg_write now support ARM64 Neon registers

* Do not reuse uc_x86_xmm for uc_arm64_neon128. TODO: refactor both classes to use the same parent.
2017-03-07 21:29:34 +08:00
Nguyen Anh Quynh
f4325f8c4e bindings: update to support X86 MSR id 2017-02-24 21:51:01 +08:00
Ahmed Samy
02e6c14e12 x86: add MSR API via reg API (#755)
Writing / reading to model specific registers should be as easy as
calling a function, it's a bit stupid to write shell code and run them
just to write/read to a MSR, and even worse, you need more than just a
shellcode to read...

So, add a special register ID called UC_X86_REG_MSR, which should be
passed to uc_reg_write()/uc_reg_read() as the register ID, and then a
data structure which is uc_x86_msr (12 bytes), as the value (always), where:
	Byte	Value		Size
	0	MSR ID		4
	4       MSR val		8
2017-02-24 21:37:19 +08:00
Nguyen Anh Quynh
b616115df1 update ChangeLog 2017-01-25 12:00:18 +08:00
Nguyen Anh Quynh
a735576dd3 python: support uc_mem_regions() API 2017-01-24 12:47:27 +08:00
Nguyen Anh Quynh
5a1e86d46b update Windows DLL dependency 2017-01-22 00:39:21 +08:00
hedger
d2b7d13443 Fixed circular refs preventing Uc instances from being GC'd. Added a test case, requires objgraph module. 2017-01-11 18:23:21 +03:00
Nguyen Anh Quynh
bc569f5a54 rename API uc_mem_free() to uc_free(). see #662 2017-01-10 20:59:14 +08:00
Nguyen Anh Quynh
fdbbdc6216 rename uc_context_free() to uc_mem_free(). see #373 2017-01-09 20:52:14 +08:00
Andrew Dutcher
7bd4d62dcb Copy prebuilt static library if available. Disallow uploads from builds that fail to provide the static library 2017-01-04 06:45:18 -08:00
Andrew Dutcher
5d8934f5a9 Python: Automatically conform to PEP440 for version numbers 2017-01-04 05:51:55 -08:00
Nguyen Anh Quynh
9a79d6fe9f Merge branch 'master' into noglib2 2016-12-27 16:48:23 +08:00
Andrew Dutcher
bf2cd79a4d Windows: export a static lib that can be used outside of mingw (#699)
* Windows: export a static lib that can be used outside of mingw

* Add comments to windows_export.bat
2016-12-27 16:30:07 +08:00
me
1d85d1763d Merge branch 'master' into noglib 2016-12-24 13:21:53 +08:00
Antoine
a7dddf6c5f python bindings: restore FreeBSD support (#698)
* python bindings: restore FreeBSD support

* python binding: use libunicorn.so if the platform is unknown
2016-12-24 00:59:19 +08:00
Chris Eagle
e46545f722 remove glib dependency by provide compatible replacements 2016-12-18 14:56:58 -08:00
Nguyen Anh Quynh
bd339533ca python: comment out a debug code 2016-12-04 20:46:52 +07:00
Nguyen Anh Quynh
4613580e07 python: typo 'prebuilt' dir 2016-12-04 18:18:24 +08:00
Nguyen Anh Quynh
e34812c7dd fix merge conflict 2016-11-20 16:36:56 +08:00
Nguyen Anh Quynh
2a4c316b6f python: correct a comment on sample_arm.py 2016-11-19 16:51:08 +08:00
Andrew Dutcher
188a1d78d3 Allow dlls to be copied out of prebuilt directory 2016-11-17 20:59:39 -08:00
Stephen
9f0cdc4be9 Update .travis.yml
Update eflags_nosync.c
Update sigill2.c
Update ro_mem_test.c
Update ro_mem_test.c
Update nr_mem_test.c
Update mem_fuzz.c
Update mem_double_unmap.c
Update emu_stop_in_hook_overrun.c
Update eflags_nosync.c
remove unused
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update mem_64_c.c
Update mem_64_c.c
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update .travis.yml
try android ndk build
Update unicorn.py
Update unicorn.py
Update Makefile
Update unicorn.py
Update unicorn.py
remove an untrue comment

if a dll/so/dylib gets loaded at runtime is dependent on many different factors, primarily the LD/DYLD paths. Those do not always include the current working directory
Update Makefile
Update .appveyor.yml
Update .travis.yml
Update Makefile
Update .appveyor.yml
Fix bad sample
2016-11-11 07:45:06 -08:00
Stephen
186540e160 make cleanup 2016-11-06 16:27:24 -08:00
Andrew Dutcher
876570c8d7 Fixes to make python distribution for windows work 2016-11-05 09:18:50 -07:00
Nguyen Anh Quynh
f8e82485da python: print out _path_list with next line 2016-11-05 01:55:12 +08:00
Nguyen Anh Quynh
88bd6453d5 python: add a debug code to print out _path_list 2016-11-05 01:51:13 +08:00
Nguyen Anh Quynh
ffa36b9001 python: remove redundant free() prototype. bug reported by Mahin 2016-11-01 08:57:33 +08:00
Nguyen Anh Quynh
4d5738eeb5 python: revert the changes on APIs made by @mrphrazer 2016-10-27 16:45:10 +08:00
Tim Blazytko
17fd89a27b python bindings: updated signed reg fix 2016-10-26 09:13:19 +02:00
Tim Blazytko
632f3aaa71 fixed python bindings signed/unsigned regs/mem 2016-10-25 20:43:01 +02:00
Nguyen Anh Quynh
7a1930a879 add UC_VERSION_{MAJOR, MINOR, EXTRA} 2016-10-25 14:37:47 +08:00
Nguyen Anh Quynh
4083b87032 add new hook type UC_HOOK_MEM_READ_AFTER, adapted from PR #399 by @farmdve. updated all bindings, except Ruby & Haskell 2016-10-22 11:19:55 +08:00
Nguyen Anh Quynh
67905ab147 python: rename test_i386_reg_save() to test_i386_context_save() 2016-10-13 20:57:34 +08:00
Andrew Dutcher
bfa51bb5dc rename another saved regs to saved context 2016-10-11 13:07:53 -07:00
Andrew Dutcher
1ab2154fe5 Change save/restore API to have explicit alloc/free functions. Python has explicit save/update functions. 2016-10-07 11:39:42 -07:00
Nguyen Anh Quynh
73577cbcd1 rename uc_regstate_restore to uc_context_restore, uc_context_save to uc_context_save 2016-10-07 10:03:19 +08:00
Nguyen Anh Quynh
b7cdbe7a88 Merge branch 'feat/reg_save_restore' of https://github.com/rhelmot/unicorn into rhelmot-feat/reg_save_restore 2016-10-07 09:57:07 +08:00
Andrew Dutcher
e3b0e52013 Rename save/restore functions to match the style of the rest of the API 2016-09-28 21:21:44 -07:00
Riccardo Schirone
c16a13495d bindings/python: fix install3 2016-09-20 14:22:38 +00:00
Nguyen Anh Quynh
4188c4cbca Merge branch 'master' into rhelmot-feat/setup_stuff 2016-09-20 21:00:38 +08:00
esanfelix
7d99b598f1 Fix #638 for python sample too 2016-09-20 10:29:21 +02:00
Andrew Dutcher
ac99b5bd14 Minor tweaks to python setup process; update gitignore 2016-09-12 14:06:50 -07:00
Andrew Dutcher
47af3ca190 Remove PKG-INFO make lines left over from the original capstone skeleton 2016-09-12 14:06:20 -07:00
Andrew Dutcher
edd49cd21c Remove version number from shared library filename packaged with python bindings 2016-09-12 14:06:20 -07:00
Andrew Dutcher
6c042410ae Basically, make python builds work as expected 2016-09-12 14:06:20 -07:00
Andrew Dutcher
885b809004 Add python bindings for reg save/restore 2016-09-08 14:40:39 -07:00
4577
1f978de447 Remove BUILDDIR-specific code 2016-09-04 08:59:31 +02:00
Andrew Dutcher
41b5aa0bdc Change xmm struct names, for style and for correctness 2016-08-22 17:29:13 -05:00