• Home »
  • Errors »
  • Error Building Pyrit On CentOS: cpyrit/_cpyrit_cpu.c:26:18: error: pcap.h: No such file or directory

Error Building Pyrit On CentOS: cpyrit/_cpyrit_cpu.c:26:18: error: pcap.h: No such file or directory

When building pyrit, which is an application that uses GPU power to run dictionary attacks against WPA handshake captures, on CentOS Linux I ran into an error. The error was related to the pcap.h library which was not found by the pyrit setup.py python script. Resolving the problem is easy by simply installing the libpcap-devel RPM package using the yum package manager. Below I display more output surrounding the error, the log showing the libpcap-devel package installation, and finally the successful build of pyrit on CentOS Linux.

CentOS Linux: Error Building Pyrit: pcap.h: No such file or directory

[root@dev pyrit]# python2.6 setup.py build
running build
running build_py
running build_ext
building 'cpyrit._cpyrit_cpu' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.6 -c cpyrit/_cpyrit_cpu.c -o build/temp.linux-x86_64-2.6/cpyrit/_cpyrit_cpu.o -DVERSION="0.3.1-dev (svn r234)"
cpyrit/_cpyrit_cpu.c:26:18: error: pcap.h: No such file or directory
cpyrit/_cpyrit_cpu.c:87: error: expected specifier-qualifier-list before ‘pcap_t’
cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_init’:
cpyrit/_cpyrit_cpu.c:1376: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1377: error: ‘PcapReader’ has no member named ‘status’
cpyrit/_cpyrit_cpu.c:1377: error: ‘PcapReader’ has no member named ‘datalink’
cpyrit/_cpyrit_cpu.c:1382: error: ‘PcapReader’ has no member named ‘filtered’
cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_dealloc’:
cpyrit/_cpyrit_cpu.c:1393: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1393: error: ‘PcapReader’ has no member named ‘status’
cpyrit/_cpyrit_cpu.c:1394: warning: implicit declaration of function ‘pcap_close’
cpyrit/_cpyrit_cpu.c:1394: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_close’:
cpyrit/_cpyrit_cpu.c:1404: error: ‘PcapReader’ has no member named ‘status’
cpyrit/_cpyrit_cpu.c:1405: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1406: error: ‘PcapReader’ has no member named ‘status’
cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_setup’:
cpyrit/_cpyrit_cpu.c:1417: error: ‘PcapReader’ has no member named ‘datalink’
cpyrit/_cpyrit_cpu.c:1417: warning: implicit declaration of function ‘pcap_datalink’
cpyrit/_cpyrit_cpu.c:1417: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1419: warning: implicit declaration of function ‘pcap_datalink_val_to_name’
cpyrit/_cpyrit_cpu.c:1419: error: ‘PcapReader’ has no member named ‘datalink’
cpyrit/_cpyrit_cpu.c:1419: warning: assignment makes pointer from integer without a cast
cpyrit/_cpyrit_cpu.c:1432: error: ‘PcapReader’ has no member named ‘filtered’
cpyrit/_cpyrit_cpu.c:1432: error: ‘PcapReader’ has no member named ‘datalink’
cpyrit/_cpyrit_cpu.c:1432: error: ‘DLT_IEEE802_11’ undeclared (first use in this function)
cpyrit/_cpyrit_cpu.c:1432: error: (Each undeclared identifier is reported only once
cpyrit/_cpyrit_cpu.c:1432: error: for each function it appears in.)
cpyrit/_cpyrit_cpu.c:1433: error: ‘PcapReader’ has no member named ‘datalink’
cpyrit/_cpyrit_cpu.c:1433: error: ‘DLT_PRISM_HEADER’ undeclared (first use in this function)
cpyrit/_cpyrit_cpu.c:1434: error: ‘PcapReader’ has no member named ‘datalink’
cpyrit/_cpyrit_cpu.c:1434: error: ‘DLT_IEEE802_11_RADIO_AVS’ undeclared (first use in this function)
cpyrit/_cpyrit_cpu.c:1435: error: ‘PcapReader’ has no member named ‘datalink’
cpyrit/_cpyrit_cpu.c:1435: error: ‘DLT_IEEE802_11_RADIO’ undeclared (first use in this function)
cpyrit/_cpyrit_cpu.c:1436: error: ‘PcapReader’ has no member named ‘filtered’
cpyrit/_cpyrit_cpu.c:1454: error: ‘PcapReader’ has no member named ‘status’
cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_open_live’:
cpyrit/_cpyrit_cpu.c:1465: error: ‘PCAP_ERRBUF_SIZE’ undeclared (first use in this function)
cpyrit/_cpyrit_cpu.c:1471: error: ‘PcapReader’ has no member named ‘status’
cpyrit/_cpyrit_cpu.c:1477: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1477: warning: implicit declaration of function ‘pcap_open_live’
cpyrit/_cpyrit_cpu.c:1478: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1465: warning: unused variable ‘errbuf’
cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_open_offline’:
cpyrit/_cpyrit_cpu.c:1497: error: ‘PCAP_ERRBUF_SIZE’ undeclared (first use in this function)
cpyrit/_cpyrit_cpu.c:1503: error: ‘PcapReader’ has no member named ‘status’
cpyrit/_cpyrit_cpu.c:1509: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1509: warning: implicit declaration of function ‘pcap_open_offline’
cpyrit/_cpyrit_cpu.c:1510: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1497: warning: unused variable ‘errbuf’
cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_read’:
cpyrit/_cpyrit_cpu.c:1534: error: ‘PcapReader’ has no member named ‘status’
cpyrit/_cpyrit_cpu.c:1543: warning: implicit declaration of function ‘pcap_next_ex’
cpyrit/_cpyrit_cpu.c:1543: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1553: error: dereferencing pointer to incomplete type
cpyrit/_cpyrit_cpu.c:1563: error: dereferencing pointer to incomplete type
cpyrit/_cpyrit_cpu.c:1564: error: dereferencing pointer to incomplete type
cpyrit/_cpyrit_cpu.c:1582: warning: implicit declaration of function ‘pcap_geterr’
cpyrit/_cpyrit_cpu.c:1582: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1582: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_filter’:
cpyrit/_cpyrit_cpu.c:1598: error: storage size of ‘fp’ isn’t known
cpyrit/_cpyrit_cpu.c:1604: error: ‘PcapReader’ has no member named ‘status’
cpyrit/_cpyrit_cpu.c:1610: error: ‘PcapReader’ has no member named ‘filtered’
cpyrit/_cpyrit_cpu.c:1612: warning: implicit declaration of function ‘pcap_compile’
cpyrit/_cpyrit_cpu.c:1612: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1615: error: ‘PcapReader’ has no member named ‘filtered’
cpyrit/_cpyrit_cpu.c:1618: warning: implicit declaration of function ‘pcap_setfilter’
cpyrit/_cpyrit_cpu.c:1618: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1620: error: ‘PcapReader’ has no member named ‘p’
cpyrit/_cpyrit_cpu.c:1620: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
cpyrit/_cpyrit_cpu.c:1621: warning: implicit declaration of function ‘pcap_freecode’
cpyrit/_cpyrit_cpu.c:1598: warning: unused variable ‘fp’
cpyrit/_cpyrit_cpu.c: At top level:
cpyrit/_cpyrit_cpu.c:1920: error: ‘PcapReader’ has no member named ‘datalink’
cpyrit/_cpyrit_cpu.c:1922: error: ‘PcapReader’ has no member named ‘filtered’
error: command 'gcc' failed with exit status 1

