# Path: multiscanner/config.py
# CONFIG = determine_configuration_path(None)
# 
# Path: multiscanner/version.py

# 
# Path: multiscanner/common/utils.py
#     SSH = True
#     SSH = False
# def load_module(name, path):
# def list2cmdline(list):
# def convert_encoding(data, encoding='UTF-8', errors='replace'):
# def parse_config(config_object):
# def get_config_path(config_file, component):
# def dirname(path):
# def basename(path):
# def parseDir(directory, recursive=False, exclude=['__init__']):
# def parseFileList(FileList, recursive=False):
# def chunk_file_list(filelist, cmdlength=7191):
# def queue2list(queue):
# def hashfile(fname, hasher, blocksize=65536):
# def sshconnect(hostname, port=22, username=None, password=None, pkey=None,
#                key_filename=None, timeout=None, allow_agent=True,
#                look_for_keys=True, compress=False, sock=None):
# def sessionexec(client, cmd):
# def sshexec(hostname, cmd, port=22, username=None, password=None,
#             key_filename=None):


import codecs
import configparser
import os
import re
from collections import namedtuple
from flask import Flask, render_template, request
from multiscanner import CONFIG as MS_CONFIG
from multiscanner import __version__
from multiscanner.common import utils
    'KIBANA_LOC': "http://localhost:5601",
    'DEBUG': False,
    'METADATA_FIELDS': [
        "Submitter Name",
        "Submission Description",
        "Submitter Email",
        "Submitter Organization",
        "Submitter Phone",
    ],
    'TAGS': [
        "Malware",
        "Benign"
    ]
}

app = Flask(__name__)

# Finagle Flask to read config from .ini file instead of .py file
web_config_object = configparser.SafeConfigParser()
web_config_object.optionxform = str
web_config_file = utils.get_config_path(MS_CONFIG, 'web')
web_config_object.read(web_config_file)
if not web_config_object.has_section('web') or not os.path.isfile(web_config_file):
    # Write default config
    web_config_object.add_section('web')
    for key in DEFAULTCONF:
        web_config_object.set('web', key, str(DEFAULTCONF[key]))
    conffile = codecs.open(web_config_file, 'w', 'utf-8')
    web_config_object.write(conffile)
    conffile.close()

# Path: multiscanner/config.py
# CONFIG = determine_configuration_path(None)
# 
# Path: multiscanner/version.py

# 
# Path: multiscanner/common/utils.py
#     SSH = True
#     SSH = False
# def load_module(name, path):
# def list2cmdline(list):
# def convert_encoding(data, encoding='UTF-8', errors='replace'):
# def parse_config(config_object):
# def get_config_path(config_file, component):
# def dirname(path):
# def basename(path):
# def parseDir(directory, recursive=False, exclude=['__init__']):
# def parseFileList(FileList, recursive=False):
# def chunk_file_list(filelist, cmdlength=7191):
# def queue2list(queue):
# def hashfile(fname, hasher, blocksize=65536):
# def sshconnect(hostname, port=22, username=None, password=None, pkey=None,
#                key_filename=None, timeout=None, allow_agent=True,
#                look_for_keys=True, compress=False, sock=None):
# def sessionexec(client, cmd):
# def sshexec(hostname, cmd, port=22, username=None, password=None,
#             key_filename=None):


# Path: multiscanner/web/app.py
import codecs
import configparser
import os
import re
from collections import namedtuple
from flask import Flask, render_template, request
from multiscanner import CONFIG as MS_CONFIG
from multiscanner import __version__
from multiscanner.common import utils

    'KIBANA_LOC': "http://localhost:5601",
    'DEBUG': False,
    'METADATA_FIELDS': [
        "Submitter Name",
        "Submission Description",
        "Submitter Email",
        "Submitter Organization",
        "Submitter Phone",
    ],
    'TAGS': [
        "Malware",
        "Benign"
    ]
}

app = Flask(__name__)

# Finagle Flask to read config from .ini file instead of .py file
web_config_object = configparser.SafeConfigParser()
web_config_object.optionxform = str
web_config_file = utils.get_config_path(MS_CONFIG, 'web')
web_config_object.read(web_config_file)
if not web_config_object.has_section('web') or not os.path.isfile(web_config_file):
    # Write default config
    web_config_object.add_section('web')
    for key in DEFAULTCONF:
        web_config_object.set('web', key, str(DEFAULTCONF[key]))
    conffile = codecs.open(web_config_file, 'w', 'utf-8')
    web_config_object.write(conffile)
    conffile.close()

web_config = utils.parse_config(web_config_object)['web']