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) {
|
$.get('https://api.github.com/repos/jokob-sk/Pi.Alert/releases').done(function(response) {
|
||||||
// Handle successful response
|
// Handle successful response
|
||||||
var releases = data;
|
var releases = response;
|
||||||
|
|
||||||
if(releases.length > 0)
|
if(releases.length > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -371,9 +371,9 @@ $db->close();
|
|||||||
<div class="row logs-row">
|
<div class="row logs-row">
|
||||||
<textarea id="pialert_log" class="logs" cols="70" rows="10" wrap='off' readonly >
|
<textarea id="pialert_log" class="logs" cols="70" rows="10" wrap='off' readonly >
|
||||||
<?php
|
<?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{
|
else{
|
||||||
echo file_get_contents( "./log/pialert.log" );
|
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_tooltip' => 'Enable the setting and save your changes at first before you run it.',
|
||||||
'run_event_icon' => 'fa-play',
|
'run_event_icon' => 'fa-play',
|
||||||
'general_event_title' => 'Executing an ad-hoc event',
|
'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_display_name' => 'Email',
|
||||||
'Email_icon' => '<i class="fa fa-at"></i>',
|
'Email_icon' => '<i class="fa fa-at"></i>',
|
||||||
'REPORT_MAIL_name' => 'Enable email',
|
'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_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_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',
|
'SMTP_PORT_name' => 'SMTP server PORT',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import conf
|
||||||
|
|
||||||
from logger import mylog
|
from logger import mylog
|
||||||
from helper import write_file
|
from helper import write_file
|
||||||
@@ -16,8 +17,6 @@ def execute_arpscan (userSubnets):
|
|||||||
for interface in userSubnets :
|
for interface in userSubnets :
|
||||||
arpscan_output += execute_arpscan_on_interface (interface)
|
arpscan_output += execute_arpscan_on_interface (interface)
|
||||||
index += 1
|
index += 1
|
||||||
write_file (logPath + '/arp_scan_output_' + str(index) + '.txt', arpscan_output)
|
|
||||||
|
|
||||||
|
|
||||||
# Search IP + MAC + Vendor as regular expresion
|
# 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]))'
|
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,9 +53,13 @@ def execute_arpscan_on_interface (interface):
|
|||||||
arpscan_args = ['sudo', 'arp-scan', '--ignoredups', '--retry=6'] + subnets
|
arpscan_args = ['sudo', 'arp-scan', '--ignoredups', '--retry=6'] + subnets
|
||||||
|
|
||||||
# Execute command
|
# Execute command
|
||||||
try:
|
if conf.LOG_LEVEL == 'debug':
|
||||||
# try runnning a subprocess
|
# try runnning a subprocess
|
||||||
result = subprocess.check_output (arpscan_args, universal_newlines=True)
|
result = subprocess.check_output (arpscan_args, universal_newlines=True)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
# try runnning a subprocess safely
|
||||||
|
result = subprocess.check_output (arpscan_args, universal_newlines=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
# An error occured, handle it
|
# An error occured, handle it
|
||||||
error_type = type(e).__name__ # Capture the error type
|
error_type = type(e).__name__ # Capture the error type
|
||||||
|
|||||||
Reference in New Issue
Block a user