{
  "code_name": "pholus_scan",
  "unique_prefix": "PHOLUS",
  "enabled": true,
  "data_source": "script",
  "mapped_to_table": "Pholus_Scan",  
  "data_filters": [
    {
        "compare_column" : "Object_PrimaryID",
        "compare_operator" : "==",
        "compare_field_id": "txtMacFilter",
        "compare_js_template": "'{value}'.toString()", 
        "compare_use_quotes": true 
    }
  ],
  "show_ui": true,
  "localized": ["display_name", "description", "icon"],

  "display_name": [
    {
      "language_code": "en_us",
      "string": "Pholus-Scan (Name discovery)"
    },
    {
      "language_code": "es_es",
      "string": "Pholus-Scan (Descubrimiento de nombre)"
    }
  ],
  "icon": [
    {
      "language_code": "en_us",
      "string": "<i class=\"fa-solid fa-search\"></i>"
    },
    {
      "language_code": "es_es",
      "string": "<i class=\"fa-solid fa-search\"></i>"
    }	
  ],
  "description": [
    {
      "language_code": "en_us",
      "string": "This plugin is to execute a Pholus-scan (name discovery) on the local network"
    },
    {
      "language_code": "es_es",
      "string": "Este plugin sirve para ejecutar un escaneo Pholus (descubrimiento de nombres) en la red local"
    }	  
  ],
    "params" : [
    {
        "name"  : "subnets",
        "type"  : "setting",
        "value" : "SCAN_SUBNETS",
        "base64": true
    },
    {
        "name"  : "timeout",
        "type"  : "setting",
        "value" : "PHOLUS_RUN_TIMEOUT"
  }
  ],  

  "settings": [
    {
      "function": "RUN",            
      "type": "text.select",            
      "default_value":"schedule",
      "options": ["disabled", "once", "schedule", "always_after_scan",  "on_new_device"],
      "localized": ["name", "description"],
      "events": ["run"],
      "name" :[
	  {
          "language_code":"en_us",
          "string" : "When to run"
      },
	  {
          "language_code":"es_es",
          "string" : "Cuando ejecutar"
      }],
      "description": [
        {
          "language_code":"en_us",
          "string" : "<a href=\"https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/pholus_scan/pholus\" target=\"_blank\" >Pholus</a> is a sniffing tool to discover additional information about the devices on the network, including the device name. If enabled this will execute the scan before every network scan cycle until there are no <code>(unknown)</code> or <code>(name not found)</code> devices. Please be aware it can spam the network with unnecessary traffic. Depends on the <a onclick=\"toggleAllSettings()\" href=\"#SCAN_SUBNETS\"><code>SCAN_SUBNETS</code> setting</a>. For a scheduled or one-off scan, check the <a href=\"#PHOLUS_RUN\"><code>PHOLUS_RUN</code> setting</a>.Specify when your Name-discovery scan will run. Typical setting would be <code>on_new_device</code> or <code>schedule</code> and then you specify a cron-like schedule in the <a href=\"#PHOLUS_RUN_SCHD\"><code>PHOLUS_RUN_SCHD</code>setting</a>."
      },
        {
          "language_code":"es_es",
          "string" : "<a href=\"https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/pholus_scan/pholus\" target=\"_blank\" >Pholus</a> es una herramienta de rastreo para descubrir información adicional sobre los dispositivos en la red, incluido el nombre del dispositivo. Si está habilitado, ejecutará el escaneo antes de cada ciclo de escaneo de red hasta que no haya dispositivos <code>(unknown)</code> o <code>(name not found)</code>. Tenga en cuenta que puede enviar spam a la red con tráfico innecesario. Depende de la configuración de <a onclick=\"toggleAllSettings()\" href=\"#SCAN_SUBNETS\"><code>SCAN_SUBNETS</code></a>. Para un análisis programado o único, verifique la configuración de <a href=\"#PHOLUS_RUN\"><code>PHOLUS_RUN</code></a>."
      }
    ]
  },    
    {
      "function": "CMD",
      "type": "readonly",
      "default_value": "python3 /home/pi/pialert/front/plugins/pholus_scan/script.py userSubnets={subnets} timeoutSec={timeout}",
      "options": [],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Command"
        },
        {
          "language_code": "es_es",
          "string": "Comando"
        }		
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "Command to run. This should not be changed"
        },
        {
          "language_code": "es_es",
          "string": "Comando para ejecutar. Esto no debe ser cambiado"
        }		
      ]
    },
    
    {
      "function": "RUN_TIMEOUT",
      "type": "integer",
      "default_value": 300,
      "options": [],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Run timeout"
        },
        {
          "language_code": "es_es",
          "string": "Tiempo límite de ejecución"
        }		
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "Network scan time in seconds. Pholus scan will always run this long. The longer it runs the more device names might be resolved. Will be divided by the number of subnets."
        },
        {
          "language_code": "es_es",
          "string": "Tiempo de escaneo de red en segundos. El escaneo de Pholus siempre durará este tiempo. Cuanto más tiempo se ejecute, más nombres de dispositivos se podrán resolver. Se dividirá por el número de subredes."
        }	      
      ]
    },
    {
        "function": "RUN_SCHD",
        "type": "text",
        "default_value":"30 3 * * *",
        "options": [],
        "localized": ["name", "description"],
        "name" : [{
            "language_code":"en_us",
            "string" : "Schedule"
        },
		    {
            "language_code":"es_es",
            "string" : "Schedule"
        }],
        "description": [{
            "language_code":"en_us",
            "string" : "Only enabled if you select <code>schedule</code> in the <a href=\"#PHOLUS_RUN\"><code>PHOLUS_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>30 3 * * *</code> will run the scan at 3:30 am. Will be run NEXT time the time passes. <br/>"
        },
	{
            "language_code":"es_es",
            "string" : "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#PHOLUS_RUN\"><code>PHOLUS_RUN</code></a>. Asegúrese de ingresar la programación en el formato cron correcto (por ejemplo, validar en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, al ingresar <code>30 3 * * *</code> se ejecutará el escaneo a las 3:30 am. Se ejecutará la PRÓXIMA vez que pase el tiempo. <br/>"
        }]
    },
    {
        "function": "DAYS_DATA",
        "type": "integer",
        "default_value":30,
        "options": [],
        "localized": ["name", "description"],
        "name" : [{
            "language_code":"en_us",
            "string" : "Schedule"
        },
		    {
            "language_code":"es_es",
            "string" : "Retención de datos"
        }],
        "description": [
          {
            "language_code":"en_us",
            "string" : "How many days of Pholus scan entries should be kept (globally, not device specific!) Enter <code>0</code> to disable."
        },
          {
            "language_code":"es_es",
            "string" : "Cuántos días de entradas de escaneo de Pholus deben conservarse (globalmente, ¡no específico del dispositivo!). El archivo <a href=\"/maintenance.php#tab_Logging\">pialert_pholus.log</a> no se modifica. Introduzca <code>0</code> para desactivar."
        }
      ]
    },
    {
        "function": "WATCH",
        "type": "text.multiselect",
        "default_value":["Watched_Value1", "Watched_Value2"],
        "options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
        "localized": ["name", "description"],
        "name" :[{
            "language_code":"en_us",
            "string" : "Watched"
        },
		    {
            "language_code":"es_es",
            "string" : "Watched"
        }] ,
        "description":[{
            "language_code":"en_us",
            "string" : "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Info</li><li><code>Watched_Value2</code> is Record type</li><li><code>Watched_Value3</code> is Info </li><li><code>Watched_Value4</code> is N/A </li></ul>"
        },
	{
            "language_code":"es_es",
            "string" : "Enviar una notificación si los valores seleccionados cambian. Utilice <code>CTRL + Clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es Información</li><li><code>Watched_Value2</code> es Tipo de registro</li><li><code>Watched_Value3</code> es La información </li><li><code>Watched_Value4</code> es N/A </li></ul>"
        }] 
    },
    {
      "function": "REPORT_ON",
      "type": "text.multiselect",
      "default_value": ["new"],
      "options": ["new", "watched-changed", "watched-not-changed", "missing-in-last-scan"],
      "localized": ["name", "description"],
      "name": [
        {
          "language_code": "en_us",
          "string": "Report on"
        },
	    {
          "language_code": "es_es",
          "string": "Informar sobre"
        }	
      ],
      "description": [
        {
          "language_code": "en_us",
          "string": "When should notification be sent out."
        },
        {
          "language_code": "es_es",
          "string": "Cuándo debe enviarse una notificación."
        }		
      ]
    }
  ],

  "database_column_definitions": 
  [          
    {
      "column": "Object_PrimaryID",
      "mapped_to_column": "MAC",         
      "css_classes": "col-sm-2",
      "show": true,
      "type": "device_name_mac",            
      "default_value":"",
      "options": [],
      "localized": ["name"],
      "name":[{
          "language_code":"en_us",
          "string" : "MAC"
          },
		  {
          "language_code":"es_es",
          "string" : "MAC"
          }]
    }, 
    {
        "column": "Object_SecondaryID",
        "mapped_to_column": "IP_v4_or_v6", 
        "css_classes": "col-sm-2",
        "show": true,
        "type": "label",            
        "default_value":"",
        "options": [],
        "localized": ["name"],
        "name":[{
            "language_code":"en_us",
            "string" : "IP"
            },
			      {
            "language_code":"es_es",
            "string" : "IP"
            }]
    },
    {
        "column": "Watched_Value1",
        "mapped_to_column": "Info", 
        "css_classes": "col-sm-2",
        "show": true,
        "type": "label",            
        "default_value":"",
        "options": [],
        "localized": ["name"],
        "name":[{
            "language_code":"en_us",
            "string" : "Info"
            },
			{
            "language_code":"es_es",
            "string" : "Info"
            }]
    } ,    
    {
        "column": "Watched_Value2",
        "mapped_to_column": "Record_Type", 
        "css_classes": "col-sm-2",
        "show": true,
        "type": "label",            
        "default_value":"",
        "options": [],
        "localized": ["name"],
        "name":[{
            "language_code":"en_us",
            "string" : "Type"
            },
	    {
            "language_code":"es_es",
            "string" : "Tipo"
            }]
    } ,
    {
        "column": "Watched_Value3",
        "mapped_to_column": "Value", 
        "css_classes": "col-sm-2",
        "show": true,
        "type": "label",            
        "default_value":"",
        "options": [],
        "localized": ["name"],
        "name":[{
            "language_code":"en_us",
            "string" : "Info"
            },
			      {
            "language_code":"es_es",
            "string" : "Info"
            }]
    },
    {
      "column": "DateTimeCreated",
      "mapped_to_column": "Time", 
      "css_classes": "col-sm-2",
      "show": true,
      "type": "label",            
      "default_value":"",
      "options": [],
      "localized": ["name"],
      "name":[{
          "language_code":"en_us",
          "string" : "Created"
          },
		  {
          "language_code":"es_es",
          "string" : "Creado"
          }]
    },   
    {
        "column": "DateTimeChanged",        
        "css_classes": "col-sm-2",
        "show": true,
        "type": "label",            
        "default_value":"",
        "options": [],
        "localized": ["name"],
        "name":[
          {
            "language_code":"en_us",
            "string" : "Changed"
          },
          {
            "language_code":"es_es",
            "string" : "Cambiado"
          }
        ]
    },        
    {
        "column": "Status",
        "css_classes": "col-sm-1",
        "show": true,
        "type": "replace",            
        "default_value":"",
        "options": [
            {
                "equals": "watched-not-changed",
                "replacement": "<div style='text-align:center'><i class='fa-solid fa-square-check'></i><div></div>"
            },
            {
                "equals": "watched-changed",
                "replacement": "<div style='text-align:center'><i class='fa-solid fa-triangle-exclamation'></i></div>"
            },
            {
                "equals": "new",
                "replacement": "<div style='text-align:center'><i class='fa-solid fa-circle-plus'></i></div>"
            },
            {
                "equals": "missing-in-last-scan",
                "replacement": "<div style='text-align:center'><i class='fa-solid fa-question'></i></div>"
            }
        ],
        "localized": ["name"],
        "name":[{
            "language_code":"en_us",
            "string" : "Status"
            },
            {
            "language_code":"es_es",
            "string" : "Estado"
            }]
    }           
  ]
}
