LAN and WAN software detection.

Where can I find actual working "C" source code examples, on the internet, that
detects any/all LAN and/or a WAN connection(s) to calling program.

Thanks, Skiutah2Carrier.
RSVP Please.
I think wireshark is open and in C or c++? Try that project if you are able to deal with a real program (its a LOT more than an example).
I appreciate the feedback, but some clarity is needed please. What are the URL(s).
Five seconds of internet searching yields the source code:
https://code.wireshark.org/review/gitweb?p=wireshark.git;a=tree
I'm having trouble parsing the broken English.

If the OP is just looking for all the active connections of a particular program, then perhaps.
1
2
3
4
5
6
$ netstat -p -t
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 XXX.lan:60244           wq-in-f16.1e100.n:imaps ESTABLISHED 2702/thunderbird
tcp        0      0 XXX.lan:36088           ec2-52-24-160-47.:https ESTABLISHED 2487/firefox    
// snipped 


Or
1
2
3
4
5
$ lsof -i4
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
thunderbi 2702   sc   61u  IPv4  33830      0t0  TCP XXX.lan:60244->wq-in-f16.1e100.net:imaps (ESTABLISHED)
firefox   2487   sc  243u  IPv4  29197      0t0  TCP XXX.lan:36088->ec2-52-24-160-47:https (ESTABLISHED)
// snipped 


If on the other hand, the OP is looking for some kind of introspection software, where a program can discover it's own connectivity (like it should already know this), then that's a different matter.

One scenario I can imagine is where a program 'P' has been run with some kind of DLL injection, and 'P' wishes to discover if there are any unexpected side-channel connections open in the program. The problem with this approach is anyone smart enough to pull off the DLL injection is also likely to be smart enough to tamper with any data 'P' could learn about the connections and hide itself.
Last edited on
not everything is nefarious :) Sometimes you just want to map the computers in your office building. There are tools that do that, and they pretty much assume the computers are not actively trying to duck and dodge. Windows is noisy and you can nail every computer just from idle chatter.
Topic archived. No new replies allowed.