Commit graph

420 commits

Author SHA1 Message Date
Nguyen Anh Quynh
a1ccc8ebda 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
1036de09bf Revert "Merges encoding branch (#1187)"
This reverts commit a1ed8fc6f6d779a0e1610d43186811732d196c1c.
2018-07-03 11:55:29 +08:00
Stephen Eckels
699611072b 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
154c9ffdd8 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
c21f94d565 python: import os 2018-02-25 23:00:40 +08:00
Audrey Dutcher
10c4aa807d 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
1a1077db01 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
0acbc9e346 bindings: update after #1064 2017-12-21 09:14:05 +08:00
Nick Briggs
2aedb8168c 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
2bf26fe448 python: add a debug line 2017-04-19 23:19:00 +08:00
Andrew Dutcher
425bf530f2 Add ability to copy prebuilt libraries from prebuilt directory during python build 2017-03-04 17:09:07 -08:00
Nguyen Anh Quynh
3925b332ce Python: Automatically conform to PEP440 for version numbers. ported from Unicorn Python binding 2017-02-01 13:11:21 +08:00
Nguyen Anh Quynh
3bd582ef64 python: bump version to 3.0.5 2016-10-26 10:52:53 +08:00
Nguyen Anh Quynh
6bb33edf7e python: capitalized cython name 2016-10-26 04:52:58 +08:00
Andrew Dutcher
4c4d129f86 Python: Actually attempt to load .so.3 extension on linux 2016-10-25 12:56:10 -07:00
Andrew Dutcher
97422c15bd Python: Spelling/capitalization/contact fixes in readme 2016-10-25 12:56:10 -07:00
Andrew Dutcher
ffd5320690 Minor english fixes 2016-10-25 12:56:10 -07:00
Andrew Dutcher
a75324fc03 Python: remove special case for cygwin build 2016-10-25 12:56:10 -07:00
Andrew Dutcher
c3f602e71d Python: Make cython work with extreme prejudice 2016-10-25 12:56:10 -07:00
Andrew Dutcher
21a241192c Python: Clean up the capstone-windows stuff with extreme prejudice 2016-10-25 12:56:10 -07:00
Andrew Dutcher
3c9a1eea08 Python: make setup work as expected 2016-10-25 12:56:10 -07:00
Nguyen Anh Quynh
6624dc446e add CS_VERSION_{MAJOR, MINOR, EXTRA} 2016-10-25 14:23:55 +08:00
Richo Healey
9413509982 Workaround unicorn handing back bytearrays 2016-10-05 22:47:40 -07:00
Benno Fünfstück
df96d9ee6d 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
744181744f python: cast skipdata function inside binding to simplify the API 2016-10-02 01:36:03 +08:00
Nguyen Anh Quynh
a83352a33b python: fix CS_SKIPDATA_CALLBACK prototype 2016-10-01 01:33:09 +08:00
Akihiko Odaki
2876044815 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
0ed9820d2f 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
6f043f1635 __getattr__ should raise AttributeError, not return None, on failure
Fix for issue #624
2016-04-18 17:52:10 +08:00
jmechnich
066febc6fe bugfix: removed leading ./ from OBJDIR to avoid corrupting setup.py install 2016-03-26 10:29:52 +08:00
Nguyen Anh Quynh
3ffc798787 python: add __version__ 2016-03-06 21:28:45 +08:00
Michael Cohen
29ee560688 Support all OSs. 2016-02-11 23:43:22 +01:00
Michael Cohen
ff5b295b88 Fix setup.py. 2016-02-11 15:24:17 +01:00
Raijinili
491ebd217a Python 3: CsError.__str__
Choose `CsError.__str__` implementation based on Python version.
2015-11-30 23:51:25 -05:00
Nguyen Anh Quynh
5def39eab0 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
6c22904682 Merge pull request #515 from strazzere/master
Add OSX 10.11 dylib load fix
2015-10-17 11:06:40 +08:00
Tim Strazzere
36cabb6b1d 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
a496bbfc0c [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
65106cfde7 file.write() need bytes when file is opened in binary mode 2015-10-04 00:31:25 +08:00
Nguyen Anh Quynh
932381aacc python: do not copy msvc/headers directory in setup.py 2015-07-15 15:44:42 +08:00
Nguyen Anh Quynh
1a7a13e4da Merge branch 'master' into v3 2015-06-22 16:50:35 +08:00
Alex Chernetz
5799c485a6 [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
ebc370ff40 bump version to 3.0.4 2015-06-08 22:29:55 +08:00
Nguyen Anh Quynh
0c391bb88b Merge branch 'patch-1' of https://github.com/neuromancer/capstone into t5 2015-06-04 21:40:58 +08:00
Nguyen Anh Quynh
8ac478bd4b python: shared library can be unloaded from under our feet. issue reported by @joelpx 2015-06-04 11:38:26 +08:00
neuromancer
911d0506cd 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
cff5186e08 python: cleanup README.pypi-win 2015-05-15 17:04:16 +08:00
Nguyen Anh Quynh
53c2b0a290 python: update PyPi packages installation doc 2015-05-15 17:01:18 +08:00
Nguyen Anh Quynh
1af98dc352 cython: bump version in setup_cython.py to 3.0.3 2015-05-12 09:33:38 +08:00
Zach Riggle
a10fbb2b3f Fix error when _cs is None during teardown 2015-05-12 09:26:59 +08:00