mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-29 18:29:45 +02:00
Merge branch 'main' of https://github.com/dbarzin/pandora-box
This commit is contained in:
commit
fed69e2839
2 changed files with 95 additions and 50 deletions
44
INSTALL.md
44
INSTALL.md
|
@ -36,10 +36,7 @@ tqdm
|
||||||
|
|
||||||
Asii Art
|
Asii Art
|
||||||
--------
|
--------
|
||||||
|
_Bloody Style_
|
||||||
https://patorjk.com/software/taag/#p=display&f=Bloody&t=Pandora-Box
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
██▓███ ▄▄▄ ███▄ █ ▓█████▄ ▒█████ ██▀███ ▄▄▄ ▄▄▄▄ ▒█████ ▒██ ██▒
|
██▓███ ▄▄▄ ███▄ █ ▓█████▄ ▒█████ ██▀███ ▄▄▄ ▄▄▄▄ ▒█████ ▒██ ██▒
|
||||||
▓██░ ██▒▒████▄ ██ ▀█ █ ▒██▀ ██▌▒██▒ ██▒▓██ ▒ ██▒▒████▄ ▓█████▄ ▒██▒ ██▒▒▒ █ █ ▒░
|
▓██░ ██▒▒████▄ ██ ▀█ █ ▒██▀ ██▌▒██▒ ██▒▓██ ▒ ██▒▒████▄ ▓█████▄ ▒██▒ ██▒▒▒ █ █ ▒░
|
||||||
|
@ -51,17 +48,54 @@ https://patorjk.com/software/taag/#p=display&f=Bloody&t=Pandora-Box
|
||||||
░░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ▒ ░ ░ ░ ░ ░ ▒ ░ ░
|
░░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ▒ ░ ░ ░ ░ ░ ▒ ░ ░
|
||||||
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
|
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
|
||||||
░ ░
|
░ ░
|
||||||
|
https://patorjk.com/software/taag/#p=display&f=Bloody&t=Pandora-Box
|
||||||
|
|
||||||
|
_Flower Power_
|
||||||
|
.-------. ____ ,---. .--. ______ ,-----. .-------. ____ _______ ,-----. _____ __
|
||||||
|
\ _(`)_ \ .' __ `. | \ | || _ `''. .' .-, '. | _ _ \ .' __ `. \ ____ \ .' .-, '. \ _\ / /
|
||||||
|
| (_ o._)|/ ' \ \| , \ | || _ | ) _ \ / ,-.| \ _ \ | ( ' ) | / ' \ \| | \ | / ,-.| \ _ \ .-./ ). / '
|
||||||
|
| (_,_) /|___| / || |\_ \| ||( ''_' ) |; \ '_ / | :|(_ o _) / |___| / || |____/ / ; \ '_ / | : \ '_ .') .'
|
||||||
|
| '-.-' _.-` || _( )_\ || . (_) `. || _`,/ \ _/ || (_,_).' __ _.-` || _ _ '. | _`,/ \ _/ |(_ (_) _) '
|
||||||
|
| | .' _ || (_ o _) ||(_ ._) ': ( '\_/ \ ;| |\ \ | |.' _ || ( ' ) \: ( '\_/ \ ; / \ \
|
||||||
|
| | | _( )_ || (_,_)\ || (_.\.' / \ `"/ \ ) / | | \ `' /| _( )_ || (_{;}_) | \ `"/ \ ) / `-'`-' \
|
||||||
|
/ ) \ (_ o _) /| | | || .' '. \_/``".' | | \ / \ (_ o _) /| (_,_) / '. \_/``".' / / \ \
|
||||||
|
`---' '.(_,_).' '--' '--''-----'` '-----' ''-' `'-' '.(_,_).' /_______.' '-----' '--' '----'
|
||||||
|
|
||||||
|
https://patorjk.com/software/taag/#p=display&f=Flower%20Power&t=PandoraBox
|
||||||
|
|
||||||
|
Little Devils
|
||||||
|
|
||||||
|
_ (`-') (`-') _ <-. (`-')_ _(`-') (`-') (`-') _ <-.(`-') (`-')
|
||||||
|
\-.(OO ) (OO ).-/ \( OO) )( (OO ).-> .-> <-.(OO ) (OO ).-/ __( OO) .-> (OO )_.->
|
||||||
|
_.' \ / ,---. ,--./ ,--/ \ .'_ (`-')----. ,------,) / ,---. '-'---.\ (`-')----. (_| \_)--.
|
||||||
|
(_...--'' | \ /`.\ | \ | | '`'-..__)( OO).-. '| /`. ' | \ /`.\ | .-. (/ ( OO).-. '\ `.' /
|
||||||
|
| |_.' | '-'|_.' || . '| |) | | ' |( _) | | || |_.' | '-'|_.' | | '-' `.)( _) | | | \ .')
|
||||||
|
| .___.'(| .-. || |\ | | | / : \| |)| || . .'(| .-. | | /`'. | \| |)| | .' \
|
||||||
|
| | | | | || | \ | | '-' / ' '-' '| |\ \ | | | | | '--' / ' '-' '/ .'. \
|
||||||
|
`--' `--' `--'`--' `--' `------' `-----' `--' '--' `--' `--' `------' `-----'`--' '--'
|
||||||
|
|
||||||
|
https://patorjk.com/software/taag/#p=display&f=Lil%20Devil&t=Pandora%20Box
|
||||||
|
|
||||||
Screensaver
|
Screensaver
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
tty-clock -srt
|
tty-clock -srt
|
||||||
|
|
||||||
|
Start
|
||||||
|
-----
|
||||||
|
Start ClamAV
|
||||||
|
|
||||||
|
sudo service clamav-daemon start
|
||||||
|
|
||||||
|
Start Pandora
|
||||||
|
|
||||||
|
cd pandora
|
||||||
|
poetry run start
|
||||||
|
|
||||||
|
|
||||||
|
Homepage
|
||||||
|
--------
|
||||||
|
|
||||||
|
sudo fbi -T 2 -d /dev/fb1 -noverbose -a demo.png
|
||||||
|
|
||||||
|
|
||||||
|
|
101
pandorabox.py
101
pandorabox.py
|
@ -248,12 +248,19 @@ def mount_device(device):
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
else:
|
else:
|
||||||
res = os.system("pmount " + device.device_node + " box")
|
res = os.system("pmount " + device.device_node + " /media/box")
|
||||||
if res == 1:
|
found = False
|
||||||
return "/media/box"
|
loop = 0
|
||||||
else:
|
while (not found) and (loop < 10):
|
||||||
return ""
|
time.sleep(1)
|
||||||
|
try:
|
||||||
|
statvfs=os.statvfs(mount_point)
|
||||||
|
except Exception as e :
|
||||||
|
loop +=1
|
||||||
|
continue
|
||||||
|
break;
|
||||||
log("Device mounted at /media/box")
|
log("Device mounted at /media/box")
|
||||||
|
return "/media/box"
|
||||||
|
|
||||||
|
|
||||||
"""Unmount USB device"""
|
"""Unmount USB device"""
|
||||||
|
@ -286,7 +293,8 @@ def device_loop():
|
||||||
try:
|
try:
|
||||||
statvfs=os.statvfs(mount_point)
|
statvfs=os.statvfs(mount_point)
|
||||||
except Exception as e :
|
except Exception as e :
|
||||||
logging.error("Unexpected error: ", e)
|
log("Unexpected error1: %s" % e)
|
||||||
|
logging.exception("An exception was thrown!")
|
||||||
continue
|
continue
|
||||||
print_size(human_readable_size(statvfs.f_frsize * statvfs.f_blocks))
|
print_size(human_readable_size(statvfs.f_frsize * statvfs.f_blocks))
|
||||||
print_used(human_readable_size(statvfs.f_frsize * (statvfs.f_blocks - statvfs.f_bfree)))
|
print_used(human_readable_size(statvfs.f_frsize * (statvfs.f_blocks - statvfs.f_bfree)))
|
||||||
|
@ -319,7 +327,8 @@ def device_loop():
|
||||||
umount_device()
|
umount_device()
|
||||||
update_bar(0)
|
update_bar(0)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log("Unexpected error: %s" % e )
|
log("Unexpected error2: %s" % e )
|
||||||
|
logging.exception("An exception was thrown!")
|
||||||
finally:
|
finally:
|
||||||
log("Done.")
|
log("Done.")
|
||||||
|
|
||||||
|
@ -350,47 +359,50 @@ def log_device_info(dev):
|
||||||
"""Scan a mount point with Pandora"""
|
"""Scan a mount point with Pandora"""
|
||||||
def scan(mount_point, used):
|
def scan(mount_point, used):
|
||||||
global infected_filed
|
global infected_filed
|
||||||
infected_files = array()
|
infected_files = []
|
||||||
scanned = 0
|
scanned = 0
|
||||||
file_count = 0
|
file_count = 0
|
||||||
scan_start_time = time.time()
|
scan_start_time = time.time()
|
||||||
if FAKE_SCAN:
|
if not FAKE_SCAN:
|
||||||
for root, dirs, files in os.walk(mount_point):
|
pandora = pypandora.PyPandora(root_url=PANDORA_ROOT_URL)
|
||||||
for file in files:
|
for root, dirs, files in os.walk(mount_point):
|
||||||
try :
|
for file in files:
|
||||||
full_path = os.path.join(root,file)
|
try :
|
||||||
file_size = os.path.getsize(full_path)
|
full_path = os.path.join(root,file)
|
||||||
log("Check %-s [%s]" % (file, human_readable_size(file_size)))
|
file_size = os.path.getsize(full_path)
|
||||||
file_scan_start_time = time.time()
|
# log("Check %s [%s]" % (file, human_readable_size(file_size)))
|
||||||
|
file_scan_start_time = time.time()
|
||||||
|
if FAKE_SCAN :
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
file_scan_end_time = time.time()
|
status = "SKIPPED"
|
||||||
log("Check %s (%ds) -> %-s" % (file,(file_scan_end_time - file_scan_start_time),"SKIPPED"))
|
else:
|
||||||
scanned += os.path.getsize(full_path)
|
if file_size > (1024*1024*1024):
|
||||||
file_count += 1
|
status = "TOO BIG"
|
||||||
update_bar(scanned * 100 // used)
|
else:
|
||||||
except Exception as e :
|
res = pandora.submit_from_disk(full_path)
|
||||||
log("Unexpected error: %s" % e)
|
time.sleep(0.1)
|
||||||
return False
|
while True:
|
||||||
update_bar(100)
|
res = pandora.task_status(res["taskId"])
|
||||||
log("Scan done in %ds" % (time.time() - scan_start_time))
|
status = res["status"]
|
||||||
log("%d files scanned" % file_count)
|
if status != "WAITING":
|
||||||
else:
|
break
|
||||||
pp = pypandora.PyPandora(root_url=PANDORA_ROOT_URL)
|
time.sleep(0.5)
|
||||||
for arg in sys.argv[1:]:
|
file_scan_end_time = time.time()
|
||||||
log("Scan %-80s" % arg)
|
log("Scan %s [%s] -> %s (%ds)" % (
|
||||||
|
file,
|
||||||
res = pp.submit_from_disk(arg)
|
human_readable_size(file_size),
|
||||||
|
status,
|
||||||
while True:
|
(file_scan_end_time - file_scan_start_time)))
|
||||||
time.sleep(1)
|
scanned += os.path.getsize(full_path)
|
||||||
|
file_count += 1
|
||||||
res = pp.task_status(res["taskId"])
|
update_bar(scanned * 100 // used)
|
||||||
|
except Exception as e :
|
||||||
if res["status"] != "WAITING":
|
log("Unexpected error3: %s" % e)
|
||||||
break
|
logging.exception("An exception was thrown!")
|
||||||
break;
|
return False
|
||||||
|
update_bar(100)
|
||||||
log("Scan %s -> %s" % (arg,res["status"]))
|
log("Scan done in %ds" % (time.time() - scan_start_time))
|
||||||
|
log("%d files scanned" % file_count)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -410,7 +422,6 @@ def main(stdscr):
|
||||||
end_curses()
|
end_curses()
|
||||||
print("Unexpected error: ", e)
|
print("Unexpected error: ", e)
|
||||||
logging.error("Unexpected error: ", e)
|
logging.error("Unexpected error: ", e)
|
||||||
# logging.error(traceback.format_exc())
|
|
||||||
finally:
|
finally:
|
||||||
end_curses()
|
end_curses()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue