mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-19 13:29:42 +02:00
rename hostname to boxname in logs
This commit is contained in:
parent
95cc64f0be
commit
bac5c644cc
1 changed files with 15 additions and 15 deletions
|
@ -144,7 +144,7 @@ class scanThread (threading.Thread):
|
||||||
'-> '
|
'-> '
|
||||||
f'{status} ({(file_scan_end_time - file_scan_start_time):.1f}s)')
|
f'{status} ({(file_scan_end_time - file_scan_start_time):.1f}s)')
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'file="{file_name}", '
|
f'file="{file_name}", '
|
||||||
f'size="{file_size}", '
|
f'size="{file_size}", '
|
||||||
f'status="{status}"", '
|
f'status="{status}"", '
|
||||||
|
@ -174,7 +174,7 @@ class scanThread (threading.Thread):
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log(f"Unexpected error: {str(ex)}", flush=True)
|
log(f"Unexpected error: {str(ex)}", flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'error="{str(ex)}"', exc_info=True)
|
f'error="{str(ex)}"', exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ def print_screen():
|
||||||
update_bar(0, flush=True)
|
update_bar(0, flush=True)
|
||||||
log('Ready.', flush=True)
|
log('Ready.', flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
"pandora-box-start")
|
"pandora-box-start")
|
||||||
|
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ def umount_device():
|
||||||
def log_device_info(dev):
|
def log_device_info(dev):
|
||||||
"""Log device information"""
|
"""Log device information"""
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'device_name="{dev.get("DEVNAME")}, '
|
f'device_name="{dev.get("DEVNAME")}, '
|
||||||
f'path_id="{dev.get("ID_PATH")}", '
|
f'path_id="{dev.get("ID_PATH")}", '
|
||||||
f'bus system="{dev.get("ID_BUS")}", '
|
f'bus system="{dev.get("ID_BUS")}", '
|
||||||
|
@ -534,7 +534,7 @@ def scan():
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log(f"error={ex}", flush=True)
|
log(f"error={ex}", flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'error="{str(ex)}"',
|
f'error="{str(ex)}"',
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
if not has_curses:
|
if not has_curses:
|
||||||
|
@ -594,7 +594,7 @@ def scan():
|
||||||
((time.time() - scan_start_time), file_count, len(infected_files)),
|
((time.time() - scan_start_time), file_count, len(infected_files)),
|
||||||
flush=True)
|
flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'duration="{int(time.time() - scan_start_time)}", '
|
f'duration="{int(time.time() - scan_start_time)}", '
|
||||||
f'files_scanned="{file_count}", '
|
f'files_scanned="{file_count}", '
|
||||||
f'files_infected="{len(infected_files)}"')
|
f'files_infected="{len(infected_files)}"')
|
||||||
|
@ -619,7 +619,7 @@ def wait():
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log(f"Unexpected error: {str(ex)}", flush=True)
|
log(f"Unexpected error: {str(ex)}", flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'error="{str(ex)}"', exc_info=True)
|
f'error="{str(ex)}"', exc_info=True)
|
||||||
return "STOP"
|
return "STOP"
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ def device_inserted(dev):
|
||||||
global device
|
global device
|
||||||
log("Device inserted", flush=True)
|
log("Device inserted", flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
"device-inserted")
|
"device-inserted")
|
||||||
device = dev
|
device = dev
|
||||||
log_device_info(device)
|
log_device_info(device)
|
||||||
|
@ -649,7 +649,7 @@ def device_removed():
|
||||||
global device
|
global device
|
||||||
log("Device removed", flush=True)
|
log("Device removed", flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
"device-removed")
|
"device-removed")
|
||||||
device = None
|
device = None
|
||||||
if not has_curses:
|
if not has_curses:
|
||||||
|
@ -683,7 +683,7 @@ def mount():
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log(f"Unexpected error: {str(ex)}", flush=True)
|
log(f"Unexpected error: {str(ex)}", flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'error="{str(ex)}"', exc_info=True)
|
f'error="{str(ex)}"', exc_info=True)
|
||||||
if not has_curses:
|
if not has_curses:
|
||||||
display_image("WAIT")
|
display_image("WAIT")
|
||||||
|
@ -709,7 +709,7 @@ def clean():
|
||||||
# display message
|
# display message
|
||||||
log(f"{len(infected_files)} infected files detecetd:")
|
log(f"{len(infected_files)} infected files detecetd:")
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f"infeted_files={len(infected_files)}")
|
f"infeted_files={len(infected_files)}")
|
||||||
|
|
||||||
if not has_curses:
|
if not has_curses:
|
||||||
|
@ -738,13 +738,13 @@ def clean():
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
log(f"{file} removed")
|
log(f"{file} removed")
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'removed="{file}"')
|
f'removed="{file}"')
|
||||||
files_removed += 1
|
files_removed += 1
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log(f"could not remove: {str(ex)}", flush=True)
|
log(f"could not remove: {str(ex)}", flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'not_removed="{file}, '
|
f'not_removed="{file}, '
|
||||||
f'error="{str(ex)}"', exc_info=True)
|
f'error="{str(ex)}"', exc_info=True)
|
||||||
has_error = True
|
has_error = True
|
||||||
|
@ -752,7 +752,7 @@ def clean():
|
||||||
umount_device()
|
umount_device()
|
||||||
|
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'cleaned="{files_removed}/{len(infected_files)}"')
|
f'cleaned="{files_removed}/{len(infected_files)}"')
|
||||||
|
|
||||||
if not has_error:
|
if not has_error:
|
||||||
|
@ -857,7 +857,7 @@ def main(args):
|
||||||
print({str(ex)})
|
print({str(ex)})
|
||||||
log(f"Unexpected error: {str(ex)}", flush=True)
|
log(f"Unexpected error: {str(ex)}", flush=True)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'hostname="{hostname}", '
|
f'boxname="{hostname}", '
|
||||||
f'error="{str(ex)}"', exc_info=True)
|
f'error="{str(ex)}"', exc_info=True)
|
||||||
finally:
|
finally:
|
||||||
end_curses()
|
end_curses()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue