Esempio n. 1
0
def main(distribution):
    # dependencies
    apt_install_packages('libjpeg-dev', 'liblzma-dev', 'liblzo2-dev',
                         'zlib1g-dev', 'unzip', 'libffi-dev', 'libfuzzy-dev')
    pip3_install_packages('pluginbase', 'entropy')

    # removes due to compatibilty reasons
    try:
        apt_remove_packages('python-lzma')
        pip2_remove_packages('pyliblzma')
    except InstallationError:
        logging.debug('python-lzma not removed because present already')

    apt_install_packages('python-lzma')

    # installing unpacker
    _install_unpacker(distribution == 'xenial')

    # installing common code modules
    pip3_install_packages(
        'git+https://github.com/fkie-cad/common_helper_unpacking_classifier.git'
    )
    pip3_install_packages(
        'git+https://github.com/fkie-cad/fact_helper_file.git')

    # install plug-in dependencies
    _install_plugins()

    # configure environment
    _edit_sudoers()

    return 0
Esempio n. 2
0
def main(distribution):
    # dependencies
    apt_install_packages('python-dev', 'python-setuptools')
    apt_install_packages('libjpeg-dev', 'liblzma-dev', 'liblzo2-dev', 'zlib1g-dev')
    apt_install_packages('libssl-dev python3-tk')
    pip3_install_packages('pluginbase', 'Pillow', 'cryptography', 'pyopenssl', 'entropy', 'matplotlib')

    apt_install_packages('python-pip')
    # removes due to compatibilty reasons
    apt_remove_packages('python-lzma')
    pip2_remove_packages('pyliblzma')
    apt_install_packages('python-lzma')

    # install yara
    _install_yara()

    # installing unpacker
    _install_unpacker(distribution == 'xenial')

    # installing common code modules
    pip3_install_packages('git+https://github.com/fkie-cad/common_helper_process.git')
    pip3_install_packages('git+https://github.com/fkie-cad/common_helper_yara.git')
    pip3_install_packages('git+https://github.com/fkie-cad/common_helper_unpacking_classifier.git')
    pip3_install_packages('git+https://github.com/mass-project/common_analysis_base.git')

    # install plug-in dependencies
    _install_plugins()

    # compile custom magic file
    with OperateInDirectory('../mime'):
        cat_output, cat_code = execute_shell_command_get_return_code('cat custom_* > custommime')
        file_output, file_code = execute_shell_command_get_return_code('file -C -m custommime')
        mv_output, mv_code = execute_shell_command_get_return_code('mv -f custommime.mgc ../bin/')
        if any(code != 0 for code in (cat_code, file_code, mv_code)):
            raise InstallationError('Failed to properly compile magic file\n{}'.format('\n'.join((cat_output, file_output, mv_output))))
        Path('custommime').unlink()

    # configure environment
    _edit_sudoers()
    _edit_environment()

    # create directories
    _create_firmware_directory()

    # compiling yara signatures
    compile_signatures()
    _, yarac_return = execute_shell_command_get_return_code('yarac -d test_flag=false ../test/unit/analysis/test.yara ../analysis/signatures/Yara_Base_Plugin.yc')
    if yarac_return != 0:
        raise InstallationError('Failed to compile yara test signatures')

    with OperateInDirectory('../../'):
        with suppress(FileNotFoundError):
            Path('start_fact_backend').unlink()
        Path('start_fact_backend').symlink_to('src/start_fact_backend.py')

    return 0
Esempio n. 3
0
def main(distribution):
    # removes due to compatibilty reasons
    try:
        apt_remove_packages('python-lzma')
        pip2_remove_packages('pyliblzma')
    except InstallationError:
        logging.debug('python-lzma not removed because present already')

    # install dependencies
    install_dependencies(DEPENDENCIES['common'])
    install_dependencies(DEPENDENCIES[distribution])

    # installing unpacker
    _install_unpacker(distribution)

    # install plug-in dependencies
    _install_plugins()

    # configure environment
    _edit_sudoers()

    return 0