tis-adobe-acrobat-config-template

0-0
366 downloads
Download
See build result See VirusTotal scan
tis-adobe-acrobat-config-template icon
  • package : tis-adobe-acrobat-config-template
  • name : Adobe Acrobat Configuration Template
  • version : 0-0
  • categories : Configuration
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
  • editor :
  • licence :
  • locale :
  • target_os : windows
  • impacted_process :
  • architecture : all
  • signature_date : 2023-12-15 16:00
  • size : 8.56 Ko
package           : tis-adobe-acrobat-config-template
version           : 0-0
architecture      : all
section           : base
priority          : optional
name              : Adobe Acrobat Configuration Template
categories        : Configuration
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
description       : 
depends           : 
conflicts         : 
maturity          : PROD
locale            : 
target_os         : windows
min_wapt_version  : 2.3
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      : 37b54c9a-60e5-4ae6-8a59-86d4c0906252
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : e08ef23b951752553b93f621e169cbb918ded4eb56c504ed32f7da48d7e31b7c
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : sYaGMt5GilAzOluu/A84tZv9IuojcK5a5/eZtrreohYXvzJOTo9z/QatR6fPYnRbYBHZD4PMX0aV8Rw0+R3/P0VY7+aCWfmTV6Gx0ZP0pATumjyS8cAU5chCD0+x/d6innaOYo7NrWNiAf52pv4WT4X4o4k8vipSzAosLXQcCrk6wOVOMI9ByG/SMNvwz/mzcHfTPUqZWk90YoDpKG6xv1r0v6tutMpCNeO74AHJwyCCD13rKer6tNDve7bgk/oL3Jl8tXCqyXEx8ecqpquBxOGPF0sFVXluDFT6Hn/nkL7zoJR8HsJT7ZpBHblLC+TY9CuU2Mf5Kjazh902C8HN5A==
signature_date    : 2023-12-15T16:00:05.959248
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 os


r"""
https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/AVGeneral.html
https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/FeatureLockDown.html

"""
adobe_arm_registry_dict = {
    r"ARM\iCheck": 0,  # https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/Updater-Win.html#idkeyname_1_30198
    r"ARM\iCheckReader": 0,
    r"ARM\iDisablePromptForUpgrade": 1,
}
adobe_acrobat_registry_dict = {
    r"FeatureLockDown\bUpdateToSingleApp": 0,  # https://helpx.adobe.com/acrobat/kb/about-acrobat-reader-dc-migration-to-64-bit.html
    r"FeatureLockDown\bUpdater": 0,  # https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/FeatureLockDown.html#idkeyname_1_9111
    r"FeatureLockDown\bUsageMeasurement": 0,
    # r"FeatureLockDown\bSuppressSignOut": 1,
    r"FeatureLockDown\bToggleFTE": 1,
    r"FeatureLockDown\bAcroSuppressUpsell": 1,
    r"FeatureLockDown\cWelcomeScreen\bShowWelcomeScreen": 0,
    r"FeatureLockDown\cCloud\bEnableAcrobatHS": 0,
    r"FeatureLockDown\cServices\bUpdater": 0,
    r"FeatureLockDown\cServices\bToggleAdobeDocumentServices": 1,
    r"FeatureLockDown\cServices\bToggleWebConnectors": 1,  # https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/FeatureLockDown.html#idkeyname_1_9878
    r"FeatureLockDown\cServices\bToggleSendAndTrack": 1,
    # r"FeatureLockDown\cServices\bTogglePrefsSync": 1,
    # r"FeatureLockDown\cServices\bToggleFillSign": 1,
    r"FeatureLockDown\cServices\bToggleWebConnectors": 1,
}
adobe_acrobat_user_registry_dict = {
    r"Originals\iDefaultZoomScale": 10000,  # Zoom 100% by default (https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/Originals.html#idkeyname_1_17361)
    r"AVGeneral\cOnboardingContextual\bIsUsedShareReview": 1,  # https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/AVGeneral.html#idkeyname_1_5265
    r"AVTracker\bLoadOnStart": 1,  # https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Macintosh/AVTracker.html?zoom_highlight=AdobeCollabSync.exe#TrackerConfiguration
    r"Access\bOverridePageLayout": 1,
    r"Access\bOverrideZoom": 1,
    r"Access\iZoomType": 0,
}


def install():
    # Checking if application is installed
    app_check = installed_softwares("Adobe Acrobat ")
    if not app_check:
        error('Adobe Acrobat is not installed. You may want to install "tis-adobereader" or "tis-adobe-acrobat-pro".')
    else:
        is_win64_app = app_check[0]["win64"]

    # Disabling automatic updates, telemetry and intrusive services
    if iswin64() and is_win64_app:
        # 64bit PC and app
        for reg_path, reg_value in adobe_arm_registry_dict.items():
            reg_short_path = reg_path.rsplit(os.sep, 1)[0]
            keyname = reg_path.rsplit(os.sep, 1)[-1]
            registry_set(HKEY_LOCAL_MACHINE, rf"SOFTWARE\Adobe\Adobe ARM\1.0\{reg_short_path}", keyname, reg_value)
        for reg_path, reg_value in adobe_acrobat_registry_dict.items():
            reg_short_path = reg_path.rsplit(os.sep, 1)[0]
            keyname = reg_path.rsplit(os.sep, 1)[-1]
            registry_set(HKEY_LOCAL_MACHINE, rf"SOFTWARE\Policies\Adobe\Adobe Acrobat\DC\{reg_short_path}", keyname, reg_value)
    elif iswin64() and not is_win64_app:
        # 64bit PC but 32bit app
        for reg_path, reg_value in adobe_arm_registry_dict.items():
            reg_short_path = reg_path.rsplit(os.sep, 1)[0]
            keyname = reg_path.rsplit(os.sep, 1)[-1]
            registry_set(HKEY_LOCAL_MACHINE, rf"SOFTWARE\Wow6432Node\Adobe\Adobe ARM\1.0\{reg_short_path}", keyname, reg_value)
        for reg_path, reg_value in adobe_acrobat_registry_dict.items():
            reg_short_path = reg_path.rsplit(os.sep, 1)[0]
            keyname = reg_path.rsplit(os.sep, 1)[-1]
            registry_set(HKEY_LOCAL_MACHINE, rf"SOFTWARE\Wow6432Node\Policies\Adobe\Acrobat Reader\DC\{reg_short_path}", keyname, reg_value)
    else:
        # 32bit PC
        for reg_path, reg_value in adobe_arm_registry_dict.items():
            reg_short_path = reg_path.rsplit(os.sep, 1)[0]
            keyname = reg_path.rsplit(os.sep, 1)[-1]
            registry_set(HKEY_LOCAL_MACHINE, rf"SOFTWARE\Adobe\Adobe ARM\1.0\{reg_short_path}", keyname, reg_value)
        for reg_path, reg_value in adobe_acrobat_registry_dict.items():
            reg_short_path = reg_path.rsplit(os.sep, 1)[0]
            keyname = reg_path.rsplit(os.sep, 1)[-1]
            registry_set(HKEY_LOCAL_MACHINE, rf"SOFTWARE\Policies\Adobe\Acrobat Reader\DC\{reg_short_path}", keyname, reg_value)


def session_setup():
    is_win64_app = installed_softwares("Adobe Acrobat ")[0]["win64"]
    if is_win64_app:
        # registry_deletekey(HKEY_CURRENT_USER, r"Software\Adobe", "Acrobat Reader")
        for reg_path, reg_value in adobe_acrobat_user_registry_dict.items():
            reg_short_path = reg_path.rsplit(os.sep, 1)[0]
            keyname = reg_path.rsplit(os.sep, 1)[-1]
            registry_set(HKEY_CURRENT_USER, rf"Software\Adobe\Adobe Acrobat\DC\{reg_short_path}", keyname, reg_value)
    else:
        # registry_deletekey(HKEY_CURRENT_USER, r"Software\Adobe", "Adobe Acrobat")
        for reg_path, reg_value in adobe_acrobat_user_registry_dict.items():
            reg_short_path = reg_path.rsplit(os.sep, 1)[0]
            keyname = reg_path.rsplit(os.sep, 1)[-1]
            registry_set(HKEY_CURRENT_USER, rf"Software\Adobe\Acrobat Reader\DC\{reg_short_path}", keyname, reg_value)


def uninstall():
    registry_deletekey(HKEY_LOCAL_MACHINE, r"SOFTWARE\Adobe\Adobe ARM\1.0", "ARM")
    registry_deletekey(HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Adobe\Adobe ARM\1.0", "ARM")
    registry_deletekey(HKEY_LOCAL_MACHINE, r"SOFTWARE\Policies\Adobe\Adobe Acrobat\DC", "FeatureLockDown")
    registry_deletekey(HKEY_LOCAL_MACHINE, r"SOFTWARE\Policies\Adobe\Acrobat Reader\DC", "FeatureLockDown")
    registry_deletekey(HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Policies\Adobe\Acrobat Reader\DC", "FeatureLockDown")
# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
from waptpackage import PackageEntry


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

    # 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 reponsible 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


def ask_message(
    title,
    text,
    flags=None,
    raise_error=False,
):
    """
    Opens a message box with customizable buttons and icons.

    Args:
        title (str): The title to display in the message box.
        text (str): The message text to display in the message box.
        flags (int): Options for buttons and icons. You can combine a message and an icon by adding their corresponding
            integer values together. Possible message options:
            - MB_OK (0): OK button
            - MB_OKCANCEL (1): OK and Cancel buttons
            - MB_ABORTRETRYIGNORE (2): Abort, Retry, and Ignore buttons
            - MB_YESNOCANCEL (3): Yes, No, and Cancel buttons
            - MB_YESNO (4): Yes and No buttons

            Possible icon options:
            - MB_ICONERROR (16): Error icon
            - MB_ICONQUESTION (32): Question icon
            - MB_ICONWARNING (48): Warning icon
            - MB_ICONINFORMATION (64): Information icon

            To combine a message and an icon, add their integer values together. For example, to display an OK button
            with an information icon, use: 0 + 64 (MB_OK + MB_ICONINFORMATION).

            Note: For more details and additional options, refer to the documentation at:
            https://www.functionx.com/delphi/msgboxes/messagebox.htm

        raise_error (bool): Whether to raise an error if no response is given by the user.

    Returns:
        The response code indicating the user's choice. Possible return values:
        - ID_OK (1)
        - ID_CANCEL (2)
        - ID_ABORT (3)
        - ID_RETRY (4)
        - ID_IGNORE (5)
        - ID_YES (6)
        - ID_NO (7)
    """
    import waptguihelper

    if flags is None:
        flags = waptguihelper.MB_ICONINFORMATION + waptguihelper.MB_OK
    response = waptguihelper.message_dialog(title, text, flags)
    if not response or response in (2, 3, 4) and raise_error:
        raise ValueError("No response given by the user")
    return response


def complete_control_package(control, control_package="", silent=False, remove_template_base_files=False):
    """Requesting that the user provide a package name to be entered into the control.package field, and offering the possibility of removing the base files (icon.png and changelog.txt) for template package usage

    Args:
        control (str or waptpackage.PackageEntry): The path of control file or his PackageEntry call
        control_package (str)   : Prefilled control_package (default: actual control_package)
        silent (bool)           : If True, no user input dialog will be displayed. (default: False)
        remove_template_base_files (bool): Removes base files if parameter is True and str("template") in control.package (default: False)
    """
    if not isinstance(control, PackageEntry):
        pkg_dir = convert_control_path_to_dir(control)
        control = PackageEntry().load_control_from_wapt(pkg_dir)

    old_control_package = control.package
    control_package = (
        control_package.lower()
        .replace("_", "-")
        .replace("~", "-")
        .replace(" ", "-")
        .replace("!", "")
        .replace("'", "")
        .replace("(", "")
        .replace(")", "")
    )
    control_package = "-".join([p.strip() for p in control_package.split("-") if p.strip()])
    if not control_package:
        control_package = control.package

    # Removing template files
    if "template" in control.package.lower() and remove_template_base_files:
        if isfile("WAPT\\changelog.txt"):
            remove_file("WAPT\\changelog.txt")
        if isfile("WAPT\\icon.png"):
            remove_file("WAPT\\icon.png")

    if not silent:
        control_package = control_package.replace("-template", "").strip()
        control.package = ask_input(control.package, "You can redefine the package name", control_package)
        if not control.package:
            control.package = old_control_package

    control.save_control_to_wapt()
    return control.package


def complete_control_name(control, control_name="", silent=False):
    """Requesting that the user provide a package name to be entered into control.name field

    Args:
        control (str or waptpackage.PackageEntry): The path of control file or his PackageEntry call
        control_name (str)  : Prefilled control_name (default: control.name whitout "template" word)
        silent (bool)       : If True, no user input dialog will be displayed. (default: False)
    """
    if not isinstance(control, PackageEntry):
        pkg_dir = convert_control_path_to_dir(control)
        control = PackageEntry().load_control_from_wapt(pkg_dir)
    old_control_name = control.name
    if silent:
        control.name = control_name
    else:
        if not control_name:
            control_name = control.name
        control_name = control_name.replace("Template", "").replace("template", "").strip()
        control.name = ask_input(control.name, "You can redefine the name for the self-service", control_name)

    control.save_control_to_wapt()
    return control.name


def ask_input(title, text, default="", stay_on_top=False, raise_error=False):
    """
    Opens a dialog box with an action input.

    Args:
        title (str): The title for the dialog.
        text (str): Indicates which value the user should type.
        default (str): The default value if the user does not want to type anything.
        stay_on_top (bool): Indicates if the dialog box will always stay on top. Default is False.
        raise_error (bool): Whether to raise an error if no response is given by the user.

    Returns:
        The response from the dialog box.
    """
    import waptguihelper

    response = waptguihelper.input_dialog(title, text, default, stay_on_top)
    if not response and not response == "" and raise_error:
        error("No response given by user")
    return response
70609c11fdc5b7d5ba1f2c28070e62be56bdb32141392751fec2703507d7581d : setup.py
e6731988c6f5dbde163a2e4578e8eb1ab8980b5764f95bf1e278ca38da969e10 : update_package.py
e08ef23b951752553b93f621e169cbb918ded4eb56c504ed32f7da48d7e31b7c : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
246962dfbff0fce002e5952d853ccb615472a8d986715d7eacc38c920851b698 : luti.json
1752705f344d63faa1c5f79744ce8911b40672313479ed617120b38768a2e5d1 : WAPT/control