Beispiel #1
0
def install():
    check_python_version()
    args = _setup_argparser()
    _setup_logging(args.log_level, args.log_file, debug_flag=args.debug)
    welcome()
    distribution = check_distribution()
    none_chosen = not (args.frontend or args.db or args.backend)
    # TODO maybe replace this with an cli argument
    skip_docker = FACT_INSTALLER_SKIP_DOCKER is not None
    # Note that the skip_docker environment variable overrides the cli argument
    only_docker = not skip_docker and none_chosen and (
        args.backend_docker_images or args.frontend_docker_images)

    installation_directory = get_directory_of_current_file() / 'install'

    with OperateInDirectory(str(installation_directory)):
        if not only_docker:
            install_fact_components(args, distribution, none_chosen,
                                    skip_docker)
        else:
            install_docker_images(args)

    if args.statistic_cronjob:
        install_statistic_cronjob()

    logging.info('installation complete')
    logging.warning(
        'If FACT does not start, reload the environment variables with: source /etc/profile'
    )

    sys.exit(0)
Beispiel #2
0
    from helperFunctions.install import check_distribution
    from plugins.installer import AbstractPluginInstaller
except ImportError:
    import sys
    SRC_PATH = Path(__file__).absolute().parent.parent.parent.parent
    sys.path.append(str(SRC_PATH))

    from helperFunctions.install import check_distribution
    from plugins.installer import AbstractPluginInstaller


class SoftwareComponentsInstaller(AbstractPluginInstaller):
    base_path = Path(__file__).resolve().parent

    def install_files(self):
        url_crypto_signatures = 'https://raw.githubusercontent.com/Yara-Rules/rules/master/crypto/crypto_signatures.yar'
        dest_crypto_signatures = f'{self.base_path}/signatures/crypto_signatures.yar'
        Path('signatures').mkdir(exist_ok=True)
        urllib.request.urlretrieve(url_crypto_signatures,
                                   dest_crypto_signatures)


# Alias for generic use
Installer = SoftwareComponentsInstaller

if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)
    distribution = check_distribution()
    installer = Installer(distribution)
    installer.install()