Pyrit icon indicating copy to clipboard operation
Pyrit copied to clipboard

undefined symbol: aesni_key

Open akumagiri opened this issue 4 years ago • 19 comments

followed all instructions. after install I get this... pyrit -h Traceback (most recent call last): File "/usr/local/bin/pyrit", line 4, in import pyrit_cli File "/usr/local/lib/python2.7/dist-packages/pyrit_cli.py", line 32, in import cpyrit.cpyrit File "/usr/local/lib/python2.7/dist-packages/cpyrit/cpyrit.py", line 42, in import util File "/usr/local/lib/python2.7/dist-packages/cpyrit/util.py", line 54, in import _cpyrit_cpu ImportError: /usr/local/lib/python2.7/dist-packages/cpyrit/_cpyrit_cpu.so: undefined symbol: aesni_key

akumagiri avatar Nov 08 '19 13:11 akumagiri

i was able to get around this problem with one small preprocessor definition change. this is related to a C compiler intrinsic function that does AES, but i'm assuming people like me who ended up getting this error are more interested in cuda/opencl anyway, so let's get rid of these CPU intrinsics. edit Pyrit/cpyrit/cpufeatures.h and comment out the line "#define COMPILE_AESNI". then run the clean, build, and install on pyrit's setup.py and on the opencl or cuda module you want in the modules folder. assuming you did the configuration to enable it, the GPU acceleration should now work.

nicholas-long avatar Dec 12 '19 05:12 nicholas-long

The same trouble, line commenting did not help.

EmelyanovSI avatar Jan 15 '20 01:01 EmelyanovSI

I have same trouble...

fehimpasa avatar Apr 04 '20 13:04 fehimpasa

Been trying to figure out a fix for this too, and finally got it working (maybe), @nicholas-long had the right idea, but perhaps meant to provide more info on editing.

To get it working on my end I had to completely disable the AESNI functions. Following Nicolas' instructions by commenting out the "define COMPILE_AESNI", or the whole block/lines in cpufeatures.h (Not completely sure if this is required), and heading over to "Pyrit/cpyrit/_cpyrit_cpu.c" and commenting out lines 1080 - 1142, or where COMPILE_AESNI starts to its end.

P.S: This is on a fresh install, and assuming it's breaking when you barely even run pyrit. I was able to at minimum start a benchmark after this so hopefully it'll fix it for anyone else too while we wait for Pyrit(2)? to update to Py3 :)

RootSrc avatar May 01 '20 06:05 RootSrc

Estuve tratando de encontrar una solución para esto también, y finalmente lo hice funcionar (tal vez), @ nicholas-long tuvo la idea correcta, pero tal vez pretendía brindar más información sobre la edición.

Para que funcione, tuve que desactivar completamente las funciones de AESNI. Siguiendo las instrucciones de Nicolas comentando "define COMPILE_AESNI", o todo el bloque / líneas en cpufeatures.h (No estoy completamente seguro de si esto es necesario), y dirigiéndose a "Pyrit / cpyrit / _cpyrit_cpu.c" y comentando las líneas 1080-1142, o donde COMPILE_AESNI comienza hasta el final.

PD: Esto es una instalación nueva, y asumiendo que se está rompiendo cuando apenas ejecutas pyrit. Pude, como mínimo, iniciar un punto de referencia después de esto, así que espero que lo solucione para cualquier otra persona también mientras esperamos Pyrit (2). para actualizar a Py3 :)

Muchas gracias por el dato, acabó de resolver el problema :)

debiantano avatar Dec 22 '20 05:12 debiantano

this is still an issue as of today

ObscenityIB avatar Feb 05 '21 08:02 ObscenityIB

yep

wlwatkins avatar Feb 21 '21 08:02 wlwatkins

Got the same issue trying to install on Ubuntu Focal. Switching to Debian resolved the issue.

Working Dockerfile:

FROM debian:stable

RUN apt-get update

RUN apt-get install -y git vim curl

RUN apt-get install -y python2
RUN ln -s /usr/bin/python2 /usr/bin/python

WORKDIR /opt/pip2
RUN curl https://bootstrap.pypa.io/2.7/get-pip.py --output get-pip.py
RUN python2 ./get-pip.py
RUN pip install \
    psycopg2-binary \
    scapy==2.3.2

RUN apt-get install -y \
        gcc \
        python2-dev \
        libssl-dev \
        zlib1g-dev \
        libpcap-dev

WORKDIR /root/git/
RUN git clone https://github.com/JPaulMora/Pyrit.git

WORKDIR /root/git/Pyrit
RUN git checkout f0f1913c645b445dd391fb047b812b5ba511782c
RUN ./setup.py clean
RUN ./setup.py build
RUN ./setup.py install

RUN pyrit -h

voje avatar Feb 23 '21 19:02 voje

I have same trouble.

Traceback (most recent call last): File "/usr/local/bin/pyrit", line 4, in import pyrit_cli File "/usr/local/lib/python2.7/dist-packages/pyrit_cli.py", line 32, in import cpyrit.cpyrit File "/usr/local/lib/python2.7/dist-packages/cpyrit/cpyrit.py", line 42, in import util File "/usr/local/lib/python2.7/dist-packages/cpyrit/util.py", line 54, in import _cpyrit_cpu ImportError: /usr/local/lib/python2.7/dist-packages/cpyrit/_cpyrit_cpu.so: undefined symbol: aesni_key

kforkamina avatar Feb 25 '21 05:02 kforkamina

I was able to work around this by fudging the code as suggested by @RootSrc. I made a script that will install it on Kali Rolling, but if you're on a different distro, the specific command to fudge the code before building is

sed -i "s/COMPILE_AESNI/COMPILE_AESNIX/" Pyrit/cpyrit/_cpyrit_cpu.c

Grezzo avatar Mar 17 '21 16:03 Grezzo

I was able to work around this by fudging the code as suggested by @RootSrc. I made a script that will install it on Kali Rolling, but if you're on a different distro, the specific command to fudge the code before building is

sed -i "s/COMPILE_AESNI/COMPILE_AESNIX/" Pyrit/cpyrit/_cpyrit_cpu.c

Only posted 4 hours ago and just in time for when I needed it. THIS is the fix.

hittin-a-lick avatar Mar 17 '21 20:03 hittin-a-lick

Wow just adding an X to that line really did it. lol

Keskebeu avatar Apr 23 '21 15:04 Keskebeu

I was able to work around this by fudging the code as suggested by @RootSrc. I made a script that will install it on Kali Rolling, but if you're on a different distro, the specific command to fudge the code before building is

sed -i "s/COMPILE_AESNI/COMPILE_AESNIX/" Pyrit/cpyrit/_cpyrit_cpu.c

This worked

sravan1946 avatar May 17 '21 09:05 sravan1946

Hello, I tried all the methods but it still does not work, the last one I tried is this:

sed -i "s/COMPILE_AESNI/COMPILE_AESNIX/" Pyrit/cpyrit/_cpyrit_cpu.c

it compiles it and installs it but when I execute any command this happens:──(root💀kali)-[/home/tuvi/Pyrit] └─# pyrit --help
Traceback (most recent call last): File "/usr/local/bin/pyrit", line 6, in pyrit_cli.Pyrit_CLI().initFromArgv() File "/usr/local/lib/python2.7/dist-packages/pyrit_cli.py", line 62, in initFromArgv ('all-handshakes', 'aes')) File "/usr/lib/python2.7/getopt.py", line 88, in getopt opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) File "/usr/lib/python2.7/getopt.py", line 152, in do_longs has_arg, opt = long_has_args(opt, longopts) File "/usr/lib/python2.7/getopt.py", line 169, in long_has_args raise GetoptError('option --%s not recognized' % opt, opt) getopt.GetoptError: option --help not recognized

someone who can help me?

julianAO2002 avatar Jun 29 '21 14:06 julianAO2002

I was able to work around this by fudging the code as suggested by @RootSrc. I made a script that will install it on Kali Rolling, but if you're on a different distro, the specific command to fudge the code before building is

sed -i "s/COMPILE_AESNI/COMPILE_AESNIX/" Pyrit/cpyrit/_cpyrit_cpu.c

@Grezzo Your script worked beautifully for Parrot also. Thank you

Trgreene08 avatar Jul 14 '21 15:07 Trgreene08

It's work. Thks

DavidBaezDbz avatar Jan 17 '22 19:01 DavidBaezDbz

Having this issue in June 2022 on Linux Mint 20. Going to try solutions mentioned in this thread.

K0K0SHA avatar Jun 06 '22 08:06 K0K0SHA

Hello, I tried all the methods but it still does not work, the last one I tried is this:

sed -i "s/COMPILE_AESNI/COMPILE_AESNIX/" Pyrit/cpyrit/_cpyrit_cpu.c

it compiles it and installs it but when I execute any command this happens: ──(rootskullkali)-[/home/tuvi/Pyrit] └─# pyrit --help Traceback (most recent call last): File "/usr/local/bin/pyrit", line 6, in pyrit_cli.Pyrit_CLI().initFromArgv() File "/usr/local/lib/python2.7/dist-packages/pyrit_cli.py", line 62, in initFromArgv ('all-handshakes', 'aes')) File "/usr/lib/python2.7/getopt.py", line 88, in getopt opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) File "/usr/lib/python2.7/getopt.py", line 152, in do_longs has_arg, opt = long_has_args(opt, longopts) File "/usr/lib/python2.7/getopt.py", line 169, in long_has_args raise GetoptError('option --%s not recognized' % opt, opt) getopt.GetoptError: option --help not recognized

someone who can help me?

I'm having the same exact issue compiling Pyrit. I'll try to see what's going on.

K0K0SHA avatar Jun 06 '22 08:06 K0K0SHA

Julian and everyone else who was getting that getopt error, I figured out how to fix it. Instead of running pyrit --help, try running pyrit help. You're good.

K0K0SHA avatar Jun 06 '22 08:06 K0K0SHA