Ad Widget

Collapse

Automatic nmap scanning

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vijayk
    Senior Member
    • May 2023
    • 305

    #16
    Perfect working.

    Comment

    • PeterZielony
      Senior Member
      • Nov 2022
      • 146

      #17
      Small mistake in API, i though (for some reasons) active_available represents if host is disabled or not.

      Changed to "status" instead.
      Attached Files

      Hiring in the UK? Drop a message

      Comment

      • vijayk
        Senior Member
        • May 2023
        • 305

        #18
        Hi,
        {ITEM.LASTVALUE1} is only showing first discover port in trigger. What can we do if we want the list of all received ports?

        Comment

        • PeterZielony
          Senior Member
          • Nov 2022
          • 146

          #19
          Originally posted by vijayk
          Hi,
          {ITEM.LASTVALUE1} is only showing first discover port in trigger. What can we do if we want the list of all received ports?
          You can go to template trigger, and make sure you have selected multiple event generation selected. For each port - one alert.

          or modify powershell to send all as one value instead one by one
          Last edited by PeterZielony; 16-09-2023, 12:14.

          Hiring in the UK? Drop a message

          Comment

          • vijayk
            Senior Member
            • May 2023
            • 305

            #20
            Originally posted by PeterZielony

            You can go to template trigger, and make sure you have selected multiple event generation selected. For each port - one alert.

            or modify powershell to send all as one value instead one by one
            Can you please share the powershell script to send all as one value? I'm not aware with Powershell so. I don't want multiple trigger.

            Comment

            • PeterZielony
              Senior Member
              • Nov 2022
              • 146

              #21
              Originally posted by vijayk

              Can you please share the powershell script to send all as one value? I'm not aware with Powershell so. I don't want multiple trigger.
              I don't work weekends but will take a look when i got chance.

              Hiring in the UK? Drop a message

              Comment

              • vijayk
                Senior Member
                • May 2023
                • 305

                #22
                Originally posted by PeterZielony

                I don't work weekends but will take a look when i got chance.
                Enjoy the Weekend.

                We have here weekend at Wednesday not in Sunday.

                Comment

                • PeterZielony
                  Senior Member
                  • Nov 2022
                  • 146

                  #23
                  Originally posted by vijayk

                  Enjoy the Weekend.

                  We have here weekend at Wednesday not in Sunday.
                  Thanks! would be nice to have one in the middle of the week!


                  in meantime, try this one.
                  had no vpn so couldn't test it but in theory, it should work.


                  changed this:



                  # Send unauthorized open ports to zabbix
                  if ($UnauthorizedPorts.Count -gt 0) {
                  Add-Content -Path $LogFilePath -Value ( $TimeStamp +" Unauthorized Ports found for host $HostName : $UnauthorizedPorts")
                  $UnauthorizedPorts | ForEach-Object {
                  Send-DataZabbixItem -HostName $HostName -ItemKeyZbx $HostItemKeyPort -UnauthorizedPort $_ -ZabbixReceiver $ZabbixReceiver -HostTLSOption $HostTLS
                  }
                  } else
                  {
                  Write-Host "No unauthorized open ports found."
                  }​


                  to this:
                  # Send unauthorized open ports to zabbix
                  if ($UnauthorizedPorts.Count -gt 0) {
                  Add-Content -Path $LogFilePath -Value ( $TimeStamp +" Unauthorized Ports found for host $HostName : $UnauthorizedPorts")
                  #send array instead this time
                  Send-DataZabbixItem -HostName $HostName -ItemKeyZbx $HostItemKeyPort -UnauthorizedPort $UnauthorizedPorts -ZabbixReceiver $ZabbixReceiver -HostTLSOption $HostTLS
                  } else {
                  Write-Host "No unauthorized open ports found."
                  }​​
                  Attached Files
                  Last edited by PeterZielony; 17-09-2023, 04:53.

                  Hiring in the UK? Drop a message

                  Comment

                  • vijayk
                    Senior Member
                    • May 2023
                    • 305

                    #24
                    Tried this but received the error message...

                    Send-DataZabbixItem : Cannot process argument transformation on parameter 'UnauthorizedPort'.
                    Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32".
                    At C:\Users\User\Downloads\network-scanner.ps1:327 char:91
                    + ... mKeyZbx $HostItemKeyPort -UnauthorizedPort $UnauthorizedPorts -Zabbix ...
                    + ~~~~~~~~~~~~~~~~~~
                    + CategoryInfo : InvalidData: ( [Send-DataZabbixItem], ParameterBindingArgumentT
                    ransformationException
                    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Send-DataZabbixItem

                    ​​ : The term '​​' is not recognized as the name of a cmdlet, function, script file, or
                    operable program. Check the spelling of the name, or if a path was included, verify that the
                    path is correct and try again.
                    At C:\Users\User\Downloads\network-scanner.ps1:332 char:5
                    + } ​​
                    + ~~
                    + CategoryInfo : ObjectNotFound: (​​:String) [], CommandNotFoundException
                    + FullyQualifiedErrorId : CommandNotFoundException​

                    Comment

                    • PeterZielony
                      Senior Member
                      • Nov 2022
                      • 146

                      #25
                      Originally posted by vijayk
                      Tried this but received the error message...

                      Send-DataZabbixItem : Cannot process argument transformation on parameter 'UnauthorizedPort'.
                      Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32".
                      At C:\Users\User\Downloads\network-scanner.ps1:327 char:91
                      + ... mKeyZbx $HostItemKeyPort -UnauthorizedPort $UnauthorizedPorts -Zabbix ...
                      + ~~~~~~~~~~~~~~~~~~
                      + CategoryInfo : InvalidData: ( [Send-DataZabbixItem], ParameterBindingArgumentT
                      ransformationException
                      + FullyQualifiedErrorId : ParameterArgumentTransformationError,Send-DataZabbixItem

                      ​​ : The term '​​' is not recognized as the name of a cmdlet, function, script file, or
                      operable program. Check the spelling of the name, or if a path was included, verify that the
                      path is correct and try again.
                      At C:\Users\User\Downloads\network-scanner.ps1:332 char:5
                      + } ​​
                      + ~~
                      + CategoryInfo : ObjectNotFound: (​​:String) [], CommandNotFoundException
                      + FullyQualifiedErrorId : CommandNotFoundException​
                      oh forgot. this is an array
                      try attached
                      Attached Files

                      Hiring in the UK? Drop a message

                      Comment

                      • vijayk
                        Senior Member
                        • May 2023
                        • 305

                        #26
                        Originally posted by PeterZielony

                        oh forgot. this is an array
                        try attached
                        Working perfect. Just one change is there in function Send-DataZabbixItem param($UnauthorizedPort) should be [string] instead of [int32]

                        Comment

                        Working...