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_here
|
||||||
```
|
```
|
||||||
|
|
||||||
## Paste your `docker-compose.yml` and `.env` (remove personal info)**
|
## Paste your `docker-compose.yml` and `.env` (remove personal info)
|
||||||
|
|
||||||
`docker-compose.yml`
|
`docker-compose.yml`
|
||||||
|
|
||||||
@@ -29,8 +29,6 @@ paste_here
|
|||||||
|
|
||||||
`.env`
|
`.env`
|
||||||
|
|
||||||
<textarea rows="10" placeholder="Insert your code here"></textarea>
|
|
||||||
|
|
||||||
```
|
```
|
||||||
paste_here
|
paste_here
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import conf
|
||||||
|
|
||||||
from const import pialertPath, vendorsDB
|
from const import pialertPath, vendorsDB
|
||||||
from helper import timeNow, updateState
|
from helper import timeNow, updateState
|
||||||
@@ -22,13 +23,18 @@ def update_devices_MAC_vendors (db, pArg = ''):
|
|||||||
mylog('verbose', [' Updating vendors DB (iab & oui)'])
|
mylog('verbose', [' Updating vendors DB (iab & oui)'])
|
||||||
update_args = ['sh', pialertPath + '/update_vendors.sh', pArg]
|
update_args = ['sh', pialertPath + '/update_vendors.sh', pArg]
|
||||||
|
|
||||||
try:
|
# Execute command
|
||||||
|
if conf.LOG_LEVEL == 'debug':
|
||||||
# try runnning a subprocess
|
# try runnning a subprocess
|
||||||
update_output = subprocess.check_output (update_args)
|
update_output = subprocess.check_output (update_args)
|
||||||
except subprocess.CalledProcessError as e:
|
else:
|
||||||
# An error occured, handle it
|
try:
|
||||||
mylog('none', [' FAILED: Updating vendors DB, set LOG_LEVEL=debug for more info'])
|
# try runnning a subprocess safely
|
||||||
mylog('none', [e.output])
|
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
|
# Initialize variables
|
||||||
recordsToUpdate = []
|
recordsToUpdate = []
|
||||||
@@ -82,14 +88,19 @@ def query_MAC_vendor (pMAC):
|
|||||||
# Search vendor in HW Vendors DB
|
# Search vendor in HW Vendors DB
|
||||||
mac = mac[0:6]
|
mac = mac[0:6]
|
||||||
grep_args = ['grep', '-i', mac, vendorsDB]
|
grep_args = ['grep', '-i', mac, vendorsDB]
|
||||||
|
|
||||||
# Execute command
|
# Execute command
|
||||||
try:
|
if conf.LOG_LEVEL == 'debug':
|
||||||
# try runnning a subprocess
|
# try runnning a subprocess
|
||||||
grep_output = subprocess.check_output (grep_args)
|
grep_output = subprocess.check_output (grep_args)
|
||||||
except subprocess.CalledProcessError as e:
|
else:
|
||||||
# An error occured, handle it
|
try:
|
||||||
mylog('none', ["[Mac Vendor Check] Error: ", e.output])
|
# try runnning a subprocess
|
||||||
grep_output = " There was an error, check logs for details"
|
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
|
# Return Vendor
|
||||||
vendor = grep_output[7:]
|
vendor = grep_output[7:]
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ def execute_arpscan_on_interface (interface):
|
|||||||
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] 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}'])
|
mylog('none', [f'[ARP Scan] Error output: {e.output}'])
|
||||||
|
|
||||||
result = ""
|
result = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user