• 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

bash

  1. [root@dev pyrit]# python2.6 setup.py build
  2. running build
  3. running build_py
  4. running build_ext
  5. building 'cpyrit._cpyrit_cpu' extension
  6. 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)"
  7. cpyrit/_cpyrit_cpu.c:26:18: error: pcap.h: No such file or directory
  8. cpyrit/_cpyrit_cpu.c:87: error: expected specifier-qualifier-list before ‘pcap_t’
  9. cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_init’:
  10. cpyrit/_cpyrit_cpu.c:1376: error: ‘PcapReader’ has no member named ‘p’
  11. cpyrit/_cpyrit_cpu.c:1377: error: ‘PcapReader’ has no member named ‘status’
  12. cpyrit/_cpyrit_cpu.c:1377: error: ‘PcapReader’ has no member named ‘datalink’
  13. cpyrit/_cpyrit_cpu.c:1382: error: ‘PcapReader’ has no member named ‘filtered’
  14. cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_dealloc’:
  15. cpyrit/_cpyrit_cpu.c:1393: error: ‘PcapReader’ has no member named ‘p’
  16. cpyrit/_cpyrit_cpu.c:1393: error: ‘PcapReader’ has no member named ‘status’
  17. cpyrit/_cpyrit_cpu.c:1394: warning: implicit declaration of function ‘pcap_close’
  18. cpyrit/_cpyrit_cpu.c:1394: error: ‘PcapReader’ has no member named ‘p’
  19. cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_close’:
  20. cpyrit/_cpyrit_cpu.c:1404: error: ‘PcapReader’ has no member named ‘status’
  21. cpyrit/_cpyrit_cpu.c:1405: error: ‘PcapReader’ has no member named ‘p’
  22. cpyrit/_cpyrit_cpu.c:1406: error: ‘PcapReader’ has no member named ‘status’
  23. cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_setup’:
  24. cpyrit/_cpyrit_cpu.c:1417: error: ‘PcapReader’ has no member named ‘datalink’
  25. cpyrit/_cpyrit_cpu.c:1417: warning: implicit declaration of function ‘pcap_datalink’
  26. cpyrit/_cpyrit_cpu.c:1417: error: ‘PcapReader’ has no member named ‘p’
  27. cpyrit/_cpyrit_cpu.c:1419: warning: implicit declaration of function ‘pcap_datalink_val_to_name’
  28. cpyrit/_cpyrit_cpu.c:1419: error: ‘PcapReader’ has no member named ‘datalink’
  29. cpyrit/_cpyrit_cpu.c:1419: warning: assignment makes pointer from integer without a cast
  30. cpyrit/_cpyrit_cpu.c:1432: error: ‘PcapReader’ has no member named ‘filtered’
  31. cpyrit/_cpyrit_cpu.c:1432: error: ‘PcapReader’ has no member named ‘datalink’
  32. cpyrit/_cpyrit_cpu.c:1432: error: ‘DLT_IEEE802_11’ undeclared (first use in this function)
  33. cpyrit/_cpyrit_cpu.c:1432: error: (Each undeclared identifier is reported only once
  34. cpyrit/_cpyrit_cpu.c:1432: error: for each function it appears in.)
  35. cpyrit/_cpyrit_cpu.c:1433: error: ‘PcapReader’ has no member named ‘datalink’
  36. cpyrit/_cpyrit_cpu.c:1433: error: ‘DLT_PRISM_HEADER’ undeclared (first use in this function)
  37. cpyrit/_cpyrit_cpu.c:1434: error: ‘PcapReader’ has no member named ‘datalink’
  38. cpyrit/_cpyrit_cpu.c:1434: error: ‘DLT_IEEE802_11_RADIO_AVS’ undeclared (first use in this function)
  39. cpyrit/_cpyrit_cpu.c:1435: error: ‘PcapReader’ has no member named ‘datalink’
  40. cpyrit/_cpyrit_cpu.c:1435: error: ‘DLT_IEEE802_11_RADIO’ undeclared (first use in this function)
  41. cpyrit/_cpyrit_cpu.c:1436: error: ‘PcapReader’ has no member named ‘filtered’
  42. cpyrit/_cpyrit_cpu.c:1454: error: ‘PcapReader’ has no member named ‘status’
  43. cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_open_live’:
  44. cpyrit/_cpyrit_cpu.c:1465: error: ‘PCAP_ERRBUF_SIZE’ undeclared (first use in this function)
  45. cpyrit/_cpyrit_cpu.c:1471: error: ‘PcapReader’ has no member named ‘status’
  46. cpyrit/_cpyrit_cpu.c:1477: error: ‘PcapReader’ has no member named ‘p’
  47. cpyrit/_cpyrit_cpu.c:1477: warning: implicit declaration of function ‘pcap_open_live’
  48. cpyrit/_cpyrit_cpu.c:1478: error: ‘PcapReader’ has no member named ‘p’
  49. cpyrit/_cpyrit_cpu.c:1465: warning: unused variable ‘errbuf’
  50. cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_open_offline’:
  51. cpyrit/_cpyrit_cpu.c:1497: error: ‘PCAP_ERRBUF_SIZE’ undeclared (first use in this function)
  52. cpyrit/_cpyrit_cpu.c:1503: error: ‘PcapReader’ has no member named ‘status’
  53. cpyrit/_cpyrit_cpu.c:1509: error: ‘PcapReader’ has no member named ‘p’
  54. cpyrit/_cpyrit_cpu.c:1509: warning: implicit declaration of function ‘pcap_open_offline’
  55. cpyrit/_cpyrit_cpu.c:1510: error: ‘PcapReader’ has no member named ‘p’
  56. cpyrit/_cpyrit_cpu.c:1497: warning: unused variable ‘errbuf’
  57. cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_read’:
  58. cpyrit/_cpyrit_cpu.c:1534: error: ‘PcapReader’ has no member named ‘status’
  59. cpyrit/_cpyrit_cpu.c:1543: warning: implicit declaration of function ‘pcap_next_ex’
  60. cpyrit/_cpyrit_cpu.c:1543: error: ‘PcapReader’ has no member named ‘p’
  61. cpyrit/_cpyrit_cpu.c:1553: error: dereferencing pointer to incomplete type
  62. cpyrit/_cpyrit_cpu.c:1563: error: dereferencing pointer to incomplete type
  63. cpyrit/_cpyrit_cpu.c:1564: error: dereferencing pointer to incomplete type
  64. cpyrit/_cpyrit_cpu.c:1582: warning: implicit declaration of function ‘pcap_geterr’
  65. cpyrit/_cpyrit_cpu.c:1582: error: ‘PcapReader’ has no member named ‘p’
  66. cpyrit/_cpyrit_cpu.c:1582: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
  67. cpyrit/_cpyrit_cpu.c: In function ‘PcapReader_filter’:
  68. cpyrit/_cpyrit_cpu.c:1598: error: storage size of ‘fp’ isn’t known
  69. cpyrit/_cpyrit_cpu.c:1604: error: ‘PcapReader’ has no member named ‘status’
  70. cpyrit/_cpyrit_cpu.c:1610: error: ‘PcapReader’ has no member named ‘filtered’
  71. cpyrit/_cpyrit_cpu.c:1612: warning: implicit declaration of function ‘pcap_compile’
  72. cpyrit/_cpyrit_cpu.c:1612: error: ‘PcapReader’ has no member named ‘p’
  73. cpyrit/_cpyrit_cpu.c:1615: error: ‘PcapReader’ has no member named ‘filtered’
  74. cpyrit/_cpyrit_cpu.c:1618: warning: implicit declaration of function ‘pcap_setfilter’
  75. cpyrit/_cpyrit_cpu.c:1618: error: ‘PcapReader’ has no member named ‘p’
  76. cpyrit/_cpyrit_cpu.c:1620: error: ‘PcapReader’ has no member named ‘p’
  77. cpyrit/_cpyrit_cpu.c:1620: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
  78. cpyrit/_cpyrit_cpu.c:1621: warning: implicit declaration of function ‘pcap_freecode’
  79. cpyrit/_cpyrit_cpu.c:1598: warning: unused variable ‘fp’
  80. cpyrit/_cpyrit_cpu.c: At top level:
  81. cpyrit/_cpyrit_cpu.c:1920: error: ‘PcapReader’ has no member named ‘datalink’
  82. cpyrit/_cpyrit_cpu.c:1922: error: ‘PcapReader’ has no member named ‘filtered’
  83. 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:

