blackneos940

Active Member
Joined
May 16, 2017
Messages
332
Reaction score
195
Credits
205
So hello everybody..... :3 I have a setup where I need to monitor for any foreign I.P. Addresses..... :3 I know I could just use Wireshark, but I wanna make a Program myself to do this..... :3 I imagine it involves Sockets 'n stuff, but I'm not sure where to go about it..... :\ Any ideas guys.....? :3 Thank you SO much for any help!..... :D
 


JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,674
Reaction score
2,427
Credits
13,194
For monitoring network connections there is always the ss command (socket statistics), which is a part of the iproute2 package. Faster than netstat. Simple to use. It gets all of its information directly from the kernel.

By using ss in a script you should be able to get a list of all open network connections and then filter them by using some of the ss commands options in combination with standard unix tools (grep, ag, sed, awk, less, more etc). That should allow you filter out any connections that you aren't interested in seeing.

That would probably be the simplest solution.

There is a tutorial on the ss command here:
https://www.binarytides.com/linux-ss-command/

As for writing a program to monitor network connections in C - I haven't dealt with any networking related code in the last 10 years, so I'm more than a little rusty with it. So I'm not sure what to suggest offhand!
 
OP
blackneos940

blackneos940

Active Member
Joined
May 16, 2017
Messages
332
Reaction score
195
Credits
205
For monitoring network connections there is always the ss command (socket statistics), which is a part of the iproute2 package. Faster than netstat. Simple to use. It gets all of its information directly from the kernel.

By using ss in a script you should be able to get a list of all open network connections and then filter them by using some of the ss commands options in combination with standard unix tools (grep, ag, sed, awk, less, more etc). That should allow you filter out any connections that you aren't interested in seeing.

That would probably be the simplest solution.

There is a tutorial on the ss command here:
https://www.binarytides.com/linux-ss-command/

As for writing a program to monitor network connections in C - I haven't dealt with any networking related code in the last 10 years, so I'm more than a little rusty with it. So I'm not sure what to suggest offhand!
Ok!..... :3 Thanks, good sir!..... :3 I still wanna do it in C, but this is something to look at!..... :D
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Members online


Latest posts

Top