pythonsecuritynetwork-programmingpermissions

How to detect if a Windows application (.exe) is sending data externally?


I'm using a Windows application (.exe) written in Python to manipulate files in a folder. I suspect this application might be sending my files to a remote server without permission. How can I verify if this application is making unwanted network connections?

Specifically:

  1. Is there a way to check if this application is connecting to the internet without having to reverse engineer the source code?
  2. Besides monitoring network traffic, are there any other clear methods to detect internet access, similar to how Android declares internet permission (android.permission.INTERNET)?

The application is supposed to be offline. I'm looking for straightforward ways to determine if it's accessing the internet without delving into complex analysis techniques.


Solution

  • Well, there are two ways I know of to monitor the network requests of a program (on Windows). The first way is to use Process Monitor of the Sysinternals suite. Once you open it, every time an application makes a system call, an entry will appear in the window with the name of the event and some details. And if you select an entry and open its "Properties" window, you can get even more details about it.

    So if you set up a filter to only display network events from your target executable, you should be able to see the program making network requests in real time. Below is a screenshot of me capturing the network events of my browser as an example: screenshot of ProcessMonitor

    Another way is to open a command prompt with administrative priviledges and use the command netstat -bn 1. This would display the list of all open socket connections at the time of running the command, and it would continuously pause for one second and then output the list again until you press Ctrl-C to exit.

    The -b option makes it display which binary is making each connection, and the -n option makes it display IP addresses numerically without trying to resolve them to domain names. And the 1 makes it re-display every second instead of displaying once and exiting. You could remove the -n if you want, but that would make it really slow. And you can see netstat /? for more options.