mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
arp-scan debug #261 work
This commit is contained in:
@@ -42,7 +42,7 @@ function handleVersion(){
|
||||
{
|
||||
$.get('https://api.github.com/repos/jokob-sk/Pi.Alert/releases').done(function(response) {
|
||||
// Handle successful response
|
||||
var releases = data;
|
||||
var releases = response;
|
||||
|
||||
if(releases.length > 0)
|
||||
{
|
||||
|
||||
@@ -371,9 +371,9 @@ $db->close();
|
||||
<div class="row logs-row">
|
||||
<textarea id="pialert_log" class="logs" cols="70" rows="10" wrap='off' readonly >
|
||||
<?php
|
||||
if(filesize("./log/pialert.log") > 200000)
|
||||
if(filesize("./log/pialert.log") > 2000000)
|
||||
{
|
||||
echo file_get_contents( "./log/pialert.log", false, null, -200000);
|
||||
echo file_get_contents( "./log/pialert.log", false, null, -2000000);
|
||||
}
|
||||
else{
|
||||
echo file_get_contents( "./log/pialert.log" );
|
||||
|
||||
@@ -487,7 +487,7 @@ $lang['en_us'] = array(
|
||||
'run_event_tooltip' => 'Enable the setting and save your changes at first before you run it.',
|
||||
'run_event_icon' => 'fa-play',
|
||||
'general_event_title' => 'Executing an ad-hoc event',
|
||||
'general_event_description' => 'The event you\'ve triggered might take a while until background processes finish. The execution ended once you see <code>finished</code> below. Check the <a href="/maintenance.php#tab_Logging">error log</a> if you didn\'t get the expected result. <br/> <br/> Status: ',
|
||||
'general_event_description' => ' The event you\'ve triggered might take a while until background processes finish. The execution ended once you see <code>finished</code> below. Check the <a href=\"/maintenance.php#tab_Logging\">error log</a> if you didn\'t get the expected result. <br/> <br/> Status: ',
|
||||
|
||||
|
||||
|
||||
@@ -565,7 +565,7 @@ The arp-scan time itself depends on the number of IP addresses to check so set t
|
||||
'Email_display_name' => 'Email',
|
||||
'Email_icon' => '<i class="fa fa-at"></i>',
|
||||
'REPORT_MAIL_name' => 'Enable email',
|
||||
'REPORT_MAIL_description' => 'If enabled an email is sent out with a list of changes you\'ve subscribed to. Please also fill out all remaining settings related to the SMTP setup below. If facing issues, set <code>LOG_LEVEL</code> to <code>debug</code> and check the <a href="/maintenance.php#tab_Logging">error log</a>.',
|
||||
'REPORT_MAIL_description' => 'If enabled an email is sent out with a list of changes you\'ve subscribed to. Please also fill out all remaining settings related to the SMTP setup below. If facing issues, set <code>LOG_LEVEL</code> to <code>debug</code> and check the <a href=\"/maintenance.php#tab_Logging\">error log</a>.',
|
||||
'SMTP_SERVER_name' => 'SMTP server URL',
|
||||
'SMTP_SERVER_description' => 'The SMTP server host URL. For example <code>smtp-relay.sendinblue.com</code>. To use Gmail as an SMTP server <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/SMTP_GMAIL.md">follow this guide</a>',
|
||||
'SMTP_PORT_name' => 'SMTP server PORT',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import re
|
||||
import subprocess
|
||||
import conf
|
||||
|
||||
from logger import mylog
|
||||
from helper import write_file
|
||||
@@ -16,8 +17,6 @@ def execute_arpscan (userSubnets):
|
||||
for interface in userSubnets :
|
||||
arpscan_output += execute_arpscan_on_interface (interface)
|
||||
index += 1
|
||||
write_file (logPath + '/arp_scan_output_' + str(index) + '.txt', arpscan_output)
|
||||
|
||||
|
||||
# Search IP + MAC + Vendor as regular expresion
|
||||
re_ip = r'(?P<ip>((2[0-5]|1[0-9]|[0-9])?[0-9]\.){3}((2[0-5]|1[0-9]|[0-9])?[0-9]))'
|
||||
@@ -54,17 +53,21 @@ def execute_arpscan_on_interface (interface):
|
||||
arpscan_args = ['sudo', 'arp-scan', '--ignoredups', '--retry=6'] + subnets
|
||||
|
||||
# Execute command
|
||||
try:
|
||||
if conf.LOG_LEVEL == 'debug':
|
||||
# try runnning a subprocess
|
||||
result = subprocess.check_output (arpscan_args, universal_newlines=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
# An error occured, handle it
|
||||
error_type = type(e).__name__ # Capture the error type
|
||||
else:
|
||||
try:
|
||||
# try runnning a subprocess safely
|
||||
result = subprocess.check_output (arpscan_args, universal_newlines=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
# An error occured, handle it
|
||||
error_type = type(e).__name__ # Capture the error type
|
||||
|
||||
mylog('none', [f'[ARP Scan] Error type : {error_type}'])
|
||||
mylog('none', [f'[ARP Scan] Error output: {e.output}'])
|
||||
mylog('none', [f'[ARP Scan] Error type : {error_type}'])
|
||||
mylog('none', [f'[ARP Scan] Error output: {e.output}'])
|
||||
|
||||
result = ""
|
||||
result = ""
|
||||
|
||||
mylog('debug', ['[ARP Scan] on Interface Completed with results: ', result])
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user