docs/debug

This commit is contained in:
Jokob-sk
2023-07-08 09:56:07 +10:00
parent e3e0e62d77
commit 1a08a88b9e
3 changed files with 25 additions and 15 deletions

View File

@@ -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
```

View File

@@ -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:]

View File

@@ -65,6 +65,7 @@ def execute_arpscan_on_interface (interface):
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 = ""