Skip to content

Instantly share code, notes, and snippets.

@farhatizakaria
Created May 27, 2024 21:02
Show Gist options
  • Save farhatizakaria/48d5a21bb6959842cd3bdfaa7f8795f9 to your computer and use it in GitHub Desktop.
Save farhatizakaria/48d5a21bb6959842cd3bdfaa7f8795f9 to your computer and use it in GitHub Desktop.
Script for Pyrit installation in Ubuntu 22.04
sudo apt install python3-scapy python2 libssl-dev zlib1g-dev libpcap0.8-dev python2-dev python-is-python2
cd ~/Downloads
wget -c https://github.com/JPaulMora/Pyrit/archive/v0.5.0.tar.gz
tar -xf v0.5.0.tar.gz
cd Pyrit-0.5.0
sed -i "s/COMPILE_AESNI/NO_COMPILE_AESNI/" cpyrit/_cpyrit_cpu.c
python2 setup.py build
sudo python2 setup.py install
@RayenMnif
Copy link

an error showed during the build

`Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python-is-python2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
python-is-python3

E: Package 'python-is-python2' has no installation candidate
--2024-06-05 14:11:19-- https://github.com/JPaulMora/Pyrit/archive/v0.5.0.tar.gz
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/JPaulMora/Pyrit/tar.gz/refs/tags/v0.5.0 [following]
--2024-06-05 14:11:19-- https://codeload.github.com/JPaulMora/Pyrit/tar.gz/refs/tags/v0.5.0
Resolving codeload.github.com (codeload.github.com)... 140.82.121.10
Connecting to codeload.github.com (codeload.github.com)|140.82.121.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v0.5.0.tar.gz’

v0.5.0.tar.gz [ <=> ] 261.34K 1.25MB/s in 0.2s

2024-06-05 14:11:19 (1.25 MB/s) - ‘v0.5.0.tar.gz’ saved [267614]

running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying pyrit_cli.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/init.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/cpyrit.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/util.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/pckttools.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/config.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/network.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/storage.py -> build/lib.linux-x86_64-2.7/cpyrit
running build_ext
building 'cpyrit._cpyrit_cpu' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/cpyrit
x86_64-linux-gnu-gcc -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -ffile-prefix-map=/build/python2.7-uezzQ7/python2.7-2.7.18=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cpyrit/_cpyrit_cpu.c -o build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu.o -Wall -fno-strict-aliasing -DVERSION="0.5.0" -maes -mpclmul
cpyrit/_cpyrit_cpu.c:32:10: fatal error: Python.h: No such file or directory
32 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
Failed to build; Compiling without AES-NI
building 'cpyrit._cpyrit_cpu' extension
x86_64-linux-gnu-gcc -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -ffile-prefix-map=/build/python2.7-uezzQ7/python2.7-2.7.18=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cpyrit/_cpyrit_cpu.c -o build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu.o -Wall -fno-strict-aliasing -DVERSION="0.5.0"
cpyrit/_cpyrit_cpu.c:32:10: fatal error: Python.h: No such file or directory
32 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
running install
running build
running build_py
running build_ext
building 'cpyrit._cpyrit_cpu' extension
x86_64-linux-gnu-gcc -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -ffile-prefix-map=/build/python2.7-uezzQ7/python2.7-2.7.18=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cpyrit/_cpyrit_cpu.c -o build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu.o -Wall -fno-strict-aliasing -DVERSION="0.5.0" -maes -mpclmul
cpyrit/_cpyrit_cpu.c:32:10: fatal error: Python.h: No such file or directory
32 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
Failed to build; Compiling without AES-NI
building 'cpyrit._cpyrit_cpu' extension
x86_64-linux-gnu-gcc -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -ffile-prefix-map=/build/python2.7-uezzQ7/python2.7-2.7.18=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cpyrit/_cpyrit_cpu.c -o build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu.o -Wall -fno-strict-aliasing -DVERSION="0.5.0"
cpyrit/_cpyrit_cpu.c:32:10: fatal error: Python.h: No such file or directory
32 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
`

@farhatizakaria
Copy link
Author

@RayenMnif maybe the error indicates that the build process requires Python.h, which is provided by the Python development headers. try: sudo apt-get install python2.7-dev and sudo apt-get install build-essential

@RayenMnif
Copy link

@farhatizakaria Thanks for your help! It turns out I didn't have the python2.7-dev package installed, and python-is-python2 is no longer available in the Ubuntu repository. I fixed it by adding a simple alias in my .zshrc.

@lund133369
Copy link

INSTALLATION PYRIT 0.5.0 GPU OPENCL IN DOCKER UBUNTU 18.04 - 20.04

INSTALACION PYRIT 0.5.0 GPU OPEN-CL EN DOCKER UBUNTU 18.04 - 20.04

echo "Actualizando repositorios e instalando herramientas básicas..."
apt update
apt upgrade -y
apt install -y zsh net-tools build-essential git nano wget curl p7zip-full p7zip-rar

apt install -y python3-scapy python2.7 libssl-dev zlib1g-dev libpcap0.8-dev python2.7-dev

wget -c https://github.com/JPaulMora/Pyrit/archive/v0.5.0.tar.gz
echo "INSTALACION DE PYRIT $(ls v0.5.0.tar.gz)"

tar -xf v0.5.0.tar.gz

cd Pyrit-0.5.0
sed -i "s/COMPILE_AESNI/NO_COMPILE_AESNI/" cpyrit/_cpyrit_cpu.c
python2.7 setup.py clean
python2.7 setup.py build
python2.7 setup.py install

pyrit | head -n 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment