tis-bitwarden-config-template icon

Bitwarden-config

Paquet d’installation silencieuse pour Bitwarden-config

1-0

  • package: tis-bitwarden-config-template
  • name: Bitwarden-config
  • version: 1-0
  • categories: System and network
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ,Jordan ARNAUD
  • target_os: windows
  • architecture: all
  • signature_date:
  • size: 8.09 Ko
  • depends:

package           : tis-bitwarden-config-template
version           : 1-0
architecture      : all
section           : base
priority          : optional
name              : Bitwarden-config
categories        : System and network
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ,Jordan ARNAUD
description       : Bitwarden Configuration
depends           : tis-bitwarden
conflicts         : 
maturity          : PROD
locale            : 
target_os         : windows
min_wapt_version  : 2.5
sources           : 
installed_size    : 
impacted_process  : 
description_fr    : 
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : 1fac975f-da0a-4d0d-935c-c30ce4d94c3f
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 1267028732396572ee412cdf3170ab896a2bd43f6c75ba8a3a7b1597135b90bc
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : uTwbT8ZdkkyHeAn0l1wNi72I4nWD11mMPtiVFY2ca8rYHOdfpRXiXAOb81/Og5oQO4KgUmV7wbkv5sZRbGF1dhVznG3JndhcMoVaEunp84lyHF4/e1XFmiZhLHiNkf1FQKXyKuQeTvUTjh2JQf/MZ7UClBloBRs+1xrsdv4k0G7qLCIEr/uuyuVbN4WTFC1lDqLX5+oHStVqBov7rgfZalctx+yXUwoUAOlkjiRTgFnh+PrKwFIKTDln78s/SdDVZTRKfMHOXVhEXIkM21E0SBkv15kRL3IY8bpAkoe/yKSDD2VgQTY0yKWZaGCj/eXlMcBa0DnAcrIp39pLKtGlgQ==
signature_date    : 2024-03-13T12:00:08.788596
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes

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

uninstallkey = []

# Defining variables
my_bitwarden_server = "https://example.ad.domain.lan"



def install():
    pass


def session_setup():
    print("Configuring: URL of remote Bitwarden server")

    # C:\Users\username\AppData\Roaming\Bitwarden\data.json
    # /home/username/.config/Bitwarden/data.json
    user_conf_file = "data.json"
    if get_os_name() == "Windows":
        if installed_softwares(uninstallkey="Bitwarden"):
            user_conf_dir = makepath(user_appdata, "Bitwarden-Portable", "bitwarden-appdata")
        else:
            user_conf_dir = makepath(user_appdata, "Bitwarden")
    else:
        user_conf_dir = makepath(user_home_directory(), ".config", "Bitwarden")
    user_conf_path = makepath(user_conf_dir, user_conf_file)
    user_conf_content = (
        '{"environmentUrls": {"base": "%s"}, "clearClipboardKey": 20, "enableTray": true, "enableCloseToTray": true}' % my_bitwarden_server
    )

    # Writting configuration file
    if not isdir(user_conf_dir):
        mkdirs(user_conf_dir)
    if isfile(user_conf_path):
        data = json_load(user_conf_path)
        new_data = json.loads(user_conf_content)
        data.update(new_data)
    else:
        data = json.loads(user_conf_content)
    json_write(user_conf_path, data)


def update_package():
    # Incrementing version of the package
    control.version = "%s-%s" % (control.get_software_version(), int(control.version.split("-")[-1]) + 1)
    control.save_control_to_wapt()
    print("Changing version to: %s in WAPT\\control" % control.version)


def get_os_name():
    import platform

    return platform.system()


def update_control_version(version):
    control.version = "%s-%s" % (version, int(control.version.split("-")[-1]) + 1)
    control.save_control_to_wapt()


def json_load(json_file):
    with open(json_file) as read_file:
        data = json.load(read_file)
    return data


def json_write(json_file, data, sort_keys=True, indent=4):
    import codecs

    with codecs.open(json_file, "w", encoding="utf-8") as write_file:
        json.dump(data, write_file, sort_keys=sort_keys, indent=indent)

# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
from waptpackage import PackageEntry


def update_package():
    # Declaring local variables
    package_updated = False

    # Interact differently with Luti
    if params.get("running_as_luti"):
        return "OK"
    

    # Set up my "my_bitwarden_server" in the package
    my_bitwarden_server = ""
    with open("setup.py", "r", encoding="utf8") as f:
        for line in f.readlines():
            if line.startswith("my_bitwarden_server"):
                my_bitwarden_server = line.split("=")[1].split('"')[1]
                break 
    old_my_bitwarden_server = my_bitwarden_server

    ask_input(
        control.package,
        "Please enter the URL address of the Bitwarden server associated with your configuration",
        my_bitwarden_server,
        raise_error=True,
    )

    # Updating setup.py my_bitwarden_server variable
    new_lines = []
    with open("setup.py", "r", encoding="utf8") as f:
        for line in f.readlines():
            if line.startswith("tis-bitwarden-config-template"):
                line = 'tis-bitwarden-config-template = "%s"\n' % tis - bitwarden - config - template
            new_lines.append(line)
    with open("setup.py", "w", encoding="utf8", newline="\n") as f:
        f.writelines(new_lines)

    # Renaming package
    if "template" in control.package:
        complete_control_package(control)
        complete_control_name(control)
        if "template" in control.package:
            error("Please rename the package.")
        else:
            version = str(int(control.get_software_version()) + 1)
        ask_message(
            control.package,
            "Please note that you will still need to edit this package to apply your own configuration that is compliant with your company's internal policies. You are sole responsible for the use of this package on your network.",
            48,
        )
    else:
        version = str(int(control.get_software_version()))

    # Changing version of the package
    if Version(version, 4) > Version(control.get_software_version(), 4):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        package_updated = True
    else:
        print("Software version up-to-date (%s)" % Version(version))
    control.set_software_version(version)
    control.save_control_to_wapt()

    # Validating or not update-package-sources
    return package_updated

d5c8d4bd1e497000b7ca7df406a33f58a69b2b497fcbbd72c6a360d51712f5fa : setup.py
2ff8ad70dccf4412b87f8bdc7ebd78c15fe01512db1d20fa60dc9b8948f6c810 : update_package.py
1267028732396572ee412cdf3170ab896a2bd43f6c75ba8a3a7b1597135b90bc : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
0d62cb9fdc0cc2dea5a06bf27c0353d503a7903194252b60be5084a6332aefeb : luti.json
d8f848d9d6e32ce9d61c21cacaa1e20bac100ab7988a089732ab168b8c1dc87a : WAPT/control