Could anyone suggest a good packet sniffer class for c++? [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Could anyone suggest a good packet sniffer class for c++? Looking for a easy insertable class I can use in my c++ program, nothing complicated.

You will never be able to intercept network traffic just by inserting a class into your project. Packet capture functionality requires kernel mode support, hence you will at the very least need to have your application require or install libpcap/WinPcap, as Will Dean pointed out.
Most modern Unix-like distributions include libpcap out of the box, in which case you could take a look at this very simple example: http://www.tcpdump.org/pcap.htm
If you're using Windows, you're more or less on your own, although WinPcap programming is extremely similar to libpcap programming (unsurprisingly, since it's a libpcap port to Win32.) The SDK can be found here: http://www.winpcap.org/devel.htm
At any rate, no matter the operating system, you will need root / Administrator access to actually perform a capture. Just using the library to replay or analyze precaptured data doesn't require any special privilege, of course.

You'll need to say something about your platform, as this is a platform rather than a language thing.
But assuming you're on something common, look into pcap or winpcap.

Microsoft Network Monitor has a packet capture and analysis API, see the netmon blog for some basic info.

Related

Communication method for data exchange between a server and several clients for 10+ years [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
We're running an experiment which will involve collecting data from multiple stations around the world. Each station will be providing HDF5 files with magnetic field measurements in a rate of 1 kHz and some auxiliary data in real time. The latency is going to be a few minutes.
I'm assigned to design this program (in C++, with clients/server model, with server being in linux and clients being cross-platform), and apparently I'll be designing this from scratch. My first concern is not to really do everything from scratch because this will be more error prone and pure wrong, so my question here is: What information/file transfer protocols/libraries should I use so that
The program can live for 10+ years with minimal maintenance
I can have very good support from the community for when I need help.
Since we need something relatively secure, my first thought was libssh (the only cross platform opensource library available out there for ssh), but then after discussing with some pros there I realized that the support there isn't so wonderful because only a few people work with libssh. The pros there hesitated in suggesting OpenSSL, but with OpenSSL I'll have to write my own authentication (apparently, I'm not an expert and that's why I'm asking).
What would you suggest? Please share your vision to whether I should go for OpenSSL, libssh, or something else.
PS: Please, if you're going to start off by saying this question is off-topic, move on and ignore it. Consider being helpful rather than critical.
If you require any additional information, please ask.
I think that OpenSSL might be a good choice.
No you do not have to "write you own authentication" - you just need to generate certificates and keys and put them in the right places - that is all.
I would suggest to look at the examples in <openssl-source-dir>/demos and <openssl-source-dir>/apps to get you started. Reading a book about OpenSSL would also be a good idea - for many other reasons (sometimes not directly related with SSL/TLS).
I hope that helps.

network packet creation/parsing library? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for a library that helps with network packet creation/parsing. Something as Python dpkg library. I need to change IP addresses, to check ports and to analyze payload of TCP/UDP packets which I have as Ethernet frames.
I know this can be done manually, e.g. as is presented in WinPcap docs or libpcap docs. Are there any library for this?
C++ on Windows.
Take a look to libcrafter. It's a library for creation and decoding of network packets very similar to Scapy. Not sure if it can work on Windows but you can try.
I know it's been a while this answer but you should try libtins. It is a really versatile, object-oriented and efficient library.
Disclaimer: I was one of the creators of the library and it is actively maintained by Matias Fontanini.
Have a look at the plugins and API for for Wireshark.

Find available network interfaces in C/C++? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Does anyone know a C/C++ code for finding the network interfaces available?
I've been looking for some code, but most times they are quite complex. Is there a simple way to do this?
See the getifaddrs man page. There is an example program towards the end.
If you're looking for this in context of a desktop application, and you want to be notified of changes (e.g. interfaces connecting/disconnecting), consider using DBus to monitor NetworkManager.
http://projects.gnome.org/NetworkManager/developers/api/09/spec.html
You can enumerate interfaces, as well as interface-specific things (like available and connected WiFi access points, configured-but-not-dialed PPP links, and so forth), and if anything changes, you'll receive a notification over the DBus.
(If this is for something more like a server program, where you expect the network configuration to remain more stable, then things like getifaddrs are possibly more appropriate.)

Async C++ Communication Library for Linux (and Windows) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for a communications library (socket, possibly IPC as well) for usage in C++ on Linux, if possible also on Windows if it's platform independent.
It should be async. I tried the Boost Asio Library, but due to limitations we can't find a solution for, we cannot use the Asio library in our solution.
It should be an implementation where no external binary is needed to be executed separately to act as an independent server.
Does anyone of you know something that might help me with these constraints, as I don't want to implement the communication from scratch.
Edit:
One more limitation I forgot to mention. The communication should allow implementation independent client and server, so the messaging system should deliver and receive single messages/strings to and from dedicated sources (server s sends string str to client c)
Edit 2:
The Boost limitations are that with the current system, Boost Asio compiled with the MPI compiler of either MPICH2 or openmpi, especially when using mpi calls, loses several messages when trying to communicate over asio.
Take a look at ZeroMQ, a.k.a ØMQ.
Lot's of free stuff available, look for anything implementing AMQP (for example, and not limited to: Apache's attempt - ActiveMQ, ZeroMQ as listed above, rabbit mq [which is more complete than zero] and even Red Hat are in the game with Red Hat Messaging).
Lot's of pay for solutions ranging from Tibco to 29 West, Tervela to Solace - this depends on how much you want to fork out...
Other options, I really like include OpenDDS - different to AMQP, but again highly scalable and very good performance. (forgot to say, OpenDDS uses ACE under the covers...)

Windows Named Pipe Support in Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm looking at a project which will require inter-process communication between a legacy Windows application using named pipes, and a new service running on a Linux server. The windows application cannot be changed. Does anyone know if there is a Linux library available that supports Windows named pipes? Or even better, can anyone recommend a library they have used for this purpose?
Windows and Linux named pipes are different animals. If an interop solution exists you are going to be one of a very small population of users.
You might be better off writing a proxy on the Windows side to map between Named Pipe and socket, and connecting this to a socket on the Linux end. This provides you a useful networked interface on the Linux side going forward, and removes what might be a world of Named Pipes interop hurt from the picture.
If I was doing this I would try to produce a simple passthrough proxy in C# (managed code) as a proof of concept. Can always convert to native code (Win32/C++) if throughput does not measure up. There is some sample C# code here that might be a useful reference.
Here is background on the nuances of Windows vs Linux named pipes.
I bet Samba/Winbind contains highly relevant code. Not sure how reusable it is, though.