merrychap / shellen

:cherry_blossom: Interactive shellcoding environment to easily craft shellcodes
MIT License
888 stars 97 forks source link

ImportError: ERROR: fail to load the dynamic library. #3

Closed dobin closed 6 years ago

dobin commented 6 years ago

Tried to install it in an Ubuntu 17.10 lxd container, got the following error when starting:

root@shellcoding:~# shellen
Traceback (most recent call last):
  File "/usr/local/bin/shellen", line 7, in <module>
    from shellen.main import main
  File "/usr/local/lib/python3.6/dist-packages/shellen/main.py", line 3, in <module>
    from shell import Shellen
  File "/usr/local/lib/python3.6/dist-packages/shellen/shell.py", line 13, in <module>
    from asms.asm import AssemblerWrapper
  File "/usr/local/lib/python3.6/dist-packages/shellen/asms/asm.py", line 6, in <module>
    from keystone import *
  File "/usr/local/lib/python3.6/dist-packages/keystone/__init__.py", line 4, in <module>
    from .keystone import Ks, ks_version, ks_arch_supported, version_bind, debug, KsError, __version__
  File "/usr/local/lib/python3.6/dist-packages/keystone/keystone.py", line 75, in <module>
    raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.

Host is Ubuntu 16.04.

dobin@minime:~$ lxc launch ubuntu:17.10 shellcoding
Creating shellcoding
Starting shellcoding

dobin@minime:~$ lxc exec shellcoding bash

root@shellcoding:~# apt-get update; apt-get upgrade; apt-get install cmake; apt-get install python3-pip; 
Hit:1 http://archive.ubuntu.com/ubuntu artful InRelease
Get:2 http://archive.ubuntu.com/ubuntu artful-updates InRelease [78.6 kB]                            
Get:3 http://security.ubuntu.com/ubuntu artful-security InRelease [78.6 kB]                          
Get:4 http://archive.ubuntu.com/ubuntu artful-backports InRelease [72.2 kB]        
Get:5 http://archive.ubuntu.com/ubuntu artful/main Sources [849 kB]                            
Get:6 http://archive.ubuntu.com/ubuntu artful/universe Sources [8721 kB]                 
Get:7 http://security.ubuntu.com/ubuntu artful-security/restricted Sources [960 B]       
Get:8 http://security.ubuntu.com/ubuntu artful-security/universe Sources [10.2 kB]
Get:9 http://archive.ubuntu.com/ubuntu artful/restricted Sources [5392 B]       
Get:10 http://archive.ubuntu.com/ubuntu artful/multiverse Sources [182 kB]   
Get:11 http://security.ubuntu.com/ubuntu artful-security/main Sources [42.3 kB]
Get:12 http://archive.ubuntu.com/ubuntu artful/universe amd64 Packages [8103 kB]
Get:13 http://security.ubuntu.com/ubuntu artful-security/multiverse Sources [1172 B]      
Get:14 http://security.ubuntu.com/ubuntu artful-security/main amd64 Packages [135 kB]
Get:15 http://archive.ubuntu.com/ubuntu artful/universe Translation-en [4789 kB]          
Get:16 http://security.ubuntu.com/ubuntu artful-security/main Translation-en [58.3 kB]         
Get:17 http://archive.ubuntu.com/ubuntu artful/multiverse amd64 Packages [150 kB]                       
Get:18 http://security.ubuntu.com/ubuntu artful-security/universe amd64 Packages [44.5 kB]
Get:19 http://archive.ubuntu.com/ubuntu artful/multiverse Translation-en [108 kB]
Get:20 http://archive.ubuntu.com/ubuntu artful-updates/restricted Sources [960 B]              
Get:21 http://archive.ubuntu.com/ubuntu artful-updates/universe Sources [23.9 kB]
Get:22 http://archive.ubuntu.com/ubuntu artful-updates/multiverse Sources [1172 B]
Get:23 http://security.ubuntu.com/ubuntu artful-security/universe Translation-en [27.5 kB]
Get:24 http://archive.ubuntu.com/ubuntu artful-updates/main Sources [85.2 kB]        
Get:25 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 Packages [214 kB]
Get:26 http://archive.ubuntu.com/ubuntu artful-updates/main Translation-en [95.0 kB]
Get:27 http://security.ubuntu.com/ubuntu artful-security/multiverse amd64 Packages [1828 B]
Get:28 http://archive.ubuntu.com/ubuntu artful-updates/universe amd64 Packages [86.4 kB]
Get:29 http://security.ubuntu.com/ubuntu artful-security/multiverse Translation-en [1124 B]
Get:30 http://archive.ubuntu.com/ubuntu artful-updates/universe Translation-en [49.1 kB]
Get:31 http://archive.ubuntu.com/ubuntu artful-updates/multiverse amd64 Packages [1828 B]
Get:32 http://archive.ubuntu.com/ubuntu artful-updates/multiverse Translation-en [1124 B]
Get:33 http://archive.ubuntu.com/ubuntu artful-backports/universe Sources [1772 B]
Get:34 http://archive.ubuntu.com/ubuntu artful-backports/main Sources [1192 B]
Get:35 http://archive.ubuntu.com/ubuntu artful-backports/main amd64 Packages [1516 B]
Get:36 http://archive.ubuntu.com/ubuntu artful-backports/main Translation-en [668 B]
Get:37 http://archive.ubuntu.com/ubuntu artful-backports/universe amd64 Packages [3408 B]
Get:38 http://archive.ubuntu.com/ubuntu artful-backports/universe Translation-en [1880 B]
Fetched 24.0 MB in 4s (5597 kB/s)                            
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
The following packages will be upgraded:
  sensible-utils
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 14.6 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 sensible-utils all 0.0.10ubuntu0.1 [14.6 kB]
Fetched 14.6 kB in 0s (103 kB/s)         
(Reading database ... 26647 files and directories currently installed.)
Preparing to unpack .../sensible-utils_0.0.10ubuntu0.1_all.deb ...
Unpacking sensible-utils (0.0.10ubuntu0.1) over (0.0.10) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Setting up sensible-utils (0.0.10ubuntu0.1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu cmake-data cpp cpp-7 gcc gcc-7 libarchive13 libasan4 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcilkrts5
  libgcc-7-dev libgomp1 libisl15 libitm1 libjsoncpp1 liblsan0 libmpc3 libmpx2 libquadmath0 librhash0 libtsan0 libubsan0 libuv1 linux-libc-dev make manpages-dev
Suggested packages:
  binutils-doc ninja-build cpp-doc gcc-7-locales gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-7-multilib gcc-7-doc libgcc1-dbg libgomp1-dbg libitm1-dbg
  libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg lrzip glibc-doc make-doc
The following NEW packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu cmake cmake-data cpp cpp-7 gcc gcc-7 libarchive13 libasan4 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0
  libcilkrts5 libgcc-7-dev libgomp1 libisl15 libitm1 libjsoncpp1 liblsan0 libmpc3 libmpx2 libquadmath0 librhash0 libtsan0 libubsan0 libuv1 linux-libc-dev make manpages-dev
0 upgraded, 33 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.7 MB of archives.
After this operation, 138 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu artful/main amd64 cmake-data all 3.9.1-1 [1276 kB]
Get:2 http://archive.ubuntu.com/ubuntu artful/main amd64 libarchive13 amd64 3.2.2-3.1 [289 kB]
Get:3 http://archive.ubuntu.com/ubuntu artful/main amd64 libjsoncpp1 amd64 1.7.4-3 [73.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu artful/main amd64 librhash0 amd64 1.3.4-3 [77.0 kB]
Get:5 http://archive.ubuntu.com/ubuntu artful/main amd64 libuv1 amd64 1.9.1-3 [58.6 kB]
Get:6 http://archive.ubuntu.com/ubuntu artful/main amd64 cmake amd64 3.9.1-1 [3107 kB]
Get:7 http://archive.ubuntu.com/ubuntu artful/main amd64 binutils-common amd64 2.29.1-4ubuntu1 [190 kB]
Get:8 http://archive.ubuntu.com/ubuntu artful/main amd64 libbinutils amd64 2.29.1-4ubuntu1 [502 kB]
Get:9 http://archive.ubuntu.com/ubuntu artful/main amd64 binutils-x86-64-linux-gnu amd64 2.29.1-4ubuntu1 [1824 kB]
Get:10 http://archive.ubuntu.com/ubuntu artful/main amd64 binutils amd64 2.29.1-4ubuntu1 [3342 B]
Get:11 http://archive.ubuntu.com/ubuntu artful/main amd64 libisl15 amd64 0.18-1 [545 kB]
Get:12 http://archive.ubuntu.com/ubuntu artful/main amd64 libmpc3 amd64 1.0.3-2 [39.5 kB]
Get:13 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 cpp-7 amd64 7.2.0-8ubuntu3.2 [6732 kB]
Get:14 http://archive.ubuntu.com/ubuntu artful/main amd64 cpp amd64 4:7.2.0-1ubuntu1 [27.6 kB]
Get:15 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libcc1-0 amd64 7.2.0-8ubuntu3.2 [38.7 kB]
Get:16 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libgomp1 amd64 7.2.0-8ubuntu3.2 [76.4 kB]
Get:17 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libitm1 amd64 7.2.0-8ubuntu3.2 [27.6 kB]
Get:18 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libatomic1 amd64 7.2.0-8ubuntu3.2 [8950 B]
Get:19 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libasan4 amd64 7.2.0-8ubuntu3.2 [360 kB]
Get:20 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 liblsan0 amd64 7.2.0-8ubuntu3.2 [133 kB]
Get:21 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libtsan0 amd64 7.2.0-8ubuntu3.2 [282 kB]
Get:22 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libubsan0 amd64 7.2.0-8ubuntu3.2 [126 kB]
Get:23 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libcilkrts5 amd64 7.2.0-8ubuntu3.2 [42.6 kB]
Get:24 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libmpx2 amd64 7.2.0-8ubuntu3.2 [11.7 kB]
Get:25 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libquadmath0 amd64 7.2.0-8ubuntu3.2 [133 kB]
Get:26 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libgcc-7-dev amd64 7.2.0-8ubuntu3.2 [2368 kB]
Get:27 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 gcc-7 amd64 7.2.0-8ubuntu3.2 [7418 kB]
Get:28 http://archive.ubuntu.com/ubuntu artful/main amd64 gcc amd64 4:7.2.0-1ubuntu1 [5124 B]
Get:29 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libc-dev-bin amd64 2.26-0ubuntu2.1 [69.5 kB]
Get:30 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 linux-libc-dev amd64 4.13.0-36.40 [951 kB]
Get:31 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libc6-dev amd64 2.26-0ubuntu2.1 [2526 kB]
Get:32 http://archive.ubuntu.com/ubuntu artful/main amd64 make amd64 4.1-9.1 [154 kB]
Get:33 http://archive.ubuntu.com/ubuntu artful/main amd64 manpages-dev all 4.13-3 [2202 kB]
Fetched 31.7 MB in 3s (9081 kB/s)      
Extracting templates from packages: 100%
Selecting previously unselected package cmake-data.
(Reading database ... 26647 files and directories currently installed.)
Preparing to unpack .../00-cmake-data_3.9.1-1_all.deb ...
Unpacking cmake-data (3.9.1-1) ...
Selecting previously unselected package libarchive13:amd64.
Preparing to unpack .../01-libarchive13_3.2.2-3.1_amd64.deb ...
Unpacking libarchive13:amd64 (3.2.2-3.1) ...
Selecting previously unselected package libjsoncpp1:amd64.
Preparing to unpack .../02-libjsoncpp1_1.7.4-3_amd64.deb ...
Unpacking libjsoncpp1:amd64 (1.7.4-3) ...
Selecting previously unselected package librhash0.
Preparing to unpack .../03-librhash0_1.3.4-3_amd64.deb ...
Unpacking librhash0 (1.3.4-3) ...
Selecting previously unselected package libuv1:amd64.
Preparing to unpack .../04-libuv1_1.9.1-3_amd64.deb ...
Unpacking libuv1:amd64 (1.9.1-3) ...
Selecting previously unselected package cmake.
Preparing to unpack .../05-cmake_3.9.1-1_amd64.deb ...
Unpacking cmake (3.9.1-1) ...
Selecting previously unselected package binutils-common:amd64.
Preparing to unpack .../06-binutils-common_2.29.1-4ubuntu1_amd64.deb ...
Unpacking binutils-common:amd64 (2.29.1-4ubuntu1) ...
Selecting previously unselected package libbinutils:amd64.
Preparing to unpack .../07-libbinutils_2.29.1-4ubuntu1_amd64.deb ...
Unpacking libbinutils:amd64 (2.29.1-4ubuntu1) ...
Selecting previously unselected package binutils-x86-64-linux-gnu.
Preparing to unpack .../08-binutils-x86-64-linux-gnu_2.29.1-4ubuntu1_amd64.deb ...
Unpacking binutils-x86-64-linux-gnu (2.29.1-4ubuntu1) ...
Selecting previously unselected package binutils.
Preparing to unpack .../09-binutils_2.29.1-4ubuntu1_amd64.deb ...
Unpacking binutils (2.29.1-4ubuntu1) ...
Selecting previously unselected package libisl15:amd64.
Preparing to unpack .../10-libisl15_0.18-1_amd64.deb ...
Unpacking libisl15:amd64 (0.18-1) ...
Selecting previously unselected package libmpc3:amd64.
Preparing to unpack .../11-libmpc3_1.0.3-2_amd64.deb ...
Unpacking libmpc3:amd64 (1.0.3-2) ...
Selecting previously unselected package cpp-7.
Preparing to unpack .../12-cpp-7_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking cpp-7 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package cpp.
Preparing to unpack .../13-cpp_4%3a7.2.0-1ubuntu1_amd64.deb ...
Unpacking cpp (4:7.2.0-1ubuntu1) ...
Selecting previously unselected package libcc1-0:amd64.
Preparing to unpack .../14-libcc1-0_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libcc1-0:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libgomp1:amd64.
Preparing to unpack .../15-libgomp1_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libgomp1:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libitm1:amd64.
Preparing to unpack .../16-libitm1_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libitm1:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libatomic1:amd64.
Preparing to unpack .../17-libatomic1_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libatomic1:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libasan4:amd64.
Preparing to unpack .../18-libasan4_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libasan4:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package liblsan0:amd64.
Preparing to unpack .../19-liblsan0_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking liblsan0:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libtsan0:amd64.
Preparing to unpack .../20-libtsan0_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libtsan0:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libubsan0:amd64.
Preparing to unpack .../21-libubsan0_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libubsan0:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libcilkrts5:amd64.
Preparing to unpack .../22-libcilkrts5_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libcilkrts5:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libmpx2:amd64.
Preparing to unpack .../23-libmpx2_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libmpx2:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libquadmath0:amd64.
Preparing to unpack .../24-libquadmath0_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libquadmath0:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package libgcc-7-dev:amd64.
Preparing to unpack .../25-libgcc-7-dev_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libgcc-7-dev:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package gcc-7.
Preparing to unpack .../26-gcc-7_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking gcc-7 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package gcc.
Preparing to unpack .../27-gcc_4%3a7.2.0-1ubuntu1_amd64.deb ...
Unpacking gcc (4:7.2.0-1ubuntu1) ...
Selecting previously unselected package libc-dev-bin.
Preparing to unpack .../28-libc-dev-bin_2.26-0ubuntu2.1_amd64.deb ...
Unpacking libc-dev-bin (2.26-0ubuntu2.1) ...
Selecting previously unselected package linux-libc-dev:amd64.
Preparing to unpack .../29-linux-libc-dev_4.13.0-36.40_amd64.deb ...
Unpacking linux-libc-dev:amd64 (4.13.0-36.40) ...
Selecting previously unselected package libc6-dev:amd64.
Preparing to unpack .../30-libc6-dev_2.26-0ubuntu2.1_amd64.deb ...
Unpacking libc6-dev:amd64 (2.26-0ubuntu2.1) ...
Selecting previously unselected package make.
Preparing to unpack .../31-make_4.1-9.1_amd64.deb ...
Unpacking make (4.1-9.1) ...
Selecting previously unselected package manpages-dev.
Preparing to unpack .../32-manpages-dev_4.13-3_all.deb ...
Unpacking manpages-dev (4.13-3) ...
Setting up libquadmath0:amd64 (7.2.0-8ubuntu3.2) ...
Setting up libgomp1:amd64 (7.2.0-8ubuntu3.2) ...
Setting up libatomic1:amd64 (7.2.0-8ubuntu3.2) ...
Setting up libcc1-0:amd64 (7.2.0-8ubuntu3.2) ...
Setting up make (4.1-9.1) ...
Setting up libasan4:amd64 (7.2.0-8ubuntu3.2) ...
Setting up libarchive13:amd64 (3.2.2-3.1) ...
Setting up libcilkrts5:amd64 (7.2.0-8ubuntu3.2) ...
Setting up libuv1:amd64 (1.9.1-3) ...
Setting up libubsan0:amd64 (7.2.0-8ubuntu3.2) ...
Setting up libtsan0:amd64 (7.2.0-8ubuntu3.2) ...
Setting up linux-libc-dev:amd64 (4.13.0-36.40) ...
Setting up cmake-data (3.9.1-1) ...
Setting up librhash0 (1.3.4-3) ...
Setting up liblsan0:amd64 (7.2.0-8ubuntu3.2) ...
Setting up binutils-common:amd64 (2.29.1-4ubuntu1) ...
Setting up libmpx2:amd64 (7.2.0-8ubuntu3.2) ...
Setting up libisl15:amd64 (0.18-1) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libmpc3:amd64 (1.0.3-2) ...
Setting up libc-dev-bin (2.26-0ubuntu2.1) ...
Setting up manpages-dev (4.13-3) ...
Setting up libc6-dev:amd64 (2.26-0ubuntu2.1) ...
Setting up libitm1:amd64 (7.2.0-8ubuntu3.2) ...
Setting up libjsoncpp1:amd64 (1.7.4-3) ...
Setting up libbinutils:amd64 (2.29.1-4ubuntu1) ...
Setting up libgcc-7-dev:amd64 (7.2.0-8ubuntu3.2) ...
Setting up cpp-7 (7.2.0-8ubuntu3.2) ...
Setting up cmake (3.9.1-1) ...
Setting up binutils-x86-64-linux-gnu (2.29.1-4ubuntu1) ...
Setting up cpp (4:7.2.0-1ubuntu1) ...
Setting up binutils (2.29.1-4ubuntu1) ...
Setting up gcc-7 (7.2.0-8ubuntu3.2) ...
Setting up gcc (4:7.2.0-1ubuntu1) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  build-essential dpkg-dev fakeroot g++ g++-7 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libexpat1-dev libfakeroot
  libfile-fcntllock-perl libpython3-dev libpython3.6-dev libstdc++-7-dev python-pip-whl python3-crypto python3-dev python3-keyring python3-keyrings.alt python3-secretstorage
  python3-setuptools python3-wheel python3-xdg python3.6-dev
Suggested packages:
  debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg libstdc++-7-doc python3-crypto-dbg python-crypto-doc gnome-keyring libkf5wallet-bin
  gir1.2-gnomekeyring-1.0 python-secretstorage-doc python-setuptools-doc
The following NEW packages will be installed:
  build-essential dpkg-dev fakeroot g++ g++-7 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libexpat1-dev libfakeroot
  libfile-fcntllock-perl libpython3-dev libpython3.6-dev libstdc++-7-dev python-pip-whl python3-crypto python3-dev python3-keyring python3-keyrings.alt python3-pip
  python3-secretstorage python3-setuptools python3-wheel python3-xdg python3.6-dev
0 upgraded, 26 newly installed, 0 to remove and 0 not upgraded.
Need to get 15.2 MB of archives.
After this operation, 67.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 libstdc++-7-dev amd64 7.2.0-8ubuntu3.2 [1456 kB]
Get:2 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 g++-7 amd64 7.2.0-8ubuntu3.2 [7555 kB]
Get:3 http://archive.ubuntu.com/ubuntu artful/main amd64 g++ amd64 4:7.2.0-1ubuntu1 [1482 B]
Get:4 http://archive.ubuntu.com/ubuntu artful/main amd64 libdpkg-perl all 1.18.24ubuntu1 [209 kB]
Get:5 http://archive.ubuntu.com/ubuntu artful/main amd64 dpkg-dev all 1.18.24ubuntu1 [608 kB]
Get:6 http://archive.ubuntu.com/ubuntu artful/main amd64 build-essential amd64 12.4ubuntu1 [4758 B]
Get:7 http://archive.ubuntu.com/ubuntu artful/main amd64 libfakeroot amd64 1.21-1ubuntu2 [25.9 kB]
Get:8 http://archive.ubuntu.com/ubuntu artful/main amd64 fakeroot amd64 1.21-1ubuntu2 [62.2 kB]
Get:9 http://archive.ubuntu.com/ubuntu artful/main amd64 libalgorithm-diff-perl all 1.19.03-1 [47.6 kB]
Get:10 http://archive.ubuntu.com/ubuntu artful/main amd64 libalgorithm-diff-xs-perl amd64 0.04-4build3 [11.2 kB]
Get:11 http://archive.ubuntu.com/ubuntu artful/main amd64 libalgorithm-merge-perl all 0.08-3 [12.0 kB]
Get:12 http://archive.ubuntu.com/ubuntu artful/main amd64 libexpat1-dev amd64 2.2.3-1 [120 kB]
Get:13 http://archive.ubuntu.com/ubuntu artful/main amd64 libfile-fcntllock-perl amd64 0.22-3build2 [33.2 kB]
Get:14 http://archive.ubuntu.com/ubuntu artful/main amd64 libpython3.6-dev amd64 3.6.3-1ubuntu1 [2483 kB]
Get:15 http://archive.ubuntu.com/ubuntu artful/main amd64 libpython3-dev amd64 3.6.3-0ubuntu2 [6914 B]
Get:16 http://archive.ubuntu.com/ubuntu artful/universe amd64 python-pip-whl all 9.0.1-2 [1379 kB]
Get:17 http://archive.ubuntu.com/ubuntu artful/main amd64 python3-crypto amd64 2.6.1-7build2 [245 kB]
Get:18 http://archive.ubuntu.com/ubuntu artful/main amd64 python3.6-dev amd64 3.6.3-1ubuntu1 [519 kB]
Get:19 http://archive.ubuntu.com/ubuntu artful/main amd64 python3-dev amd64 3.6.3-0ubuntu2 [1206 B]
Get:20 http://archive.ubuntu.com/ubuntu artful/main amd64 python3-secretstorage all 2.3.1-2 [12.1 kB]
Get:21 http://archive.ubuntu.com/ubuntu artful/main amd64 python3-keyring all 10.4.0-1 [26.0 kB]
Get:22 http://archive.ubuntu.com/ubuntu artful/main amd64 python3-keyrings.alt all 2.2-2 [16.0 kB]
Get:23 http://archive.ubuntu.com/ubuntu artful/universe amd64 python3-pip all 9.0.1-2 [114 kB]
Get:24 http://archive.ubuntu.com/ubuntu artful/main amd64 python3-setuptools all 36.2.7-2 [178 kB]
Get:25 http://archive.ubuntu.com/ubuntu artful/universe amd64 python3-wheel all 0.29.0-2 [48.4 kB]
Get:26 http://archive.ubuntu.com/ubuntu artful/main amd64 python3-xdg all 0.25-4 [31.5 kB]
Fetched 15.2 MB in 2s (6492 kB/s)     
Selecting previously unselected package libstdc++-7-dev:amd64.
(Reading database ... 33101 files and directories currently installed.)
Preparing to unpack .../00-libstdc++-7-dev_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking libstdc++-7-dev:amd64 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package g++-7.
Preparing to unpack .../01-g++-7_7.2.0-8ubuntu3.2_amd64.deb ...
Unpacking g++-7 (7.2.0-8ubuntu3.2) ...
Selecting previously unselected package g++.
Preparing to unpack .../02-g++_4%3a7.2.0-1ubuntu1_amd64.deb ...
Unpacking g++ (4:7.2.0-1ubuntu1) ...
Selecting previously unselected package libdpkg-perl.
Preparing to unpack .../03-libdpkg-perl_1.18.24ubuntu1_all.deb ...
Unpacking libdpkg-perl (1.18.24ubuntu1) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../04-dpkg-dev_1.18.24ubuntu1_all.deb ...
Unpacking dpkg-dev (1.18.24ubuntu1) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../05-build-essential_12.4ubuntu1_amd64.deb ...
Unpacking build-essential (12.4ubuntu1) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../06-libfakeroot_1.21-1ubuntu2_amd64.deb ...
Unpacking libfakeroot:amd64 (1.21-1ubuntu2) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../07-fakeroot_1.21-1ubuntu2_amd64.deb ...
Unpacking fakeroot (1.21-1ubuntu2) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../08-libalgorithm-diff-perl_1.19.03-1_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.03-1) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../09-libalgorithm-diff-xs-perl_0.04-4build3_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-4build3) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../10-libalgorithm-merge-perl_0.08-3_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-3) ...
Selecting previously unselected package libexpat1-dev:amd64.
Preparing to unpack .../11-libexpat1-dev_2.2.3-1_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.3-1) ...
Selecting previously unselected package libfile-fcntllock-perl.
Preparing to unpack .../12-libfile-fcntllock-perl_0.22-3build2_amd64.deb ...
Unpacking libfile-fcntllock-perl (0.22-3build2) ...
Selecting previously unselected package libpython3.6-dev:amd64.
Preparing to unpack .../13-libpython3.6-dev_3.6.3-1ubuntu1_amd64.deb ...
Unpacking libpython3.6-dev:amd64 (3.6.3-1ubuntu1) ...
Selecting previously unselected package libpython3-dev:amd64.
Preparing to unpack .../14-libpython3-dev_3.6.3-0ubuntu2_amd64.deb ...
Unpacking libpython3-dev:amd64 (3.6.3-0ubuntu2) ...
Selecting previously unselected package python-pip-whl.
Preparing to unpack .../15-python-pip-whl_9.0.1-2_all.deb ...
Unpacking python-pip-whl (9.0.1-2) ...
Selecting previously unselected package python3-crypto.
Preparing to unpack .../16-python3-crypto_2.6.1-7build2_amd64.deb ...
Unpacking python3-crypto (2.6.1-7build2) ...
Selecting previously unselected package python3.6-dev.
Preparing to unpack .../17-python3.6-dev_3.6.3-1ubuntu1_amd64.deb ...
Unpacking python3.6-dev (3.6.3-1ubuntu1) ...
Selecting previously unselected package python3-dev.
Preparing to unpack .../18-python3-dev_3.6.3-0ubuntu2_amd64.deb ...
Unpacking python3-dev (3.6.3-0ubuntu2) ...
Selecting previously unselected package python3-secretstorage.
Preparing to unpack .../19-python3-secretstorage_2.3.1-2_all.deb ...
Unpacking python3-secretstorage (2.3.1-2) ...
Selecting previously unselected package python3-keyring.
Preparing to unpack .../20-python3-keyring_10.4.0-1_all.deb ...
Unpacking python3-keyring (10.4.0-1) ...
Selecting previously unselected package python3-keyrings.alt.
Preparing to unpack .../21-python3-keyrings.alt_2.2-2_all.deb ...
Unpacking python3-keyrings.alt (2.2-2) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../22-python3-pip_9.0.1-2_all.deb ...
Unpacking python3-pip (9.0.1-2) ...
Selecting previously unselected package python3-setuptools.
Preparing to unpack .../23-python3-setuptools_36.2.7-2_all.deb ...
Unpacking python3-setuptools (36.2.7-2) ...
Selecting previously unselected package python3-wheel.
Preparing to unpack .../24-python3-wheel_0.29.0-2_all.deb ...
Unpacking python3-wheel (0.29.0-2) ...
Selecting previously unselected package python3-xdg.
Preparing to unpack .../25-python3-xdg_0.25-4_all.deb ...
Unpacking python3-xdg (0.25-4) ...
Setting up python-pip-whl (9.0.1-2) ...
Setting up python3-crypto (2.6.1-7build2) ...
Setting up python3-xdg (0.25-4) ...
Setting up python3-keyrings.alt (2.2-2) ...
Setting up libdpkg-perl (1.18.24ubuntu1) ...
Setting up python3-wheel (0.29.0-2) ...
Setting up libstdc++-7-dev:amd64 (7.2.0-8ubuntu3.2) ...
Setting up libfile-fcntllock-perl (0.22-3build2) ...
Setting up dpkg-dev (1.18.24ubuntu1) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
Setting up libfakeroot:amd64 (1.21-1ubuntu2) ...
Setting up python3-pip (9.0.1-2) ...
Setting up libalgorithm-diff-perl (1.19.03-1) ...
Setting up libexpat1-dev:amd64 (2.2.3-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up python3-setuptools (36.2.7-2) ...
Setting up python3-secretstorage (2.3.1-2) ...
Setting up python3-keyring (10.4.0-1) ...
Setting up g++-7 (7.2.0-8ubuntu3.2) ...
Setting up fakeroot (1.21-1ubuntu2) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up libpython3.6-dev:amd64 (3.6.3-1ubuntu1) ...
Setting up libalgorithm-merge-perl (0.08-3) ...
Setting up libalgorithm-diff-xs-perl (0.04-4build3) ...
Setting up g++ (4:7.2.0-1ubuntu1) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up python3.6-dev (3.6.3-1ubuntu1) ...
Setting up libpython3-dev:amd64 (3.6.3-0ubuntu2) ...
Setting up build-essential (12.4ubuntu1) ...
Setting up python3-dev (3.6.3-0ubuntu2) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...

root@shellcoding:~# pip3 install shellen
Collecting shellen
  Downloading shellen-0.1.6-py3-none-any.whl (120kB)
    100% |████████████████████████████████| 122kB 1.5MB/s 
Collecting capstone (from shellen)
  Downloading capstone-3.0.4.tar.gz (3.2MB)
    100% |████████████████████████████████| 3.2MB 497kB/s 
Collecting colorama (from shellen)
  Downloading colorama-0.3.9-py2.py3-none-any.whl
Collecting keystone-engine (from shellen)
  Downloading keystone-engine-0.9.1-3.tar.gz (2.8MB)
    100% |████████████████████████████████| 2.8MB 524kB/s 
Collecting terminaltables (from shellen)
  Downloading terminaltables-3.1.0.tar.gz
Collecting termcolor (from shellen)
  Downloading termcolor-1.1.0.tar.gz
Building wheels for collected packages: capstone, keystone-engine, terminaltables, termcolor
  Running setup.py bdist_wheel for capstone ... done
  Stored in directory: /root/.cache/pip/wheels/7c/d1/d0/db6e2c5ef1063aabb9de2dd8b92b4c27ee6f9fd213240099b8
  Running setup.py bdist_wheel for keystone-engine ... done
  Stored in directory: /root/.cache/pip/wheels/8b/b1/1e/5279f89d7b2c9c823bf78854d37c1bc36cc0b0960fe03489a7
  Running setup.py bdist_wheel for terminaltables ... done
  Stored in directory: /root/.cache/pip/wheels/96/0c/9a/0ec2bcad2ac1fb1d0e4695879386460cec1a947cd7413d1b17
  Running setup.py bdist_wheel for termcolor ... done
  Stored in directory: /root/.cache/pip/wheels/de/f7/bf/1bcac7bf30549e6a4957382e2ecab04c88e513117207067b03
Successfully built capstone keystone-engine terminaltables termcolor
Installing collected packages: capstone, colorama, keystone-engine, terminaltables, termcolor, shellen
Successfully installed capstone-3.0.4 colorama-0.3.9 keystone-engine-0.9.1.post3 shellen-0.1.6 termcolor-1.1.0 terminaltables-3.1.0
root@shellcoding:~# shellen
Traceback (most recent call last):
  File "/usr/local/bin/shellen", line 7, in <module>
    from shellen.main import main
  File "/usr/local/lib/python3.6/dist-packages/shellen/main.py", line 3, in <module>
    from shell import Shellen
  File "/usr/local/lib/python3.6/dist-packages/shellen/shell.py", line 13, in <module>
    from asms.asm import AssemblerWrapper
  File "/usr/local/lib/python3.6/dist-packages/shellen/asms/asm.py", line 6, in <module>
    from keystone import *
  File "/usr/local/lib/python3.6/dist-packages/keystone/__init__.py", line 4, in <module>
    from .keystone import Ks, ks_version, ks_arch_supported, version_bind, debug, KsError, __version__
  File "/usr/local/lib/python3.6/dist-packages/keystone/keystone.py", line 75, in <module>
    raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.
merrychap commented 6 years ago

I checked the error raised by keystone. Here are some issues related to the topic (it's about capstone, but seems like the reason for the error is the same): #117, #413, #5. Seems like pip3 installed keystone's library to a wrong place. I suggest you reinstalling keystone manually using this documentation. Or you can just move the library to /usr/local/lib/python3.6/dist-packages/keystone/

dobin commented 6 years ago

Yeah, it appears to be a common problem. Copying the other shared libraries to the mentioned directories did not help.

In other news, i managed to compile keystone from source. But now trying to install shellen results in:

root@shellcoding:~/shellen# python3 setup.py install
...
[100%] Built target keystone
error: Setup script exited with error: SandboxViolation: mkdir('/usr/lib/python3/dist-packages/keystone', 511) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

So it tries to install keystone again, but this fails. Is there a way around this?

dobin commented 6 years ago

Ah sorry, i only moved the keystone files, not capstone. This fixes it for the pip3 install on Ubuntu 17.10:

root@shellcoding2:~# cp /usr/local/lib/python3.6/dist-packages/usr/lib/python3/dist-packages/capstone/* /usr/local/lib/python3.6/dist-packages/capstone/
root@shellcoding2:~# cp /usr/local/lib/python3.6/dist-packages/usr/lib/python3/dist-packages/keystone/* /usr/local/lib/python3.6/dist-packages/keystone/
root@shellcoding2:~# ldconfig
root@shellcoding2:~# shellen
[*] You can type help to see the list of available commands.
[*] Also, to close this session you should enter q or quit

L:asm:x86_32 >