Feature request - configurable arp-scan args #486 🎁

This commit is contained in:
Jokob-sk
2023-10-22 09:41:38 +11:00
parent 55e398dd10
commit ae7533cec0
2 changed files with 31 additions and 2 deletions

View File

@@ -322,6 +322,28 @@
"string": "Wann Benachrichtigungen gesendet werden sollen." "string": "Wann Benachrichtigungen gesendet werden sollen."
} }
] ]
},
{
"function": "ARGS",
"type": "text",
"default_value": "sudo arp-scan --ignoredups --retry=6",
"options": [],
"localized": [
"name",
"description"
],
"name": [
{
"language_code": "en_us",
"string": "Arguments"
}
],
"description": [
{
"language_code": "en_us",
"string": "Arguments to run arps-scan with. Recommended and tested only with the setting <code>sudo arp-scan --ignoredups --retry=6</code>."
}
]
} }
], ],
"database_column_definitions": [ "database_column_definitions": [

View File

@@ -12,9 +12,11 @@ from time import strftime
sys.path.append("/home/pi/pialert/front/plugins") sys.path.append("/home/pi/pialert/front/plugins")
sys.path.append('/home/pi/pialert/pialert') sys.path.append('/home/pi/pialert/pialert')
# pialert modules
from database import DB
from plugin_helper import Plugin_Object, Plugin_Objects, handleEmpty from plugin_helper import Plugin_Object, Plugin_Objects, handleEmpty
from logger import mylog, append_line_to_file from logger import mylog, append_line_to_file
from helper import timeNowTZ from helper import timeNowTZ, get_setting_value
from const import logPath, pialertPath from const import logPath, pialertPath
CUR_PATH = str(pathlib.Path(__file__).parent.resolve()) CUR_PATH = str(pathlib.Path(__file__).parent.resolve())
@@ -62,6 +64,11 @@ def main():
subnets_list = userSubnetsParam.split(',') subnets_list = userSubnetsParam.split(',')
else: else:
subnets_list = [userSubnetsParam] subnets_list = [userSubnetsParam]
# Create a database connection
db = DB() # instance of class DB
db.open()
# Execute the ARP scanning process on the list of subnets (whether it's one or multiple subnets). # Execute the ARP scanning process on the list of subnets (whether it's one or multiple subnets).
# The function 'execute_arpscan' is assumed to be defined elsewhere in the code. # The function 'execute_arpscan' is assumed to be defined elsewhere in the code.
@@ -132,7 +139,7 @@ def execute_arpscan(userSubnets):
def execute_arpscan_on_interface(interface): def execute_arpscan_on_interface(interface):
# Prepare command arguments # Prepare command arguments
arpscan_args = ['sudo', 'arp-scan', '--ignoredups', '--retry=6'] + interface.split() arpscan_args = get_setting_value('ARPSCAN_ARGS').split() + interface.split()
# Execute command # Execute command
try: try: