tis-bitwarden

1.28.3-7
Bitwarden is a freemium and open source password manager under the AGPL license, which allows you to generate and store passwords in a secure manner. These elements are protected by a single password called "master password"
9273 downloads
Download

  Description 

  • package : tis-bitwarden
  • version : 1.28.3-7
  • architecture : all
  • categories : Security,Utilities
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ,Simon Fonteneau
  • description : Bitwarden is a freemium and open source password manager under the AGPL license, which allows you to generate and store passwords in a secure manner. These elements are protected by a single password called "master password"
  • locale : all
  • target_os : windows
  • min_wapt_version : 1.8
  • sources : https://github.com/bitwarden/desktop/releases
  • installed_size : 214131817
  • impacted_process : Bitwarden
  • description_fr : Bitwarden est un gestionnaire de mots de passe freemium et open source sous licence AGPL, qui permet de générer et de conserver des mots de passe de manière sécurisée. Ces éléments sont protégés par un seul et unique mot de passe appelé « mot de passe maître »
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor : 8bit Solutions LLC
  • licence : AGPL-3.0 (d) and GPL-3.0
  • signature_date : 2021-09-23T09:52:38.225368
  • Homepage : https://bitwarden.com

  Setup.py 

# -*- coding: utf-8 -*-
from setuphelpers import *
import platform
import json
import time

# Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
bin_contains = 'Bitwarden-Installer-'
silent_args = '/S'
app_uninstallkey = ''


def install():
    # Declaring local variables
    package_version = control.get_software_version()
    bin_name = glob.glob('*%s*.exe' % bin_contains)[0]

    # Installing the software
    print("Installing: %s" % bin_name)
    install_exe_if_needed(bin_name,
        silentflags=silent_args,
        key=app_uninstallkey,
        min_version=package_version,
    )

    # Disabling updater (source: https://github.com/bitwarden/desktop/issues/697)
    set_environ_variable('ELECTRON_NO_UPDATER', '1')


def uninstall():
    # Uninstalling the package
    for uninstall in installed_softwares(name=r'\bBitwarden\b'):
        print("Removing: %s (%s)" % (uninstall['name'], uninstall['version']))
        run(uninstall_cmd(uninstall['key']))
        wait_uninstallkey_absent(uninstall['key'])


def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    sub_bin_name = bin_contains + '-%s.exe'
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name
    git_repo = 'bitwarden/desktop'
    url_api = 'https://api.github.com/repos/%s/releases/latest' % git_repo

    # Getting latest version information from official sources
    print("API used is: %s" % url_api)
    json_load = json.loads(wgets(url_api, proxies=proxies))

    for download in json_load['assets']:
        if bin_contains in download['name']:
            download_url = download['browser_download_url']
            version = json_load['tag_name'].replace('v', '')
            latest_bin = download['name']
            break

    print("Latest %s version is: %s" % (app_name, version))
    print("Download URL is: %s" % download_url)

    # Downloading latest binaries
    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies)

        # Checking version from file
        version_from_file = get_version_from_binary(latest_bin)
        if version != version_from_file and version_from_file != '':
            print("Changing version to the version number of the binary")
            os.rename(latest_bin,sub_bin_name % version_from_file)
            version = version_from_file
        else:
            print("Binary file version correspond to online version")

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        result = True
    control.version = '%s-%s' % (Version(version), control.version.split('-', 1)[-1])
    #control.set_software_version(version)
    control.save_control_to_wapt()

    # Deleting outdated binaries
    remove_outdated_binaries(version)

    # Validating update-package-sources
    return result




def wait_uninstallkey_absent(key=None, max_loop=120):
    loop=0
    while uninstall_key_exists(key):
        loop = loop + 1
        if loop > max_loop:
            return "timout"
        time.sleep(1)


def get_proxies():
    r"""Return system proxy with the urllib python library

    >>> get_proxies()
    {'http': 'http://srvproxy.ad.domain.lan:8080',
    'https': 'http://srvproxy.ad.domain.lan:8080'}

    """
    if platform.python_version_tuple()[0] == '3':
        from urllib.request import getproxies
    else:
        from urllib import getproxies
    return getproxies()


def get_proxies_from_wapt_console():
    r"""Return proxy information from the current user WAPT console

    >>> get_proxies_from_wapt_console()
    {'http': 'http://srvproxy.ad.domain.lan:8080',
    'https': 'http://srvproxy.ad.domain.lan:8080'}

    """
    proxies = {}
    if platform.system() == 'Windows':
        waptconsole_ini_path = makepath(user_local_appdata(), 'waptconsole', 'waptconsole.ini')
    else:
        waptconsole_ini_path = makepath(user_home_directory(), '.config', 'waptconsole', 'waptconsole.ini')
    if isfile(waptconsole_ini_path):
        proxy_wapt = inifile_readstring(waptconsole_ini_path, 'global', 'http_proxy')
        if proxy_wapt:
            proxies = {'http': proxy_wapt, 'https': proxy_wapt}
    return proxies


def get_version_from_binary(filename, property_name='ProductVersion'):
    r""" Get installer version from file informations, for now, only exe and msi files are compatibles

    Args:
        filename (str): path to the file
        property_name (str): selected property

    Returns:
        str: version number

     """
    if filename.endswith('.msi'):
        return get_msi_properties(filename)[property_name]
    else:
        return get_file_properties(filename)[property_name]


def remove_outdated_binaries(version, filename_contains=None, list_extensions=['exe','msi','deb','rpm','dmg','pkg']):
    r"""Remove files based on the version contained in his filename

    Args:
        version (str): version number of keeped files
        filename_contains (str or list of str): Part of the filename that must be contained (useful for distinguishing architecture and os)
        list_extensions (str or list of str): file extensions of verified files

    Returns:
        None

    .. versionadded:: 2.0

    """
    if type(list_extensions) != list:
        list_extensions = [list_extensions]
    if filename_contains:
        if type(filename_contains) != list:
            filename_contains = [filename_contains]
    list_extensions = ['.' + ext for ext in list_extensions if ext[0] != '.']
    for file_ext in list_extensions:
        for bin_in_dir in glob.glob('*%s' % file_ext):
            if not version in bin_in_dir:
                remove_file(bin_in_dir)
            if filename_contains:
                for filename_contain in filename_contains:
                    if not filename_contain in bin_in_dir:
                        remove_file(bin_in_dir)


										

  Changelog 



Changelog software url : https://github.com/bitwarden/desktop/releases



No changelog.txt.
									
  manifest.sha256