Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which language is better for packet capturing and processing

I want to write a program that has 2 threads , one thread continuously captures packets from the network and dumps them in a buffer every t seconds and the other thread continuously reads this buffer and processes it every t seconds.. Can this be done in C ? or will Java be a better option ?

like image 780
trinity Avatar asked Jan 23 '23 18:01

trinity


2 Answers

C and libpcap

like image 85
Frunsi Avatar answered Jan 25 '23 09:01

Frunsi


The answer here is the famous "libpcap". Use your favourite language as long as there is a good libpcap wrapper available for it.

  • C/C++ is of course a perfect choice if you like it since you don't need any wrapper.
  • JNetPcap (http://jnetpcap.com/) is a java winpcap/libpcap wrapper
  • Sharpcap (http://www.codeproject.com/KB/IP/sharppcap.aspx?msg=2472909) is a C# libpcap parser. I did some stuff with it some times ago.
  • ...

So pick your language, check the existence of the wrapper and go on. If there is no wrapper for this language, either change your choice, or create your own wrapper

like image 31
almathie Avatar answered Jan 25 '23 08:01

almathie