Based on the above error you can see the initial error is based on the fact that pcap.h is not found on the server and is required by the pyrit setup.py script. Using the “yum whatprovides” command you can see that libpcap-devel provides the pcap.h library file needed for pyrit to build properly. You can install libpcap-devel easily using yum which is displayed below.

Install libpcap-devel Using Yum To Provide The pcap.h Library:

[root@dev pyrit]# yum install libpcap-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: hpc.arc.georgetown.edu
 * base: mirror.cisp.com
 * epel: ftp.osuosl.org
 * extras: mirror.sanctuaryhost.com
 * updates: mirror.sanctuaryhost.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libpcap-devel.i386 14:0.9.4-14.el5 set to be updated
--> Processing Dependency: libpcap.so.0.9.4 for package: libpcap-devel
---> Package libpcap-devel.x86_64 14:0.9.4-14.el5 set to be updated
--> Running transaction check
---> Package libpcap.i386 14:0.9.4-14.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                           Arch                       Version                                Repository                Size
====================================================================================================================================
Installing:
 libpcap-devel                     i386                       14:0.9.4-14.el5                        base                     118 k
 libpcap-devel                     x86_64                     14:0.9.4-14.el5                        base                     117 k
Installing for dependencies:
 libpcap                           i386                       14:0.9.4-14.el5                        base                     107 k

Transaction Summary
====================================================================================================================================
Install      3 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 342 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): libpcap-0.9.4-14.el5.i386.rpm                                                                         | 107 kB     00:00
(2/3): libpcap-devel-0.9.4-14.el5.x86_64.rpm                                                                 | 117 kB     00:00
(3/3): libpcap-devel-0.9.4-14.el5.i386.rpm                                                                   | 118 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                               501 kB/s | 342 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : libpcap                                                                                                      1/3
  Installing     : libpcap-devel                                                                                                2/3
  Installing     : libpcap-devel                                                                                                3/3

Installed:
  libpcap-devel.i386 14:0.9.4-14.el5                              libpcap-devel.x86_64 14:0.9.4-14.el5

Dependency Installed:
  libpcap.i386 14:0.9.4-14.el5

Complete!

After install libpcap-devel you can see that pyrit builds without issue.

Build Pyrit On 64-Bit CentOS Linux:

[root@dev pyrit]# python2.6 setup.py build
running build
running build_py
running build_ext
building 'cpyrit._cpyrit_cpu' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.6 -c cpyrit/_cpyrit_cpu.c -o build/temp.linux-x86_64-2.6/cpyrit/_cpyrit_cpu.o -DVERSION="0.3.1-dev (svn r234)"
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.6 -c cpyrit/_cpyrit_cpu_sse2.S -o build/temp.linux-x86_64-2.6/cpyrit/_cpyrit_cpu_sse2.o -DVERSION="0.3.1-dev (svn r234)"
gcc -pthread -shared build/temp.linux-x86_64-2.6/cpyrit/_cpyrit_cpu.o build/temp.linux-x86_64-2.6/cpyrit/_cpyrit_cpu_sse2.o -L/usr/lib64 -lssl -lpcap -lpython2.6 -o build/lib.linux-x86_64-2.6/cpyrit/_cpyrit_cpu.so
running build_scripts
creating build/scripts-2.6
copying and adjusting pyrit -> build/scripts-2.6
changing mode of build/scripts-2.6/pyrit from 644 to 755

So to libpcap-devel is the package that provides pcap.h on CentOS Linux.


List Price: $49.99 USD
New From: $26.95 USD In Stock
Used from: $18.89 USD In Stock


List Price: $54.99 USD
New From: $14.99 USD In Stock
Used from: $10.88 USD In Stock

Share