Kaseya Community

Scan for open port on the agent machine

  • I want to request a script that can scan for open port on the agent machine,and send me a list of open port on the agent machine via email.Thanks in advance.

    Legacy Forum Name: Scan for open port on the agent machine,
    Legacy Posted By Username: amir
  • Here is something fast & dirty using the NETSTAT command:

    (NOTE: replace the "" placeholder with your email address)



    Script Name: NETSTAT Report
    Script Description: This script remotelly executes the NETSTAT -a command and emails the output to the email address(es) configured.

    IF True
    THEN
    Get Variable
    Parameter 1 : 4
    Parameter 2 :
    Parameter 3 : agentDrv
    OS Type : 1
    Get Variable
    Parameter 1 : 6
    Parameter 2 :
    Parameter 3 : machineName
    OS Type : 1
    Execute Shell Command
    Parameter 1 : %windir%\system32\netstat.exe -a > #agentDrv#temp\ports.txt
    Parameter 2 : 1
    OS Type : 1
    Get Variable
    Parameter 1 : 1
    Parameter 2 : #agentDrv#temp\ports.txt
    Parameter 3 : ports
    OS Type : 1
    Send Email
    Parameter 1 :
    Parameter 2 : Port status on #machineName#
    Parameter 3 : #ports#
    OS Type : 1
    Delete File
    Parameter 1 : #agentDrv#temp\ports.txt
    OS Type : 1
    ELSE


    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: bellcpa
  • Thanks , i will try it out.


    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: amir
  • Looks like path slashes were removed for some reason when I initially posted the script, I just fixed it. Thanks

    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: bellcpa
  • Does this script work as expected?

    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: sourceminer