def main(distribution): logging.info('Setting up mongo database') if distribution == 'xenial': _add_mongo_mirror_to_sources() apt_update_sources() apt_install_packages('mongodb-org') else: apt_install_packages('mongodb') # creating DB directory fact_db_directory = _get_db_directory() mkdir_output, _ = execute_shell_command_get_return_code('sudo mkdir -p --mode=0744 {}'.format(fact_db_directory)) chown_output, chown_code = execute_shell_command_get_return_code('sudo chown {}:{} {}'.format(os.getuid(), os.getgid(), fact_db_directory)) if chown_code != 0: raise InstallationError('Failed to set up database directory. Check if parent folder exists\n{}'.format('\n'.join((mkdir_output, chown_output)))) # initializing DB authentication logging.info('Initialize database') with OperateInDirectory('..'): init_output, init_code = execute_shell_command_get_return_code('python3 init_database.py') if init_code != 0: raise InstallationError('Unable to initialize database\n{}'.format(init_output)) with OperateInDirectory('../../'): with suppress(FileNotFoundError): Path('start_fact_db').unlink() Path('start_fact_db').symlink_to('src/start_fact_db.py') return 0
def _install_yara(): # pylint: disable=too-complex # CAUTION: Yara python binding is installed in install/common.py, because it is needed in the frontend as well. try: latest_url = requests.get('https://github.com/VirusTotal/yara/releases/latest').url latest_version = latest_url.split('/tag/')[1] except (AttributeError, KeyError): raise InstallationError('Could not find latest yara version') from None installed_version, return_code = execute_shell_command_get_return_code('yara --version') if return_code == 0 and installed_version.strip() == latest_version.strip('v'): logging.info('Skipping yara installation: Already installed and up to date') return logging.info(f'Installing yara {latest_version}') archive = f'{latest_version}.zip' download_url = f'https://github.com/VirusTotal/yara/archive/refs/tags/{archive}' wget_output, wget_code = execute_shell_command_get_return_code(f'wget {download_url}') if wget_code != 0: raise InstallationError(f'Error on yara download.\n{wget_output}') zip_output, return_code = execute_shell_command_get_return_code(f'unzip {archive}') Path(archive).unlink() if return_code != 0: raise InstallationError(f'Error on yara extraction.\n{zip_output}') yara_folder = [p for p in Path('.').iterdir() if p.name.startswith('yara-')][0] with OperateInDirectory(yara_folder.name, remove=True): os.chmod('bootstrap.sh', 0o775) for command in ['./bootstrap.sh', './configure --enable-magic', 'make -j$(nproc)', 'sudo make install']: output, return_code = execute_shell_command_get_return_code(command) if return_code != 0: raise InstallationError(f'Error in yara installation.\n{output}')
def _install_yara(): logging.info('Installing yara') # CAUTION: Yara python binding is installed in bootstrap_common, because it is needed in the frontend as well. apt_install_packages('bison', 'flex', 'libmagic-dev') if check_string_in_command('yara --version', '3.7.1'): logging.info('skipping yara installation (already installed)') else: broken, output = False, '' wget_output, wget_code = execute_shell_command_get_return_code('wget https://github.com/VirusTotal/yara/archive/v3.7.1.zip') if wget_code != 0: raise InstallationError('Error on yara download.\n{}'.format(wget_output)) zip_output, zip_code = execute_shell_command_get_return_code('unzip v3.7.1.zip') if zip_code == 0: yara_folder = [child for child in Path('.').iterdir() if 'yara-3.' in child.name][0] with OperateInDirectory(yara_folder.name, remove=True): os.chmod('bootstrap.sh', 0o775) for command in ['./bootstrap.sh', './configure --enable-magic', 'make -j$(nproc)', 'sudo make install']: output, return_code = execute_shell_command_get_return_code(command) if return_code != 0: broken = True break else: raise InstallationError('Error on yara extraction.\n{}'.format(zip_output)) Path('v3.7.1.zip').unlink() if broken: raise InstallationError('Error in yara installation.\n{}'.format(output))
def _install_yara(distribution): # pylint: disable=too-complex logging.info('Installing yara') # CAUTION: Yara python binding is installed in install/common.py, because it is needed in the frontend as well. if distribution != 'fedora': apt_install_packages('bison', 'flex') if check_string_in_command_output('yara --version', '3.7.1'): logging.info('skipping yara installation (already installed)') return wget_output, wget_code = execute_shell_command_get_return_code( 'wget https://github.com/VirusTotal/yara/archive/v3.7.1.zip') if wget_code != 0: raise InstallationError(f'Error on yara download.\n{wget_output}') zip_output, return_code = execute_shell_command_get_return_code( 'unzip v3.7.1.zip') Path('v3.7.1.zip').unlink() if return_code != 0: raise InstallationError(f'Error on yara extraction.\n{zip_output}') yara_folder = [ child for child in Path('.').iterdir() if 'yara-3.' in child.name ][0] with OperateInDirectory(yara_folder.name, remove=True): os.chmod('bootstrap.sh', 0o775) for command in [ './bootstrap.sh', './configure --enable-magic', 'make -j$(nproc)', 'sudo make install' ]: output, return_code = execute_shell_command_get_return_code( command) if return_code != 0: raise InstallationError( f'Error in yara installation.\n{output}')
def main(distribution): # dependencies if distribution == 'fedora': dnf_install_packages('python-devel', 'python-setuptools') dnf_install_packages('libjpeg-devel') dnf_install_packages('openssl-devel', 'python3-tkinter') else: apt_install_packages('python-dev', 'python-setuptools') apt_install_packages('libjpeg-dev') apt_install_packages('libssl-dev', 'python3-tk') pip3_install_packages('pluginbase', 'Pillow', 'cryptography', 'pyopenssl', 'matplotlib', 'docker', 'networkx') # install yara _install_yara(distribution) # build extraction docker container logging.info('Building fact extraction container') output, return_code = execute_shell_command_get_return_code( 'docker pull fkiecad/fact_extractor') if return_code != 0: raise InstallationError( 'Failed to pull extraction container:\n{}'.format(output)) # installing common code modules pip3_install_packages( 'git+https://github.com/fkie-cad/common_helper_yara.git') pip3_install_packages( 'git+https://github.com/mass-project/common_analysis_base.git') # install plug-in dependencies _install_plugins(distribution) # 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
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
def wget_static_web_content(url, target_folder, additional_actions, resource_logging_name=None): logging.info('Install static {} content'.format(resource_logging_name if resource_logging_name else url)) with OperateInDirectory(target_folder): wget_output, wget_code = execute_shell_command_get_return_code('wget -nc {}'.format(url)) if wget_code != 0: raise InstallationError('Failed to fetch resource at {}\n{}'.format(url, wget_output)) for action in additional_actions: action_output, action_code = execute_shell_command_get_return_code(action) if action_code != 0: raise InstallationError('Problem in processing resource at {}\n{}'.format(url, action_output))
def _install_plugins(): logging.info('Installing plugins') find_output, return_code = execute_shell_command_get_return_code('find ../plugins -iname "install.sh"') if return_code != 0: raise InstallationError('Error retrieving plugin installation scripts') for install_script in find_output.splitlines(keepends=False): logging.info('Running {}'.format(install_script)) shell_output, return_code = execute_shell_command_get_return_code(install_script) if return_code != 0: raise InstallationError('Error in installation of {} plugin\n{}'.format(Path(install_script).parent.name, shell_output))
def main(radare, nginx): pip3_install_packages( 'werkzeug==0.16.1' ) # Multiple flask plugins break on werkzeug > 0.16.1 pip3_install_packages('flask', 'flask_restful', 'flask_security', 'flask_sqlalchemy', 'flask-paginate', 'Flask-API', 'uwsgi', 'bcrypt', 'python-dateutil', 'si-prefix', 'email-validator') # installing web/js-frameworks _install_css_and_js_files() # create user database _create_directory_for_authentication() if nginx: _install_nginx() if radare: logging.info('Initializing docker container for radare') execute_shell_command_get_return_code( 'virtualenv {}'.format(COMPOSE_VENV)) output, return_code = execute_shell_command_get_return_code( '{} install -U docker-compose'.format(COMPOSE_VENV / 'bin' / 'pip')) if return_code != 0: raise InstallationError( 'Failed to set up virtualenv for docker-compose\n{}'.format( output)) with OperateInDirectory('radare'): output, return_code = execute_shell_command_get_return_code( '{} build'.format(COMPOSE_VENV / 'bin' / 'docker-compose')) if return_code != 0: raise InstallationError( 'Failed to initialize radare container:\n{}'.format( output)) # pull pdf report container logging.info('Pulling pdf report container') output, return_code = execute_shell_command_get_return_code( 'docker pull fkiecad/fact_pdf_report') if return_code != 0: raise InstallationError( 'Failed to pull pdf report container:\n{}'.format(output)) with OperateInDirectory('../../'): with suppress(FileNotFoundError): Path('start_fact_frontend').unlink() Path('start_fact_frontend').symlink_to('src/start_fact_frontend.py') return 0
def _install_nginx(): apt_install_packages('nginx') _generate_and_install_certificate() _configure_nginx() nginx_output, nginx_code = execute_shell_command_get_return_code('sudo nginx -s reload') if nginx_code != 0: raise InstallationError('Failed to start nginx\n{}'.format(nginx_output))
def _install_docker_images(): # pull extraction docker container logging.info('Pulling fact extraction container') output, return_code = execute_shell_command_get_return_code('docker pull fkiecad/fact_extractor') if return_code != 0: raise InstallationError(f'Failed to pull extraction container:\n{output}')
def execute_commands_and_raise_on_return_code(commands, error=None): for command in commands: bad_return = error if error else 'execute {}'.format(command) output, return_code = execute_shell_command_get_return_code(command) if return_code != 0: raise InstallationError('Failed to {}\n{}'.format( bad_return, output))
def _get_db_directory(): output, return_code = execute_shell_command_get_return_code( r'grep -oP "dbPath:[\s]*\K[^\s]+" ../config/mongod.conf') if return_code != 0: raise InstallationError( 'Unable to locate target for database directory') return output.strip()
def _add_mongo_mirror_to_sources(): apt_key_output, apt_key_code = execute_shell_command_get_return_code( 'sudo -E apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5') execute_shell_command_get_return_code('sudo rm /etc/apt/sources.list.d/mongodb-org-3.*') tee_output, tee_code = execute_shell_command_get_return_code( 'echo "deb https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list') if any(code != 0 for code in (apt_key_code, tee_code)): raise InstallationError('Unable to set up mongodb installation\n{}'.format('\n'.join((apt_key_output, tee_output))))
def _create_firmware_directory(): logging.info('Creating firmware directory') config = load_main_config() data_dir_name = config.get('data_storage', 'firmware_file_storage_directory') mkdir_output, mkdir_code = execute_shell_command_get_return_code('sudo mkdir -p --mode=0744 {}'.format(data_dir_name)) chown_output, chown_code = execute_shell_command_get_return_code('sudo chown {}:{} {}'.format(os.getuid(), os.getgid(), data_dir_name)) if not all(code == 0 for code in (mkdir_code, chown_code)): raise InstallationError('Failed to create directories for binary storage\n{}\n{}'.format(mkdir_output, chown_output))
def _install_checksec(): checksec_path = BIN_DIR / 'checksec' logging.info('Installing checksec.sh') checksec_url = 'https://raw.githubusercontent.com/slimm609/checksec.sh/2.5.0/checksec' output, return_code = execute_shell_command_get_return_code(f'wget -P {BIN_DIR} {checksec_url}') if return_code != 0: raise InstallationError(f'Error during installation of checksec.sh\n{output}') checksec_path.chmod(checksec_path.stat().st_mode | stat.S_IEXEC) # chmod +x
def _edit_sudoers(): logging.info('add rules to sudo...') username = os.environ['USER'] sudoers_content = '\n'.join(('{}\tALL=NOPASSWD: {}'.format(username, command) for command in ('/bin/mount', '/bin/umount', '/bin/mknod', '/usr/local/bin/sasquatch', '/bin/rm', '/bin/cp', '/bin/dd', '/bin/chown'))) Path('/tmp/fact_overrides').write_text('{}\n'.format(sudoers_content)) chown_output, chown_code = execute_shell_command_get_return_code('sudo chown root:root /tmp/fact_overrides') mv_output, mv_code = execute_shell_command_get_return_code('sudo mv /tmp/fact_overrides /etc/sudoers.d/fact_overrides') if not chown_code == mv_code == 0: raise InstallationError('Editing sudoers file did not succeed\n{}\n{}'.format(chown_output, mv_output))
def _add_mongo_mirror(distribution): apt_key_output, apt_key_code = execute_shell_command_get_return_code( MONGO_MIRROR_COMMANDS[distribution]['key']) tee_output, tee_code = execute_shell_command_get_return_code( MONGO_MIRROR_COMMANDS[distribution]['sources']) if any(code != 0 for code in (apt_key_code, tee_code)): raise InstallationError( 'Unable to set up mongodb installation\n{}'.format('\n'.join( (apt_key_output, tee_output))))
def _edit_environment(): logging.info('set environment variables...') for command in [ 'sudo cp -f fact_env.sh /etc/profile.d/', 'sudo chmod 755 /etc/profile.d/fact_env.sh', '. /etc/profile' ]: output, return_code = execute_shell_command_get_return_code(command) if return_code != 0: raise InstallationError( f'Failed to add environment changes [{command}]\n{output}')
def _install_docker_images(radare): if radare: logging.info('Initializing docker container for radare') with OperateInDirectory('radare'): output, return_code = execute_shell_command_get_return_code( 'docker-compose build') if return_code != 0: raise InstallationError( 'Failed to initialize radare container:\n{}'.format( output)) # pull pdf report container logging.info('Pulling pdf report container') output, return_code = execute_shell_command_get_return_code( 'docker pull fkiecad/fact_pdf_report') if return_code != 0: raise InstallationError( 'Failed to pull pdf report container:\n{}'.format(output))
def _install_stuffit(): logging.info('Installing stuffit') _, wget_code = execute_shell_command_get_return_code('wget -O - http://my.smithmicro.com/downloads/files/stuffit520.611linux-i386.tar.gz | tar -zxv') if wget_code == 0: _, cp_code = execute_shell_command_get_return_code('sudo cp bin/unstuff /usr/local/bin/') else: cp_code = 255 _, rm_code = execute_shell_command_get_return_code('rm -fr bin doc man') if not all(code == 0 for code in (wget_code, cp_code, rm_code)): raise InstallationError('Error in installation of unstuff')
def install_pip(): logging.info('Installing python3 pip') for command in [ 'wget https://bootstrap.pypa.io/get-pip.py', 'sudo -EH python3 get-pip.py', 'rm get-pip.py' ]: output, return_code = execute_shell_command_get_return_code(command) if return_code != 0: raise InstallationError( f'Error in pip installation for python3:\n{output}')
def install_pip(python_command): logging.info('Installing {} pip'.format(python_command)) for command in [ 'wget https://bootstrap.pypa.io/get-pip.py', 'sudo -EH {} get-pip.py'.format(python_command), 'rm get-pip.py' ]: output, return_code = execute_shell_command_get_return_code(command) if return_code != 0: raise InstallationError( 'Error in pip installation for {}:\n{}'.format( python_command, output))
def _update_submodules(): _, is_repository = execute_shell_command_get_return_code('git status') if is_repository == 0: git_output, git_code = execute_shell_command_get_return_code( '(cd ../../ && git submodule foreach "git pull")') if git_code != 0: raise InstallationError( 'Failed to update submodules\n{}'.format(git_output)) else: logging.warning( 'FACT is not set up using git. Note that *adding submodules* won\'t work!!' )
def _create_directory_for_authentication(): # pylint: disable=invalid-name logging.info('Creating directory for authentication') config = load_main_config() dburi = config.get('data_storage', 'user_database') factauthdir = '/'.join(dburi.split('/')[:-1])[10:] # FIXME this should be beautified with pathlib mkdir_output, mkdir_code = execute_shell_command_get_return_code('sudo mkdir -p --mode=0744 {}'.format(factauthdir)) chown_output, chown_code = execute_shell_command_get_return_code('sudo chown {}:{} {}'.format(os.getuid(), os.getgid(), factauthdir)) if not all(return_code == 0 for return_code in [mkdir_code, chown_code]): raise InstallationError('Error in creating directory for authentication database.\n{}'.format('\n'.join((mkdir_output, chown_output))))
def _patch_bootstrap(): with OperateInDirectory('bootstrap/css'): for file_name in [ 'bootstrap.min.css', 'bootstrap.min.css.map', 'bootstrap-theme.min.css', 'bootstrap-theme.min.css.map', 'bootstrap.css.map', 'bootstrap-theme.css.map' ]: Path(file_name).unlink() _, first_code = execute_shell_command_get_return_code( 'patch --forward -r - bootstrap.css ../../../../install/patches/bootstrap.patch' ) _, second_code = execute_shell_command_get_return_code( 'patch --forward -r - bootstrap-theme.css ../../../../install/patches/bootstrap-theme.patch' ) if not first_code == second_code == 0: raise InstallationError('Failed to patch bootstrap files')
def _install_checksec(distribution): checksec_path = BIN_DIR / 'checksec' if checksec_path.is_file(): logging.info('Skipping checksec.sh installation (already installed)') return # dependencies install_function = apt_install_packages if distribution != 'fedora' else dnf_install_packages install_function('binutils', 'openssl', 'file') logging.info('Installing checksec.sh') checksec_url = "https://raw.githubusercontent.com/slimm609/checksec.sh/master/checksec" output, return_code = execute_shell_command_get_return_code( f'wget -P {BIN_DIR} {checksec_url}') if return_code != 0: raise InstallationError( f'Error during installation of checksec.sh\n{output}') checksec_path.chmod(checksec_path.stat().st_mode | stat.S_IEXEC) # chmod +x
def main(skip_docker, distribution): apt_packages_path = INSTALL_DIR / 'apt-pkgs-backend.txt' dnf_packages_path = INSTALL_DIR / 'dnf-pkgs-backend.txt' if distribution != 'fedora': pkgs = read_package_list_from_file(apt_packages_path) apt_install_packages(*pkgs) else: pkgs = read_package_list_from_file(dnf_packages_path) dnf_install_packages(*pkgs) install_pip_packages(PIP_DEPENDENCIES) # install yara _install_yara() _install_checksec() if not skip_docker: _install_docker_images() # install plug-in dependencies _install_plugins(distribution, skip_docker) # configure environment _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
def _install_nginx(distribution): if distribution != 'fedora': apt_install_packages('nginx') else: dnf_install_packages('nginx') _generate_and_install_certificate() _configure_nginx() if distribution == 'fedora': execute_commands_and_raise_on_return_code([ 'sudo restorecon -v /etc/nginx/fact.*', 'sudo semanage fcontext -at httpd_log_t "/var/log/fact(/.*)?" || true', 'sudo restorecon -v -R /var/log/fact' ], error= 'restore selinux context') nginx_output, nginx_code = execute_shell_command_get_return_code( 'sudo nginx -s reload') if nginx_code != 0: raise InstallationError( 'Failed to start nginx\n{}'.format(nginx_output))
def main(radare, nginx): execute_shell_command_get_return_code( 'sudo -EH pip3 install werkzeug==0.14.1' ) # FIXME pinning werkzeug because of broken tests pip3_install_packages('flask', 'flask_restful', 'flask_security', 'flask_sqlalchemy', 'flask-paginate', 'Flask-API', 'uwsgi', 'bcrypt', 'python-dateutil') # installing web/js-frameworks with OperateInDirectory('../web_interface/static'): wget_static_web_content( 'https://github.com/twbs/bootstrap/releases/download/v3.3.7/bootstrap-3.3.7-dist.zip', '.', [ 'unzip -o bootstrap-3.3.7-dist.zip', 'rm bootstrap-3.3.7-dist.zip', 'rm -rf bootstrap', 'mv bootstrap-3.3.7-dist bootstrap' ], 'bootstrap') _patch_bootstrap() wget_static_web_content('http://code.jquery.com/jquery-1.12.0.min.js', 'bootstrap/js', ['mv jquery-1.12.0.min.js jquery.min.js'], 'jquery') # wget_static_web_content('https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js', 'bootstrap/js', [], 'jquery') wget_static_web_content( 'https://raw.githubusercontent.com/Eonasdan/bootstrap-datetimepicker/master/build/js/bootstrap-datetimepicker.min.js', 'bootstrap/js', [], 'datetimepicker js') wget_static_web_content( 'https://raw.githubusercontent.com/Eonasdan/bootstrap-datetimepicker/master/build/css/bootstrap-datetimepicker.min.css', 'bootstrap/css', [], 'datetimepicker css') wget_static_web_content( 'https://raw.githubusercontent.com/moment/moment/develop/moment.js', 'bootstrap/js', [], 'moment.js') if not Path('bootstrap3-editable').exists(): wget_static_web_content( 'https://vitalets.github.io/x-editable/assets/zip/bootstrap3-editable-1.5.1.zip', '.', [ 'unzip -o bootstrap3-editable-1.5.1.zip', 'rm bootstrap3-editable-1.5.1.zip CHANGELOG.txt LICENSE-MIT README.md', 'rm -rf inputs-ext' ], 'x-editable') if Path('jstree').is_dir(): shutil.rmtree('jstree') wget_static_web_content( 'https://github.com/vakata/jstree/zipball/3.3.2', '.', ['unzip 3.3.2', 'rm 3.3.2', 'mv vakata* jstree'], 'jstree') wget_static_web_content( 'https://code.angularjs.org/1.4.8/angular.min.js', '.', [], 'angularJS') # wget_static_web_content('https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js', '.', [], 'angularJS') wget_static_web_content( 'https://github.com/chartjs/Chart.js/releases/download/v2.3.0/Chart.js', '.', [], 'charts.js') _build_highlight_js() # create user database _create_directory_for_authentication() if nginx: apt_install_packages('nginx') generate_and_install_certificate() configure_nginx() nginx_output, nginx_code = execute_shell_command_get_return_code( 'sudo nginx -s reload') if nginx_code != 0: raise InstallationError( 'Failed to start nginx\n{}'.format(nginx_output)) if radare: logging.info('Initializing docker container for radare') if check_if_command_in_path('docker-compose'): with OperateInDirectory('radare'): output, return_code = execute_shell_command_get_return_code( 'docker-compose build') if return_code != 0: raise InstallationError( 'Failed to initialize radare container:\n{}'.format( output)) else: raise InstallationError( 'docker-compose is not installed. Please (re-)run pre_install.sh' ) # pull pdf report container logging.info('Pulling pdf report container') output, return_code = execute_shell_command_get_return_code( 'docker pull fkiecad/fact_pdf_report') if return_code != 0: raise InstallationError( 'Failed to pull pdf report container:\n{}'.format(output)) with OperateInDirectory('../../'): with suppress(FileNotFoundError): Path('start_fact_frontend').unlink() Path('start_fact_frontend').symlink_to('src/start_fact_frontend.py') return 0