mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
0
front/php/templates/language/fr_fr.json
Normal file → Executable file
0
front/php/templates/language/fr_fr.json
Normal file → Executable file
@@ -108,12 +108,12 @@ def execute_name_lookup(ip, timeout):
|
|||||||
output = ""
|
output = ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mylog('verbose', [f'[{pluginName}] DEBUG CMD :', args])
|
mylog('debug', [f'[{pluginName}] DEBUG CMD :', args])
|
||||||
|
|
||||||
# Run the subprocess with a forced timeout
|
# Run the subprocess with a forced timeout
|
||||||
output = subprocess.check_output(args, universal_newlines=True, stderr=subprocess.STDOUT, timeout=timeout)
|
output = subprocess.check_output(args, universal_newlines=True, stderr=subprocess.STDOUT, timeout=timeout)
|
||||||
|
|
||||||
mylog('verbose', [f'[{pluginName}] DEBUG OUTPUT : {output}'])
|
mylog('debug', [f'[{pluginName}] DEBUG OUTPUT : {output}'])
|
||||||
|
|
||||||
domain_name = ''
|
domain_name = ''
|
||||||
|
|
||||||
@@ -129,20 +129,20 @@ def execute_name_lookup(ip, timeout):
|
|||||||
else:
|
else:
|
||||||
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Unexpected output format: {line}'])
|
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Unexpected output format: {line}'])
|
||||||
|
|
||||||
mylog('verbose', [f'[{pluginName}] Domain Name: {domain_name}'])
|
mylog('debug', [f'[{pluginName}] Domain Name: {domain_name}'])
|
||||||
|
|
||||||
return domain_name
|
return domain_name
|
||||||
|
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - {e.output}'])
|
mylog('none', [f'[{pluginName}] ⚠ ERROR - {e.output}'])
|
||||||
|
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
mylog('verbose', [f'[{pluginName}] TIMEOUT - the process forcefully terminated as timeout reached'])
|
mylog('none', [f'[{pluginName}] TIMEOUT - the process forcefully terminated as timeout reached'])
|
||||||
|
|
||||||
if output == "":
|
if output == "":
|
||||||
mylog('verbose', [f'[{pluginName}] Scan: FAIL - check logs'])
|
mylog('none', [f'[{pluginName}] Scan: FAIL - check logs'])
|
||||||
else:
|
else:
|
||||||
mylog('verbose', [f'[{pluginName}] Scan: SUCCESS'])
|
mylog('debug', [f'[{pluginName}] Scan: SUCCESS'])
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
@@ -151,13 +151,13 @@ def ensure_avahi_running(attempt=1, max_retries=2):
|
|||||||
"""
|
"""
|
||||||
Ensure that D-Bus is running and the Avahi daemon is started, with recursive retry logic.
|
Ensure that D-Bus is running and the Avahi daemon is started, with recursive retry logic.
|
||||||
"""
|
"""
|
||||||
mylog('verbose', [f'[{pluginName}] Attempt {attempt} - Ensuring D-Bus and Avahi daemon are running...'])
|
mylog('debug', [f'[{pluginName}] Attempt {attempt} - Ensuring D-Bus and Avahi daemon are running...'])
|
||||||
|
|
||||||
# Check rc-status
|
# Check rc-status
|
||||||
try:
|
try:
|
||||||
subprocess.run(['rc-status'], check=True)
|
subprocess.run(['rc-status'], check=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Failed to check rc-status: {e.output}'])
|
mylog('none', [f'[{pluginName}] ⚠ ERROR - Failed to check rc-status: {e.output}'])
|
||||||
return
|
return
|
||||||
|
|
||||||
# Create OpenRC soft level
|
# Create OpenRC soft level
|
||||||
@@ -167,42 +167,42 @@ def ensure_avahi_running(attempt=1, max_retries=2):
|
|||||||
try:
|
try:
|
||||||
subprocess.run(['rc-update', 'add', 'avahi-daemon'], check=True)
|
subprocess.run(['rc-update', 'add', 'avahi-daemon'], check=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Failed to add Avahi to runlevel: {e.output}'])
|
mylog('none', [f'[{pluginName}] ⚠ ERROR - Failed to add Avahi to runlevel: {e.output}'])
|
||||||
return
|
return
|
||||||
|
|
||||||
# Start the D-Bus service
|
# Start the D-Bus service
|
||||||
try:
|
try:
|
||||||
subprocess.run(['rc-service', 'dbus', 'start'], check=True)
|
subprocess.run(['rc-service', 'dbus', 'start'], check=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Failed to start D-Bus: {e.output}'])
|
mylog('none', [f'[{pluginName}] ⚠ ERROR - Failed to start D-Bus: {e.output}'])
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check Avahi status
|
# Check Avahi status
|
||||||
status_output = subprocess.run(['rc-service', 'avahi-daemon', 'status'], capture_output=True, text=True)
|
status_output = subprocess.run(['rc-service', 'avahi-daemon', 'status'], capture_output=True, text=True)
|
||||||
if 'started' in status_output.stdout:
|
if 'started' in status_output.stdout:
|
||||||
mylog('verbose', [f'[{pluginName}] Avahi Daemon is already running.'])
|
mylog('debug', [f'[{pluginName}] Avahi Daemon is already running.'])
|
||||||
return
|
return
|
||||||
|
|
||||||
mylog('verbose', [f'[{pluginName}] Avahi Daemon is not running, attempting to start... (Attempt {attempt})'])
|
mylog('none', [f'[{pluginName}] Avahi Daemon is not running, attempting to start... (Attempt {attempt})'])
|
||||||
|
|
||||||
# Start the Avahi daemon
|
# Start the Avahi daemon
|
||||||
try:
|
try:
|
||||||
subprocess.run(['rc-service', 'avahi-daemon', 'start'], check=True)
|
subprocess.run(['rc-service', 'avahi-daemon', 'start'], check=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Failed to start Avahi daemon: {e.output}'])
|
mylog('none', [f'[{pluginName}] ⚠ ERROR - Failed to start Avahi daemon: {e.output}'])
|
||||||
|
|
||||||
# Check status after starting
|
# Check status after starting
|
||||||
status_output = subprocess.run(['rc-service', 'avahi-daemon', 'status'], capture_output=True, text=True)
|
status_output = subprocess.run(['rc-service', 'avahi-daemon', 'status'], capture_output=True, text=True)
|
||||||
if 'started' in status_output.stdout:
|
if 'started' in status_output.stdout:
|
||||||
mylog('verbose', [f'[{pluginName}] Avahi Daemon successfully started.'])
|
mylog('debug', [f'[{pluginName}] Avahi Daemon successfully started.'])
|
||||||
return
|
return
|
||||||
|
|
||||||
# Retry if not started and attempts are left
|
# Retry if not started and attempts are left
|
||||||
if attempt < max_retries:
|
if attempt < max_retries:
|
||||||
mylog('verbose', [f'[{pluginName}] Retrying... ({attempt + 1}/{max_retries})'])
|
mylog('debug', [f'[{pluginName}] Retrying... ({attempt + 1}/{max_retries})'])
|
||||||
ensure_avahi_running(attempt + 1, max_retries)
|
ensure_avahi_running(attempt + 1, max_retries)
|
||||||
else:
|
else:
|
||||||
mylog('verbose', [f'[{pluginName}] ⚠ ERROR - Avahi Daemon failed to start after {max_retries} attempts.'])
|
mylog('none', [f'[{pluginName}] ⚠ ERROR - Avahi Daemon failed to start after {max_retries} attempts.'])
|
||||||
|
|
||||||
# rc-update add avahi-daemon
|
# rc-update add avahi-daemon
|
||||||
# rc-service avahi-daemon status
|
# rc-service avahi-daemon status
|
||||||
|
|||||||
Reference in New Issue
Block a user