Run batch scripts with NetStat Agent

In NetStat Agent 3.1 we added an ability to run batch scripts (in previous versions only executable files could be run). And because a launched third party program can show a window, we added new properties to user interface: program parameters (such as process name, remote ip, etc.) and an option to show\hide a program window.

On current moment the program supports the following parameters:
%LOC_ADDR% - a local IP address
%LOC_PORT% - a local port
%REM_ADDR% - a remote IP address
%REM_PORT% - a remote port
%PID% - a process ID
%PROCESS% - a process name
%HOSTNAME% - a hostname of remote IP address

Unfortunately, we missed a country parameter, so it will be added in the future release as %COUNTRY% and %CCODE% (country code: US, RU).

Now let’s look how you can use it. We will add a rule that will launch a batch script to log a remote IP and a hostname of special process.
So a batch script called ‘ip_logger.bat’ is below:
echo [%date% : %time%] - %1 %2 >> D:\ip_logger.txt

This script supports only two arguments (you can see it as %1 and %2).
Each time when you will launch it, a line with current date, time and 2 arguments will be added to file ‘D:\ip_logger.txt’.

Now we need to add a rule. Open netstat monitor and do the following:ip logger rule

I used ‘opera.exe’ as a name of my Internet browser. If you are a user of Firefox you need to set ‘firefox.exe’.

Open advanced actions:
netstat advanced action
Press ‘Add’ button at the netstat monitor page. The rule is enabled and ready to log.

All that you need to do is to open a browser and visit any site.
That’s all!

  • October 9th, 2010
  • flexbyte
  • Bookmark and Share

Leave a Reply