bash

  1. [root@dev pyrit]# yum install libpcap-devel
  2. Loaded plugins: fastestmirror
  3. Loading mirror speeds from cached hostfile
  4.  * addons: hpc.arc.georgetown.edu
  5.  * base: mirror.cisp.com
  6.  * epel: ftp.osuosl.org
  7.  * extras: mirror.sanctuaryhost.com
  8.  * updates: mirror.sanctuaryhost.com
  9. Setting up Install Process
  10. Resolving Dependencies
  11. --> Running transaction check
  12. ---> Package libpcap-devel.i386 14:0.9.4-14.el5 set to be updated
  13. --> Processing Dependency: libpcap.so.0.9.4 for package: libpcap-devel
  14. ---> Package libpcap-devel.x86_64 14:0.9.4-14.el5 set to be updated
  15. --> Running transaction check
  16. ---> Package libpcap.i386 14:0.9.4-14.el5 set to be updated
  17. --> Finished Dependency Resolution
  18.  
  19. Dependencies Resolved
  20.  
  21. ====================================================================================================================================
  22.  Package                           Arch                       Version                                Repository                Size
  23. ====================================================================================================================================
  24. Installing:
  25.  libpcap-devel                     i386                       14:0.9.4-14.el5                        base                     118 k
  26.  libpcap-devel                     x86_64                     14:0.9.4-14.el5                        base                     117 k
  27. Installing for dependencies:
  28.  libpcap                           i386                       14:0.9.4-14.el5                        base                     107 k
  29.  
  30. Transaction Summary
  31. ====================================================================================================================================
  32. Install      3 Package(s)
  33. Update       0 Package(s)
  34. Remove       0 Package(s)
  35.  
  36. Total download size: 342 k
  37. Is this ok [y/N]: y
  38. Downloading Packages:
  39. (1/3): libpcap-0.9.4-14.el5.i386.rpm                                                                         | 107 kB     00:00
  40. (2/3): libpcap-devel-0.9.4-14.el5.x86_64.rpm                                                                 | 117 kB     00:00
  41. (3/3): libpcap-devel-0.9.4-14.el5.i386.rpm                                                                   | 118 kB     00:00
  42. ------------------------------------------------------------------------------------------------------------------------------------
  43. Total                                                                                               501 kB/s | 342 kB     00:00
  44. Running rpm_check_debug
  45. Running Transaction Test
  46. Finished Transaction Test
  47. Transaction Test Succeeded
  48. Running Transaction
  49.   Installing     : libpcap                                                                                                      1/3
  50.   Installing     : libpcap-devel                                                                                                2/3
  51.   Installing     : libpcap-devel                                                                                                3/3
  52.  
  53. Installed:
  54.   libpcap-devel.i386 14:0.9.4-14.el5                              libpcap-devel.x86_64 14:0.9.4-14.el5
  55.  
  56. Dependency Installed:
  57.   libpcap.i386 14:0.9.4-14.el5
  58.  
  59. Complete!

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

Build Pyrit On 64-Bit CentOS Linux:

bash

  1. [root@dev pyrit]# python2.6 setup.py build
  2. running build
  3. running build_py
  4. running build_ext
  5. building 'cpyrit._cpyrit_cpu' extension
  6. 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)"
  7. 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)"
  8. 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
  9. running build_scripts
  10. creating build/scripts-2.6
  11. copying and adjusting pyrit -> build/scripts-2.6
  12. 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.

Python Essential Reference (4th Edition) (Paperback)


List Price: $49.99 USD
New From: $20.99 USD In Stock
Used from: $14.40 USD In Stock

Learning Python: Powerful Object-Oriented Programming (Paperback)


List Price: $54.99
New From: $19.87 USD In Stock
Used from: $4.99 USD In Stock

Share