Exemplo n.º 1
0
def update_default_configurations():
    """
    Retrieves the latest skeleton configurations for setting up ElasticSearch, LogStash, Zeek, and Suricata
    """

    shutil.rmtree(const.INSTALL_CACHE, ignore_errors=True)
    makedirs(const.DEFAULT_CONFIGS, exist_ok=True)
    try:
        download_file(const.DEFAULT_CONFIGS_URL,
                      const.DEFAULT_CONFIGS_ARCHIVE_NAME,
                      stdout=True)
    except Exception as e:
        raise exceptions.DownloadError(
            "General error occurred while downloading archive: {}; {}".format(
                os.path.join(const.INSTALL_CACHE, 'default_configs.tar.gz'),
                e))
    shutil.rmtree(const.DEFAULT_CONFIGS, ignore_errors=True)
    time.sleep(1)
    try:
        extract_archive(
            os.path.join(const.INSTALL_CACHE, 'default_configs.tar.gz'),
            const.CONFIG_PATH)
    except IOError as e:
        raise exceptions.ArchiveExtractionError(
            "General error occurred while extracting archive: {}; {}".format(
                os.path.join(const.INSTALL_CACHE, 'default_configs.tar.gz'),
                e))
Exemplo n.º 2
0
def update_mirrors():
    """
    Retrieves the latest mirrors which contain the download locations for all components

    :return: True, if retrieved successfully
    """
    create_dynamite_root_directory()
    download_file('https://github.com/DynamiteAI/dynamite-nsm-configs/raw/master/mirrors.tar.gz',
                  'mirrors.tar.gz', stdout=True)
    shutil.rmtree(const.MIRRORS, ignore_errors=True)
    try:
        print('Copying mirrors -> /etc/dynamite/mirrors')
        extract_archive(os.path.join(const.INSTALL_CACHE, 'mirrors.tar.gz'), '/etc/dynamite/')
        return True
    except IOError as e:
        sys.stderr.write('[-] An error occurred while attempting to extract file. [{}]\n'.format(e))
    return False
Exemplo n.º 3
0
def update_default_configurations():
    """
    Retrieves the latest skeleton configurations for setting up ElasticSearch, LogStash, Zeek, and Suricata

    :return: True, if retrieved successfully
    """
    create_dynamite_root_directory()
    download_file('https://github.com/DynamiteAI/dynamite-nsm-configs/raw/master/default_configs.tar.gz',
                  'default_configs.tar.gz', stdout=True)
    shutil.rmtree(const.DEFAULT_CONFIGS, ignore_errors=True)
    time.sleep(1)
    try:
        print('Copying default_configs -> /etc/dynamite/default_configs')
        extract_archive(os.path.join(const.INSTALL_CACHE, 'default_configs.tar.gz'), '/etc/dynamite/')
        return True
    except IOError as e:
        sys.stderr.write('[-] An error occurred while attempting to extract file. [{}]\n'.format(e))
    return False
Exemplo n.º 4
0
def update_mirrors():
    """
    Retrieves the latest mirrors which contain the download locations for all components

    :return: True, if retrieved successfully
    """
    shutil.rmtree(const.INSTALL_CACHE, ignore_errors=True)
    create_dynamite_root_directory()
    download_file(const.MIRRORS_CONFIG_URL,
                  const.MIRRORS_CONFIG_ARCHIVE_NAME, stdout=True)
    shutil.rmtree(const.MIRRORS, ignore_errors=True)
    try:
        sys.stdout.write('[+] Copying mirrors -> {}\n'.format(const.MIRRORS))
        extract_archive(os.path.join(const.INSTALL_CACHE, 'mirrors.tar.gz'), const.CONFIG_PATH)
        return True
    except IOError as e:
        sys.stderr.write('[-] An error occurred while attempting to extract file. [{}]\n'.format(e))
    return False
Exemplo n.º 5
0
def update_default_configurations():
    """
    Retrieves the latest skeleton configurations for setting up ElasticSearch, LogStash, Zeek, and Suricata

    :return: True, if retrieved successfully
    """
    shutil.rmtree(const.INSTALL_CACHE, ignore_errors=True)
    create_dynamite_root_directory()
    download_file(const.DEFAULT_CONFIGS_URL,
                  const.DEFAULT_CONFIGS_ARCHIVE_NAME, stdout=True)
    shutil.rmtree(const.DEFAULT_CONFIGS, ignore_errors=True)
    time.sleep(1)
    try:
        sys.stdout.write('[+] Copying default_configs -> {}\n'.format(const.DEFAULT_CONFIGS))
        extract_archive(os.path.join(const.INSTALL_CACHE, 'default_configs.tar.gz'), const.CONFIG_PATH)
        return True
    except IOError as e:
        sys.stderr.write('[-] An error occurred while attempting to extract file. [{}]\n'.format(e))
    return False
Exemplo n.º 6
0
def update_mirrors():
    """
    Retrieves the latest mirrors which contain the download locations for all components
    """

    shutil.rmtree(const.INSTALL_CACHE, ignore_errors=True)
    makedirs(const.MIRRORS, exist_ok=True)
    try:
        download_file(const.MIRRORS_CONFIG_URL,
                      const.MIRRORS_CONFIG_ARCHIVE_NAME,
                      stdout=True)
    except Exception as e:
        raise exceptions.DownloadError(
            "General error occurred while downloading archive: {}; {}".format(
                os.path.join(const.INSTALL_CACHE, 'mirrors.tar.gz'), e))
    shutil.rmtree(const.MIRRORS, ignore_errors=True)
    try:
        extract_archive(os.path.join(const.INSTALL_CACHE, 'mirrors.tar.gz'),
                        const.CONFIG_PATH)
        return True
    except IOError as e:
        raise exceptions.DownloadError(
            "General error occurred while extracting archive: {}; {}".format(
                os.path.join(const.INSTALL_CACHE, 'mirrors.tar.gz'), e))