animations and fix some bugs
BIN
images/CHEM_OK.png
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
images/bad.png
Normal file
After Width: | Height: | Size: 154 KiB |
BIN
images/computer_OK.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
images/computer_nok.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
# display all images and reset
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
size = "1024x600"
|
||||
#size = "1920x1080"
|
||||
|
||||
images = ["pandora-box1.png", "pandora-box2.png", "pandora-box3.png", "pandora-box4.png", "pandora-box5.png"]
|
||||
|
||||
for image in images :
|
||||
os.system("convert -resize %s -background black -gravity center -extent %s %s bgra:/dev/fb0" % (size, size, image))
|
||||
time.sleep(1)
|
||||
|
||||
os.system("reset")
|
||||
|
||||
|
BIN
images/key1.png
Normal file
After Width: | Height: | Size: 527 KiB |
BIN
images/key2.png
Normal file
After Width: | Height: | Size: 539 KiB |
BIN
images/key3.png
Normal file
After Width: | Height: | Size: 539 KiB |
BIN
images/key4.png
Normal file
After Width: | Height: | Size: 545 KiB |
BIN
images/key5.png
Normal file
After Width: | Height: | Size: 528 KiB |
BIN
images/ok.png
Normal file
After Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 526 KiB |
Before Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 155 KiB |
Before Width: | Height: | Size: 154 KiB |
Before Width: | Height: | Size: 102 KiB |
BIN
images/wait1.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
images/wait2.png
Normal file
After Width: | Height: | Size: 68 KiB |
BIN
images/wait3.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
images/wait4.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
images/wait5.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
images/wait6.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
images/wait7.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
images/wait8.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
images/wait9.png
Normal file
After Width: | Height: | Size: 69 KiB |
|
@ -10,7 +10,7 @@ USB_AUTO_MOUNT = False
|
|||
PANDORA_ROOT_URL = http://127.0.0.1:6100
|
||||
|
||||
; Set FAKE_SCAN to true to fake the scan process (used during developement only)
|
||||
FAKE_SCAN = False
|
||||
FAKE_SCAN = True
|
||||
|
||||
; Set to true to copy infected files to the quarantine folder
|
||||
; in the USB scanning station
|
||||
|
|
|
@ -75,27 +75,37 @@ def human_readable_size(size, decimal_places=1):
|
|||
|
||||
def display_image(status):
|
||||
if status=="WAIT":
|
||||
image = "images/pandora-box1.png"
|
||||
image = "images/key*.png"
|
||||
elif status=="WORK":
|
||||
image = "images/pandora-box2.png"
|
||||
image = "images/wait*.png"
|
||||
elif status=="OK":
|
||||
image = "images/pandora-box3.png"
|
||||
image = "images/ok.png"
|
||||
elif status=="BAD":
|
||||
image = "images/pandora-box4.png"
|
||||
image = "images/bad.png"
|
||||
elif status=="ERROR":
|
||||
image = "images/pandora-box5.png"
|
||||
image = "images/error.png"
|
||||
else:
|
||||
return
|
||||
os.system("killall fim 2>/dev/null")
|
||||
# hide old image
|
||||
os.system("killall -s 9 fim 2>/dev/null")
|
||||
# display image
|
||||
if "*" in image:
|
||||
# slide show
|
||||
os.system("fim -qa -c 'while(1){display;sleep 1;next;}' %s </dev/null 2>/dev/null &" % image)
|
||||
else :
|
||||
# only one image
|
||||
os.system("fim -qa %s </dev/null 2>/dev/null &" % image)
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
||||
def waitMouseClick():
|
||||
mouse = open( "/dev/input/mice", "rb" )
|
||||
down = False;
|
||||
while True:
|
||||
buf = mouse.read(3)
|
||||
if ((buf[0] & 0x1)==1):
|
||||
down = True
|
||||
if (((buf[0] & 0x1)==0) and down):
|
||||
break;
|
||||
mouse.close()
|
||||
|
||||
|
@ -277,22 +287,27 @@ def log(str):
|
|||
|
||||
"""Mount USB device"""
|
||||
def mount_device(device):
|
||||
log('Try to mount partition')
|
||||
if USB_AUTO_MOUNT:
|
||||
found = False
|
||||
loop = 0
|
||||
while (not found) and (loop < 10):
|
||||
while (not found) and (loop < 15):
|
||||
# need to sleep before devide is mounted
|
||||
time.sleep(1)
|
||||
for partition in psutil.disk_partitions():
|
||||
if partition.device == device.device_node:
|
||||
log("Device mounted at {}".format(partition.mountpoint))
|
||||
log("Partition mounted at {}".format(partition.mountpoint))
|
||||
found = True
|
||||
loop += 1
|
||||
if loop < 10:
|
||||
return partition.mountpoint
|
||||
else:
|
||||
log('No partition mounted')
|
||||
return None
|
||||
else:
|
||||
if not os.path.exists("/media/box"):
|
||||
log("folder /media/box does not exists")
|
||||
return None
|
||||
res = os.system("pmount " + device.device_node + " /media/box")
|
||||
found = False
|
||||
loop = 0
|
||||
|
@ -304,15 +319,13 @@ def mount_device(device):
|
|||
loop +=1
|
||||
continue
|
||||
break;
|
||||
log("Device mounted at /media/box")
|
||||
log("Partition mounted at /media/box")
|
||||
return "/media/box"
|
||||
|
||||
"""Unmount USB device"""
|
||||
def umount_device():
|
||||
if not USB_AUTO_MOUNT:
|
||||
if os.path.exists("/media/box"):
|
||||
log("Unmounting device /media/box")
|
||||
res = os.system("pumount /media/box")
|
||||
log("Sync partitions")
|
||||
res = os.system("sync")
|
||||
|
||||
"""Main device loop"""
|
||||
def device_loop():
|
||||
|
@ -322,7 +335,7 @@ def device_loop():
|
|||
context = pyudev.Context()
|
||||
monitor = pyudev.Monitor.from_netlink(context)
|
||||
monitor.filter_by("block")
|
||||
try:
|
||||
#try:
|
||||
for device in iter(monitor.poll, None):
|
||||
if device.get("ID_FS_USAGE") == "filesystem" and device.device_node[5:7] == "sd":
|
||||
if device.action == "add":
|
||||
|
@ -338,6 +351,7 @@ def device_loop():
|
|||
print_serial(device.get("ID_SERIAL_SHORT"))
|
||||
# Mount device
|
||||
mount_point = mount_device(device)
|
||||
log('Partition mounted at %s' % mount_point)
|
||||
if mount_point == None:
|
||||
# no partition
|
||||
continue
|
||||
|
@ -390,10 +404,10 @@ def device_loop():
|
|||
print_model("")
|
||||
print_serial("")
|
||||
update_bar(0)
|
||||
except Exception as e:
|
||||
log("Unexpected error: %s" % str(e) )
|
||||
finally:
|
||||
log("Done.")
|
||||
# except Exception as e:
|
||||
# log("Unexpected error: %s" % str(e) )
|
||||
# finally:
|
||||
# log("Done.")
|
||||
|
||||
|
||||
def log_device_info(dev):
|
||||
|
@ -406,13 +420,10 @@ def log_device_info(dev):
|
|||
logging.info("Partition type: %s" % dev.get("ID_PART_TABLE_TYPE"))
|
||||
logging.info("FS type: %s" % dev.get("ID_FS_TYPE"))
|
||||
logging.info("Partition label: %s" % dev.get("ID_FS_LABEL"))
|
||||
# logging.info("FS: %s" % dev.get("ID_FS_SYSTEM_ID"))
|
||||
logging.info("Device model: %s" % dev.get("ID_MODEL"))
|
||||
# logging.info('Usage: %s' % dev.get("ID_FS_USAGE"))
|
||||
logging.info('Model: %s' % dev.get("ID_MODEL_ID"))
|
||||
logging.info('Serial short: %s' % dev.get("ID_SERIAL_SHORT"))
|
||||
logging.info('Serial: %s' % dev.get("ID_SERIAL"))
|
||||
# logging.info(os.stat(dev.get("DEVNAME")))
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# pandora
|
||||
|
|
|
@ -3,9 +3,12 @@ import os;
|
|||
|
||||
def waitMouseClick():
|
||||
mouse = open( "/dev/input/mice", "rb" )
|
||||
down = False;
|
||||
while True:
|
||||
buf = mouse.read(3)
|
||||
if ((buf[0] & 0x1)==1):
|
||||
down = True
|
||||
if (((buf[0] & 0x1)==0) and down):
|
||||
break;
|
||||
mouse.close()
|
||||
|
||||
|
|
|
@ -3,9 +3,12 @@ import os;
|
|||
|
||||
def waitMouseClick():
|
||||
mouse = open( "/dev/input/mice", "rb" )
|
||||
down = False;
|
||||
while True:
|
||||
buf = mouse.read(3)
|
||||
if ((buf[0] & 0x1)==1):
|
||||
down = True
|
||||
if (((buf[0] & 0x1)==0) and down):
|
||||
break;
|
||||
mouse.close()
|
||||
|
||||
|
|