When installing pynids in Ubuntu via apt-get, there is a bug that doesn’t let it work properly. After some time fighting against it, I managed to succeed. So I’ll leave you here the workaround I’ve found.
First, let’s see what happens when instaling it from the repos. To install it I used the following command.
xgusix@delphiki:~$ sudo apt-get install python-nids
However, it fails when trying to import the library.
xgusix@delphiki:~$ python Python 2.7.3 (default, Feb 27 2014, 19:58:35) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import nids Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: /usr/lib/pymodules/python2.7/nidsmodule.so: undefined symbol: nids_errbuf
The solution to this problem is to compile it manually. But just downlading the library and building it by using setup.py is not enough. I have seen some tutorials around the Internet, but none of them seemed to work. So here is the solution that ended up working for me:
1. Uninstall the package if you have installed it previously.
$ sudo apt-get remove python-nids
2. Download the source code.
$ wget https://jon.oberheide.org/pynids/downloads/pynids-0.6.1.tar.gz --no-check-certificate
3. Extract the source code.
$ tar -zxvf pynids-0.6.1.tar.gz
4. Install the libraries needed by pynids.
$ sudo apt-get install libpcap-dev pkg-config python-dev libgtk2.0-dev libnet1-dev libnids1.21 libnids-dev $ sudo ldconfig
5. Build the code and install.
$ cd pynids-0.6.1/ $ python setup.py build $ sudo python setup.py install
Now we can import pynids with no issues.