mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-23 15:29:43 +02:00
fix read config file
This commit is contained in:
parent
6633243745
commit
816179cfa4
1 changed files with 18 additions and 14 deletions
|
@ -45,18 +45,22 @@ def config():
|
||||||
global FAKE_SCAN, QUARANTINE, QUARANTINE_FOLDER
|
global FAKE_SCAN, QUARANTINE, QUARANTINE_FOLDER
|
||||||
global CURSES
|
global CURSES
|
||||||
# intantiate a ConfirParser
|
# intantiate a ConfirParser
|
||||||
|
try :
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
# read the config file
|
# read the config file
|
||||||
config.read('pandora-box.ini')
|
config.read('pandora-box.ini')
|
||||||
# set values
|
# set values
|
||||||
FAKE_SCAN=config['DEFAULT']['FAKE_SCAN'].lower()=="true"
|
FAKE_SCAN = config['DEFAULT']['FAKE_SCAN'].lower()=="true"
|
||||||
USB_AUTO_MOUNT=config['DEFAULT']['USB_AUTO_MOUNT'].lower()=="true"
|
USB_AUTO_MOUNT = config['DEFAULT']['USB_AUTO_MOUNT'].lower()=="true"
|
||||||
PANDORA_ROOT_URL=config['DEFAULT']['PANDORA_ROOT_URL']
|
PANDORA_ROOT_URL = config['DEFAULT']['PANDORA_ROOT_URL']
|
||||||
# Quarantine
|
# Quarantine
|
||||||
QUARANTINE = config['DEFAULT']['QUARANTINE'].lower()=="true"
|
QUARANTINE = config['DEFAULT']['QUARANTINE'].lower()=="true"
|
||||||
QUARANTINE_FOLDER = config['DEFAULT']['QUARANTINE_FOLDER']
|
QUARANTINE_FOLDER = config['DEFAULT']['QUARANTINE_FOLDER']
|
||||||
# Curses
|
# Curses
|
||||||
CURSES = config['DEFAULT']['CURSES'].lower()=="true"
|
CURSES = config['DEFAULT']['CURSES'].lower()=="true"
|
||||||
|
except Exception as e :
|
||||||
|
log("Could not read config file: %s" % e)
|
||||||
|
raise e
|
||||||
|
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
|
|
||||||
|
@ -445,7 +449,7 @@ 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, FAKE_SCAN
|
||||||
infected_files = []
|
infected_files = []
|
||||||
scanned = 0
|
scanned = 0
|
||||||
file_count = 0
|
file_count = 0
|
||||||
|
@ -462,7 +466,7 @@ def scan(mount_point, used):
|
||||||
file_size = os.path.getsize(full_path)
|
file_size = os.path.getsize(full_path)
|
||||||
# log("Check %s [%s]" % (file, human_readable_size(file_size)))
|
# log("Check %s [%s]" % (file, human_readable_size(file_size)))
|
||||||
file_scan_start_time = time.time()
|
file_scan_start_time = time.time()
|
||||||
if FAKE_SCAN :
|
if FAKE_SCAN:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
status = "SKIPPED"
|
status = "SKIPPED"
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue