Pwntools is a CTF framework and exploit development library, developed in Python and designed by rapid, designed to allow users to write exploit quickly and easily.
Pwntools has the best support for Ubuntu 12.04 and 14.04, but most of the features also support Debian, Arch, FreeBSD, OSX, and so on.
Ensure that system libraries such as Binutils, Capstone, Python development headers are installed before installation
-----------------------
This article will be based on the Kali rolling 64-bit installation, and the UBUNTU64 bit installation is similar (after all pwntools for Ubuntu support is the best).
There will be no Windows installation method for the time being.
About Kali2 32-bit or other 32-bit system is also difficult to get, this article will be a toss (but not all features can be used)
-------------------
1, installation Capstone
Capstone Disassembly/disassembler Framework:core (Arm, Arm64, m68k, Mips, PPC, Sparc, Systemz, X86, x86_64, XCore) + bind Ings (Python, Java, Ocaml)
In the terminal input
git clone https://github.com/aquynh/capstonecd capstone make make Install
(It's going well here)
2, Installation Pwntools
In the terminal input
git clone https://github.com/gallopsled/pwntoolsInstall
If there is no error, and the terminal input Python into its interactive mode, input import PWN return after the error, almost good.
Then try Pwntools's ASM function
>>> pwn.asm ("xor eax,eax")'1\xc0'
If you have the correct output, it means that this function is available, even if the installation is complete here.
(If you want to learn more about ASM, you can visit: http://pwntools.readthedocs.io/en/latest/asm.html)
3. Various errors occurred when installing Pwntools
ERR1:
Fatal error:openssl/e_os2.h: No file or directory
To solve this problem, you only need to install the OpenSSL development package
Install Libssl-dev
ERR2:
0.1. 7 conflicts with requirement pyasn1>=0.1. 8
Update the PYASN1 (ASN.1 Library for Python)
git clone https://github.com/etingof/pyasn1Install
4. Error using ASM function
[!] Your local binutils won'i686' is not supported. Find ' as ' for contexttype () for This architecture: https://pwntools.readthedocs.org/en/latest/install/binutils.html
Probably the Binutils library does not support i686, a 32-bit architecture (Binutils is a set of development tools, including connectors, assemblers, and other tools for target files and archives. )
I visited the inside of the link address, below is the installation method inside:
Install software-properties-commonapt-add-repository ppa:pwntools/binutilsapt-get Updateaptinstall binutils-$ARCH-linux-gnu $ARCH is your target architecture ( e.g., ARM, MIPS64, VAX, etc.).
I'm in the Kali2 32-bit execution to the 2nd sentence will be reported
Find for Kali/sana
EH--. Sad, then I look at the link in the back of an sh, which is not well written (Rm can also be decompressed after the tar.) ), even if I modify the run SH will not solve this ASM problem.
When I was desperate, I thought I could go to GitHub to find it, and I found a pwntools-binutils project.
git clone https://github.com/gallopsled/pwntools-binutilscd ubuntuchmod +x Install_all. SH . /install_all. sh arm #your architecture
The Ubuntu folder inside the project has a install.sh and install_all.sh, but I tried./install.sh Arm couldn't find the installation package, I had to try./install_all.sh arm installs all.
This test also let me know the architecture currently supported by the Binutils library.
The following installation packages are present (their schemas are also supported):
Binutils-aarch64-linux-gnubinutils-mips-linux-gnubinutils-powerpc-linux-gnu
While the following installation packages are temporarily absent:
Binutils-alpha-linux-gnubinutils-arm-linux-gnubinutils-avr-linux-gnubinutils-cris-linux-gnubinutils-hppa-linux-gnubinutil S-ia64-linux-gnubinutils-m68k-linux-gnubinutils-mips64-linux-gnubinutils-msp430-linux-gnubinutils-powerpc64-linux-gnubinu Tils-s390-linux-gnubinutils-sparc-linux-gnubinutils-vax-linux-gnubinutils-xscale-linux-gnubinutils-i386-linux-gnubinutils -x86_64-linux-gnu
Therefore, it is not possible to install the Binutils library under a schema that is not supported for the time being, and the ASM functionality cannot be used.
5: Wait for PCAT later update:)
Http://pcat.cnblogs.com
Pwntools How to use the installation