1
0
Fork 0
mirror of https://github.com/dbarzin/pandora-box.git synced 2025-07-19 13:29:42 +02:00

documentation

This commit is contained in:
dbarzin 2023-03-08 08:26:25 +01:00
parent bac5c644cc
commit bd7e869a43
3 changed files with 29 additions and 17 deletions

View file

@ -24,6 +24,18 @@ After reboot, login with the user created during the install and type :
cd pandora-box cd pandora-box
sudo ./install.sh sudo ./install.sh
## Firewall
Pandorabox needs web access to these websites :
- Ubuntu repositories
- GitHub.com
- Pypi.org
- clamav.net
- antivirus.comodo.com
- hashlookup.circl.lu
## Configuration ## Configuration
Copy the sample configuration file to _pandora-box.ini_ Copy the sample configuration file to _pandora-box.ini_

View file

@ -141,7 +141,7 @@ su - $SUDO_USER -c "rm ~/pandora/pandora/workers/ole.*"
su - $SUDO_USER -c "rm ~/pandora/pandora/workers/preview.*" su - $SUDO_USER -c "rm ~/pandora/pandora/workers/preview.*"
su - $SUDO_USER -c "rm ~/pandora/pandora/workers/virustotal.*" su - $SUDO_USER -c "rm ~/pandora/pandora/workers/virustotal.*"
su - $SUDO_USER -c "rm ~/pandora/pandora/workers/xml*" su - $SUDO_USER -c "rm ~/pandora/pandora/workers/xml*"
su - $SUDO_USER -c "rm ~/pandora/pandora/workers/hashlookup*" # su - $SUDO_USER -c "rm ~/pandora/pandora/workers/hashlookup*"
# Remove files from quarantine after 180 days # Remove files from quarantine after 180 days
{ crontab -l -u $SUDO_USER; echo '0 * * * * find /var/quarantine/* -type f -mtime +180 -delete '; } | crontab -u $SUDO_USER - { crontab -l -u $SUDO_USER; echo '0 * * * * find /var/quarantine/* -type f -mtime +180 -delete '; } | crontab -u $SUDO_USER -

View file

@ -53,7 +53,7 @@ has_quarantine = None
quarantine_folder = None quarantine_folder = None
has_curses = None has_curses = None
maxThreads = None maxThreads = None
hostname = socket.gethostname() boxname = socket.gethostname()
# ----------------------------------------------------------- # -----------------------------------------------------------
# Curses # Curses
@ -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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
"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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
"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'boxname="{hostname}", ' f'boxname="{boxname}", '
"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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
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'boxname="{hostname}", ' f'boxname="{boxname}", '
f'error="{str(ex)}"', exc_info=True) f'error="{str(ex)}"', exc_info=True)
finally: finally:
end_curses() end_curses()