thiago costa

thiago costa

  • NA
  • 319
  • 0

How to detect when a application tries to access the internet?

Aug 28 2020 5:14 PM
c# windows forms. 
 
Hello there guys, how are you?
 
I want my application to detect when any application (example game.exe) attempts to connect to the internet.
So the app will pretty much trigger when game.exe attempts to connect to the internet.
 
That's all I am looking to do, I can't figure it out, I looked everywhere! 
I found this ETW event tracing in nuget but I can't figure it out.
 
I got confortable using windows firewall api, I can manually block or allow any .exe to use the internet, but I don't know how to detect when a app attempts to connect.
 
so I think what I am trying to do is, run a infinite loop, through each process, and check to see if it is using the internet.... and block it. Then I will create a popup window asking "game.exe attempting to use internet, allow? Block?" 
 
What's the best way to detect when an application is using the internet?
 
Thanks so much guys! 
 
 

Answers (1)