libpcap | LIBpcap interface to various kernel packet capture mechanism | Learning library

 by   the-tcpdump-group C Version: libpcap-1.10.4 License: Non-SPDX

kandi X-RAY | libpcap Summary

kandi X-RAY | libpcap Summary

libpcap is a C library typically used in Tutorial, Learning applications. libpcap has no bugs and it has medium support. However libpcap has 5 vulnerabilities and it has a Non-SPDX License. You can download it from GitHub.

To report bugs and other problems, contribute patches, request a feature, provide generic feedback etc please see the guidelines for contributing. The documentation directory has README files about specific operating systems and options.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              libpcap has a medium active ecosystem.
              It has 2228 star(s) with 780 fork(s). There are 127 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 80 open issues and 629 have been closed. On average issues are closed in 354 days. There are 38 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of libpcap is libpcap-1.10.4

            kandi-Quality Quality

              libpcap has no bugs reported.

            kandi-Security Security

              libpcap has 5 vulnerability issues reported (1 critical, 1 high, 3 medium, 0 low).

            kandi-License License

              libpcap has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              libpcap releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of libpcap
            Get all kandi verified functions for this library.

            libpcap Key Features

            No Key Features are available at this moment for libpcap.

            libpcap Examples and Code Snippets

            No Code Snippets are available at this moment for libpcap.

            Community Discussions

            QUESTION

            Docker compose fails to start a service with an error 'unknown option' but docker-compose build on the same command is a success
            Asked 2021-Jun-07 at 12:56

            I have a project which has a docker-compose file and a Dockerfile. The project is open here GitHub

            I'm building a demo project with:

            • Traefik
            • Snort 3
            • A NodeJS API dummy for testing

            The issue is that in my Docker file I have a command like this to run on Snort

            ...

            ANSWER

            Answered 2021-Jun-07 at 12:56

            Your entrypoint is conflicting with the command you want to run:

            Source https://stackoverflow.com/questions/67869735

            QUESTION

            Brew install libpcap does not provide binaries
            Asked 2021-May-23 at 09:49

            Stupid question: I'm trying to install libpcap on my macOS (Big Sur) using brew. I've executed "brew install libpcap". Now, I would imagine that I could now run libpcap out of the box, but it tell me that libpcap: command not found. brew tells me this:

            If you need to have libpcap first in your PATH, run: echo 'export PATH="/usr/local/opt/libpcap/bin:$PATH"' >> /Users/michal/.bash_profile

            Now I've checkd that it's in the bash_profile, and it doesn't work. So I check the actual package, and in it, there is no binary file. The binary is also not in usr/local/bin.

            brew furthermore tells me that

            libpcap is keg-only, which means it was not symlinked into /usr/local because macOS already provides this software and installing another version in parallel can cause all kinds of trouble.

            but I don't really know what this means, seeing that I cannot find it anywhere.

            What is going on here? Where is it installed, and how do I run that program?

            ...

            ANSWER

            Answered 2021-May-23 at 09:25

            From TCPDUMP:

            ... libpcap, a portable C/C++ library for network traffic capture.

            libpcap is a library, not a program.

            Source https://stackoverflow.com/questions/67658122

            QUESTION

            Scapy cannot sniff from all interfaces
            Asked 2021-May-13 at 03:01

            I am trying to sniff from all interfaces using scapy, but when I attempt to provide a list of interfaces I get below Error:

            ...

            ANSWER

            Answered 2021-May-13 at 03:01

            There is a problem in scapy. It is described in the issue #3191:

            Basic sniff capture using multiple interfaces.

            When passing a list (or dict) of interfaces, Scapy raises an exception (see below).

            [...]

            Thanks for reporting the issue. That is indeed a regression!

            They identified the commit and it seems specific of the version 2.4.5.

            Try with the version 2.4.4. If you use pip you can try with:

            Source https://stackoverflow.com/questions/67511952

            QUESTION

            How to compile a Go application using gopacket for 32bit mips
            Asked 2021-Mar-11 at 16:39

            I am trying to compile a little application using the gopacket library to linux on a 32bit mips cpu. Unfortunately I am getting loads of errors like this:

            ...

            ANSWER

            Answered 2021-Mar-11 at 16:39

            Ok, after 3 days I think I managed to get things working and I'll summ up what I did.

            In the end the gccgo path was a dead end, so instead of installing gccgo-mips-linux-gnu I installed gcc-mips-linux-gnu.

            Next I set the CC environment variable to point to this:

            Source https://stackoverflow.com/questions/66168484

            QUESTION

            get packet number in libpcap callback
            Asked 2021-Feb-26 at 23:24

            I'm using libpcap to process the WS output.

            My question is: can I have access in the packet number in the pcap_loop callback? Or I will have to use a static variable?

            EDIT:

            As requested:

            ...

            ANSWER

            Answered 2021-Feb-26 at 23:24

            libpcap does not keep track of the ordinal numbers of packets, so you'll have to maintain a packet count in your code.

            Source https://stackoverflow.com/questions/66392932

            QUESTION

            Cant install Net::Pcap with cpan/cpanm on Linux
            Asked 2021-Feb-09 at 21:46

            I am trying to install the module Net::Pcap. Here is what I have done:

            ...

            ANSWER

            Answered 2021-Feb-09 at 21:46

            The problem is with my version of libpcap. This package appears to be broken on libpcap 1.10 and 1.9.1. After installing libpcap 1.8 the package built fine.

            Source https://stackoverflow.com/questions/66123937

            QUESTION

            pcap_dispatch stuck with network filter set
            Asked 2021-Jan-14 at 18:03

            When I run my program with the loopback device "lo" and some filter is applied, it hangs in a poll call (see gdb below). It doesn't happen if the pcap_compile() and pcap_setfilter() calls are skipped and this doesn't occur with other network devices either. pcap_dispatch is called in a loop. The program calls these libpcap functions in order:

            ...

            ANSWER

            Answered 2021-Jan-14 at 18:03

            This seems to be an issue in versions before 1.10.0. As of 1.10.0, issuing pcap_breakloop() will force the poll() call to end and cause pcap_dispatch to return with PCAP_ERROR_BREAK.

            If using an older version, a quick solution is to call pcap_setnonblock() after pcap_activate() and then sleep between pcap_dispatch() calls for a set amount of milliseconds/seconds. This helps to not overload the looping of pcap_dispatch(). You can call pcap_dispatch() with "0" or however many packets desired in this case and they should be available the next time the dispatch is made. You can then either cancel the looping with pcap_breakloop() or your own mechanism.

            Source https://stackoverflow.com/questions/65675702

            QUESTION

            How to convert hex_dump of packets, which were captured in kernel module, to pcap file?
            Asked 2020-Nov-17 at 01:26

            I am writing a kernel module on Linux (Xubuntu x64). The version of the kernel is 5.4.0-52-generic. My kernel module is capturing traffic from an interface and printing it in hex:

            ...

            ANSWER

            Answered 2020-Nov-11 at 01:15

            Is it possible to use text2pcap in kernel module?

            Not without putting it and the code it uses to write a pcap file (which isn't from libpcap, it's from a small library that's part of Wireshark, also used by dumpcap to write pcap and pcapng files) into the kernel.

            How can I save an output as pcap file while being in kernel module?

            You could write your own code to open a file and write to it in the kernel module; "Writing to a file from the Kernel" talks about that.

            It also says

            A "preferred" technique would be to pass the parameters in via IOCTLs and implement a read() function in your module. Then reading the dump from the module and writing into the file from userspace.

            so you might want to consider that; the userspace code could just use libpcap to write the file.

            Source https://stackoverflow.com/questions/64777814

            QUESTION

            Can't get protocol while capture any interfaces with libpcap
            Asked 2020-Nov-01 at 17:55

            I using libpcap code to capture network traffic in my Ubuntu with the following code I have problem the parse the protocol of packet:

            ...

            ANSWER

            Answered 2020-Nov-01 at 17:55

            libpcap will sometimes, depending upon the interface chosen, replace the layer 2 header (ethernet, in this case) with a Linux cooked header which does not have the same length as an ethernet header. You can check the datalink type of your pcap_t with the pcap_datalink function.

            Source https://stackoverflow.com/questions/64634957

            QUESTION

            Configure Qt project (.pro file) to use PcapPlusPlus
            Asked 2020-Oct-02 at 18:28

            I want to use Pcap++ inside my Qt project. I've followed steps in the installation & introduction guide of PcapPlusPlus, but there are still unknowns:

            • How do I implement that in my .pro file : include ../../../Dist/mk/PcapPlusPlus.mk
            • And that:
            ...

            ANSWER

            Answered 2020-Oct-02 at 18:27

            The idea is to convert the .mk to an appropriate code that qmake understands, for example in my case the .mk is:

            Source https://stackoverflow.com/questions/64172910

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install libpcap

            You can download it from GitHub.

            Support

            For some platforms there are README.{system} files that discuss issues with the OS's interface for packet capture on those platforms, such as how to enable support for that interface in the OS, if it's not built in by default. The libpcap interface supports a filtering mechanism based on the architecture in the BSD packet filter. BPF is described in the 1993 Winter Usenix paper ``The BSD Packet Filter: A New Architecture for User-level Packet Capture'' (compressed PostScript, gzipped PostScript, PDF). Although most packet capture interfaces support in-kernel filtering, libpcap utilizes in-kernel filtering only for the BPF interface. On systems that don't have BPF, all packets are read into user-space and the BPF filters are evaluated in the libpcap library, incurring added overhead (especially, for selective filters). Ideally, libpcap would translate BPF filters into a filter program that is compatible with the underlying kernel subsystem, but this is not yet implemented.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/the-tcpdump-group/libpcap.git

          • CLI

            gh repo clone the-tcpdump-group/libpcap

          • sshUrl

            git@github.com:the-tcpdump-group/libpcap.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link