# Path: multiscanner/config.py
# CONFIG = determine_configuration_path(None)
# 
# Path: multiscanner/common/utils.py
# def list2cmdline(list):
#     """
#     This is used to overwrite the default subprocess list2cmdline function.
# 
#     The default subprocess list2cmdline function on windows messes with quotes arguments. This will not
#     """
#     return ' '.join(list)
# 
# def sshexec(hostname, cmd, port=22, username=None, password=None,
#             key_filename=None):
#     """Connects and runs a command. Returns the contents of stdin."""
#     client = sshconnect(hostname, port=port, username=username,
#                         password=password, key_filename=key_filename)
#     stdin, stdout, stderr = client.exec_command(cmd)
#     return stdout.read()
# 
# SSH = True


import os
import subprocess
import re
from multiscanner.config import CONFIG
from multiscanner.common.utils import list2cmdline, sshexec, SSH
HOST = ("MultiScanner", 22, "User")
# SSH Key
KEY = os.path.join(os.path.split(CONFIG)[0], 'etc', 'id_rsa')
# Replacement path for SSH connections
PATHREPLACE = "X:\\"
DEFAULTCONF = {
    "path": '/opt/trid/trid',
    'ENABLED': True,
    "key": KEY,
    "cmdline": ['-r:3'],
    'host': HOST,
    "replacement path": PATHREPLACE
}


def check(conf=DEFAULTCONF):
    if not conf['ENABLED']:
        return False
    if os.path.isfile(conf["path"]):
        del conf['replacement path']
        return True
    elif SSH:
        return True
    else:
        return False


def scan(filelist, conf=DEFAULTCONF):
    if os.path.isfile(conf["path"]):
        local = True

# Path: multiscanner/config.py
# CONFIG = determine_configuration_path(None)
# 
# Path: multiscanner/common/utils.py
# def list2cmdline(list):
#     """
#     This is used to overwrite the default subprocess list2cmdline function.
# 
#     The default subprocess list2cmdline function on windows messes with quotes arguments. This will not
#     """
#     return ' '.join(list)
# 
# def sshexec(hostname, cmd, port=22, username=None, password=None,
#             key_filename=None):
#     """Connects and runs a command. Returns the contents of stdin."""
#     client = sshconnect(hostname, port=port, username=username,
#                         password=password, key_filename=key_filename)
#     stdin, stdout, stderr = client.exec_command(cmd)
#     return stdout.read()
# 
# SSH = True


# Path: multiscanner/modules/Metadata/TrID.py
import os
import subprocess
import re
from multiscanner.config import CONFIG
from multiscanner.common.utils import list2cmdline, sshexec, SSH

HOST = ("MultiScanner", 22, "User")
# SSH Key
KEY = os.path.join(os.path.split(CONFIG)[0], 'etc', 'id_rsa')
# Replacement path for SSH connections
PATHREPLACE = "X:\\"
DEFAULTCONF = {
    "path": '/opt/trid/trid',
    'ENABLED': True,
    "key": KEY,
    "cmdline": ['-r:3'],
    'host': HOST,
    "replacement path": PATHREPLACE
}


def check(conf=DEFAULTCONF):
    if not conf['ENABLED']:
        return False
    if os.path.isfile(conf["path"]):
        del conf['replacement path']
        return True
    elif SSH:
        return True
    else:
        return False


def scan(filelist, conf=DEFAULTCONF):
    if os.path.isfile(conf["path"]):
        local = True

    elif SSH: