Commit graph

420 commits

Author SHA1 Message Date
Nguyen Anh Quynh
d553dbf3eb python: raise CsError(CS_ERR_SKIPDATA) when accessing irrelevant data in skipdata mode. this fixes issue #679 2018-07-18 13:37:45 +08:00
Nguyen Anh Quynh
3f9978c809 Revert "Merges encoding branch (#1187)"
This reverts commit a1ed8fc6f6.
2018-07-03 11:55:29 +08:00
Stephen Eckels
a1ed8fc6f6 Merges encoding branch (#1187)
* Added encoding field to instructions, as per encoding branch

The encoding branch appears to have added some useful fields
accessible from the public API, including the size and offsets
of displacements and immediates in instructions.  I needed access
to these fields, but the encoding branch is months behind the
active branches, so I took the minimum code from the old encoding
branch and put them into a more recent version of master.

It does seem that the most recent version does not have an offset
for the modRM byte in the InternalInstruction struct, so I did
not keep this field when bringing it to the more recent version.

I also added some of the changes made by user jellever, who added
support for accessing these new fields from the python bindings.

(cherry picked from commit d358c4b987cc77af90e24da15937e021c42f682f)

* Fixed bug with python bindings from adding encoding field

I had forgotten an import that resulted in failure when trying
to obtain instruction details.

(cherry picked from commit 44a15e378900efb624e7cdb952d32558ba0de684)

* promoted displacement to 64 bits

* Added modrm offset

* formatting from review fixed

* updated 32 bit C tests

* Added 64 and 16 bit C tests

* Updated python tests

* fixed formatting and size in py bindings

* Delete Solution.VC.db-shm

* Delete Solution.VC.db-wal

* Update test_x86.c

* fixed formatting and conditional prints

* fixed formatting
2018-06-28 21:37:34 +08:00
Catena cyber
60ca025dd8 Better error reporting for python binding (#1188)
To diagnose issue with oss-fuzz building corpus
2018-06-25 01:35:59 +08:00
Nguyen Anh Quynh
8879b5d6cc python: import os 2018-02-25 23:00:40 +08:00
Audrey Dutcher
aeda70f3cb Add option for inhibiting the core build while installing the python components. Add option for loading the core from a custom path. (#1089) 2018-02-20 21:11:19 +08:00
tdube
cdf523ce12 Update setup.py (#1073)
Check to make sure static library file exists before trying to copy it. Current build options include option to not build a static lib.
2018-01-15 13:30:51 +08:00
Nguyen Anh Quynh
f48111db0e bindings: update after #1064 2017-12-21 09:14:05 +08:00
Nick Briggs
ce3f0d0935 Rename test.c to test_basic.c with corresponding executable name change. (#923)
* Rename test.c to test_basic.c with corresponding executable name change.

* Fix Makefile, tests/Makefile to comprehend renamed test program. See issue #922

* Fix XCode project to comprehend renamed test program.  See issue #922

* Rename python test.py to test_basic.py to parallel C test name.  See issue #922

* Rename ocaml test.ml to test_basic.ml to parallel C test name.  See issue #922

* Fix MSVC project definitions to comprehend renamed test program.  See issue #922
2017-05-11 22:58:12 +07:00
Nguyen Anh Quynh
54f4863303 python: add a debug line 2017-04-19 23:19:00 +08:00
Andrew Dutcher
9d3e929ae6 Add ability to copy prebuilt libraries from prebuilt directory during python build 2017-03-04 17:09:07 -08:00
Nguyen Anh Quynh
85c1b4b687 Python: Automatically conform to PEP440 for version numbers. ported from Unicorn Python binding 2017-02-01 13:11:21 +08:00
Nguyen Anh Quynh
665d404b0d python: bump version to 3.0.5 2016-10-26 10:52:53 +08:00
Nguyen Anh Quynh
ef4b5c9dcf python: capitalized cython name 2016-10-26 04:52:58 +08:00
Andrew Dutcher
e29ddbdbb3 Python: Actually attempt to load .so.3 extension on linux 2016-10-25 12:56:10 -07:00
Andrew Dutcher
5db5ec817b Python: Spelling/capitalization/contact fixes in readme 2016-10-25 12:56:10 -07:00
Andrew Dutcher
cffc988d60 Minor english fixes 2016-10-25 12:56:10 -07:00
Andrew Dutcher
aa07e1c7f3 Python: remove special case for cygwin build 2016-10-25 12:56:10 -07:00
Andrew Dutcher
b7f4930ad7 Python: Make cython work with extreme prejudice 2016-10-25 12:56:10 -07:00
Andrew Dutcher
85cd24b562 Python: Clean up the capstone-windows stuff with extreme prejudice 2016-10-25 12:56:10 -07:00
Andrew Dutcher
ced66e3b77 Python: make setup work as expected 2016-10-25 12:56:10 -07:00
Nguyen Anh Quynh
f585a84966 add CS_VERSION_{MAJOR, MINOR, EXTRA} 2016-10-25 14:23:55 +08:00
Richo Healey
72daee3d07 Workaround unicorn handing back bytearrays 2016-10-05 22:47:40 -07:00
Benno Fünfstück
23fe9f3662 python-bindings: fix setup.py for wheel installation
When the python bindings are installed using the new wheels
infrastructure, data_files are relative to the site-packages directory
even if using absolute paths.

The following example demonstrates the bug fixed by this commit: (ran on archlinux)

```bash
$ pip install wheel       # if this package is installed, wheel installation is made the default
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |################################| 71kB 124kB/s
Installing collected packages: wheel
Successfully installed wheel-0.29.0

$ pip install capstone    # this will use the wheel installation method now
Collecting capstone
  Using cached capstone-3.0.4.tar.gz
Building wheels for collected packages: capstone
  Running setup.py bdist_wheel for capstone ... done
  Stored in directory: /root/.cache/pip/wheels/7c/d1/d0/db6e2c5ef1063aabb9de2dd8b92b4c27ee6f9fd213240099b8
Successfully built capstone
Installing collected packages: capstone
Successfully installed capstone-3.0.4

$ find /usr/lib/ -name "libcapstone.so"
/usr/lib/python3.5/site-packages/usr/lib/python3.5/site-packages/capstone/libcapstone.so
```

So the path `SITE_PACKAGES` in the `data_files` specification of the
setup.py file was interpreted relative to the python site-packages
directory. The fix for this is simple: use `/capstone` instead of an
absolute path for `SITE_PACKAGES`.
2016-10-02 15:25:13 +02:00
Nguyen Anh Quynh
5b80627a5d python: cast skipdata function inside binding to simplify the API 2016-10-02 01:36:03 +08:00
Nguyen Anh Quynh
0662879d35 python: fix CS_SKIPDATA_CALLBACK prototype 2016-10-01 01:33:09 +08:00
Akihiko Odaki
c2cdb006fd arm: treat ARM address as unsigned
It should be unsigned because:
* It does arithmetic operations
* Format strings have "%u" instead of "%d"
2016-09-03 14:28:46 +09:00
Andrew Dutcher
1647720656 Python bindings: Changes to how structures are copied so that capstone works correctly in PyPy 2016-06-09 19:04:27 -07:00
Sean Heelan
1e608ef4c5 __getattr__ should raise AttributeError, not return None, on failure
Fix for issue #624
2016-04-18 17:52:10 +08:00
jmechnich
23f1203616 bugfix: removed leading ./ from OBJDIR to avoid corrupting setup.py install 2016-03-26 10:29:52 +08:00
Nguyen Anh Quynh
c586269900 python: add __version__ 2016-03-06 21:28:45 +08:00
Michael Cohen
8d2642fa6a Support all OSs. 2016-02-11 23:43:22 +01:00
Michael Cohen
7032ff2802 Fix setup.py. 2016-02-11 15:24:17 +01:00
Raijinili
b0c5436558 Python 3: CsError.__str__
Choose `CsError.__str__` implementation based on Python version.
2015-11-30 23:51:25 -05:00
Nguyen Anh Quynh
2b3a298609 python: perform the last dylib loader only if it fails before that (for El Capitan) 2015-10-19 20:04:47 +08:00
Nguyen Anh Quynh
f49ac59fd3 Merge pull request #515 from strazzere/master
Add OSX 10.11 dylib load fix
2015-10-17 11:06:40 +08:00
Tim Strazzere
f9ddf05bdb Add OSX 10.11 dylib load fix
El Capitan does not guaranteed that
(DY)LD_LIBRARY_PATH will exist, so force
one last check for the default install
directory that the install script uses.
2015-10-16 17:09:00 -07:00
Nicolas PLANEL
e72bd24c97 [binding][python] fixup python 3 compatibility
In Python 3.x dict.keys() return a dict_keys object not a list.
2015-10-04 10:44:17 +08:00
Nicolas PLANEL
8b25b0abcf file.write() need bytes when file is opened in binary mode 2015-10-04 00:31:25 +08:00
Nguyen Anh Quynh
e710e4fcf4 python: do not copy msvc/headers directory in setup.py 2015-07-15 15:44:42 +08:00
Nguyen Anh Quynh
2bb3933260 Merge branch 'master' into v3 2015-06-22 16:50:35 +08:00
Alex Chernetz
801178bea4 [Python binding] Fix setup.py to allow installing in a virtualenv
In a virtualenv:
- site.getusersitepackages() won't import
- get_python_lib() will return the directory inside the virtualenv
- the "--user" option can therefore be safely ignored.
2015-06-19 23:22:36 -07:00
Nguyen Anh Quynh
33bf2d11b9 bump version to 3.0.4 2015-06-08 22:29:55 +08:00
Nguyen Anh Quynh
1ea95a15ed Merge branch 'patch-1' of https://github.com/neuromancer/capstone into t5 2015-06-04 21:40:58 +08:00
Nguyen Anh Quynh
46ab570881 python: shared library can be unloaded from under our feet. issue reported by @joelpx 2015-06-04 11:38:26 +08:00
neuromancer
6fd804412a Allow local installations of the python bindings
These changes will allow a pypi user to locally install capstone using the --user flag. If it possible, please update the correspondent package (https://pypi.python.org/pypi/capstone/3.0.3)
2015-06-02 14:31:36 +02:00
Nguyen Anh Quynh
179af6ad66 python: cleanup README.pypi-win 2015-05-15 17:04:16 +08:00
Nguyen Anh Quynh
d70f21adb1 python: update PyPi packages installation doc 2015-05-15 17:01:18 +08:00
Nguyen Anh Quynh
06bc3f6cad cython: bump version in setup_cython.py to 3.0.3 2015-05-12 09:33:38 +08:00
Zach Riggle
745ac64729 Fix error when _cs is None during teardown 2015-05-12 09:26:59 +08:00