mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
docs/debug
This commit is contained in:
4
.github/ISSUE_TEMPLATE/i-have-an-issue.md
vendored
4
.github/ISSUE_TEMPLATE/i-have-an-issue.md
vendored
@@ -19,7 +19,7 @@ assignees: ''
|
||||
paste_here
|
||||
```
|
||||
|
||||
## Paste your `docker-compose.yml` and `.env` (remove personal info)**
|
||||
## Paste your `docker-compose.yml` and `.env` (remove personal info)
|
||||
|
||||
`docker-compose.yml`
|
||||
|
||||
@@ -29,8 +29,6 @@ paste_here
|
||||
|
||||
`.env`
|
||||
|
||||
<textarea rows="10" placeholder="Insert your code here"></textarea>
|
||||
|
||||
```
|
||||
paste_here
|
||||
```
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
import subprocess
|
||||
import conf
|
||||
|
||||
from const import pialertPath, vendorsDB
|
||||
from helper import timeNow, updateState
|
||||
@@ -22,13 +23,18 @@ def update_devices_MAC_vendors (db, pArg = ''):
|
||||
mylog('verbose', [' Updating vendors DB (iab & oui)'])
|
||||
update_args = ['sh', pialertPath + '/update_vendors.sh', pArg]
|
||||
|
||||
try:
|
||||
# Execute command
|
||||
if conf.LOG_LEVEL == 'debug':
|
||||
# try runnning a subprocess
|
||||
update_output = subprocess.check_output (update_args)
|
||||
except subprocess.CalledProcessError as e:
|
||||
# An error occured, handle it
|
||||
mylog('none', [' FAILED: Updating vendors DB, set LOG_LEVEL=debug for more info'])
|
||||
mylog('none', [e.output])
|
||||
else:
|
||||
try:
|
||||
# try runnning a subprocess safely
|
||||
update_output = subprocess.check_output (update_args)
|
||||
except subprocess.CalledProcessError as e:
|
||||
# An error occured, handle it
|
||||
mylog('none', [' FAILED: Updating vendors DB, set LOG_LEVEL=debug for more info'])
|
||||
mylog('none', [e.output])
|
||||
|
||||
# Initialize variables
|
||||
recordsToUpdate = []
|
||||
@@ -82,14 +88,19 @@ def query_MAC_vendor (pMAC):
|
||||
# Search vendor in HW Vendors DB
|
||||
mac = mac[0:6]
|
||||
grep_args = ['grep', '-i', mac, vendorsDB]
|
||||
|
||||
# Execute command
|
||||
try:
|
||||
if conf.LOG_LEVEL == 'debug':
|
||||
# try runnning a subprocess
|
||||
grep_output = subprocess.check_output (grep_args)
|
||||
except subprocess.CalledProcessError as e:
|
||||
# An error occured, handle it
|
||||
mylog('none', ["[Mac Vendor Check] Error: ", e.output])
|
||||
grep_output = " There was an error, check logs for details"
|
||||
else:
|
||||
try:
|
||||
# try runnning a subprocess
|
||||
grep_output = subprocess.check_output (grep_args)
|
||||
except subprocess.CalledProcessError as e:
|
||||
# An error occured, handle it
|
||||
mylog('none', ["[Mac Vendor Check] Error: ", e.output])
|
||||
grep_output = " There was an error, check logs for details"
|
||||
|
||||
# Return Vendor
|
||||
vendor = grep_output[7:]
|
||||
|
||||
@@ -62,9 +62,10 @@ def execute_arpscan_on_interface (interface):
|
||||
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
|
||||
|
||||
error_type = type(e).__name__ # Capture the error type
|
||||
|
||||
mylog('none', [f'[ARP Scan] Error type : {error_type}'])
|
||||
mylog('none', [f'[ARP Scan] Set LOG_LEVEL=debug for more details'])
|
||||
mylog('none', [f'[ARP Scan] Error output: {e.output}'])
|
||||
|
||||
result = ""
|
||||
|
||||
Reference in New Issue
Block a user