Categories
Archives
- October 2012
- September 2012
- May 2012
- April 2012
- March 2012
- November 2011
- October 2011
- September 2011
- July 2011
- May 2011
- April 2011
- March 2011
- February 2011
- October 2010
- August 2010
- May 2010
- March 2010
- February 2010
- November 2009
- September 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- December 2008
- October 2008
- September 2008
- July 2008
- June 2008
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:
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:
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