tis-dsinternals icon

DSInternals

Paquet d’installation silencieuse pour DSInternals

4.9-0
Utilities
Utilities

  • package: tis-dsinternals
  • name: DSInternals
  • version: 4.9-0
  • categories: Utilities
  • maintainer: WAPT Team,Tranquil IT,Clément Baziret
  • licence: opensource_free,wapt_public
  • locale: all
  • target_os: windows
  • architecture: all
  • signature_date:
  • size: 1.63 Mo
  • homepage : https://github.com/MichaelGrafnetter/DSInternals/
  • depends:

package           : tis-dsinternals
version           : 4.9-0
architecture      : all
section           : base
priority          : optional
name              : DSInternals
categories        : Utilities
maintainer        : WAPT Team,Tranquil IT,Clément Baziret
description       : The DSInternals PowerShell Module exposes several internal features of Active Directory and Azure Active Directory
depends           : tis-powershell
conflicts         : 
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.3
sources           : https://github.com/MichaelGrafnetter/DSInternals/
installed_size    : 
impacted_process  : 
description_fr    : Le module PowerShell DSInternals expose plusieurs fonctionnalités internes d'Active Directory et d'Azure Active Directory
description_pl    : Moduł PowerShell DSInternals udostępnia kilka wewnętrznych funkcji Active Directory i Azure Active Directory
description_de    : Das DSInternals PowerShell-Modul macht mehrere interne Funktionen von Active Directory und Azure Active Directory zugänglich
description_es    : El módulo PowerShell de DSInternals expone varias características internas de Active Directory y Azure Active Directory
description_pt    : O Módulo PowerShell DSInternals expõe várias funcionalidades internas do Active Directory e do Azure Active Directory
description_it    : Il modulo PowerShell DSInternals espone diverse funzionalità interne di Active Directory e Azure Active Directory
description_nl    : De DSInternals PowerShell-module legt verschillende interne functies van Active Directory en Azure Active Directory bloot
description_ru    : Модуль DSInternals PowerShell раскрывает несколько внутренних возможностей Active Directory и Azure Active Directory
audit_schedule    : 
editor            : 
keywords          : dsinternals,powershell,module,exposes,several,internal,features,active,directory,azure,active,directory
licence           : opensource_free,wapt_public
homepage          : https://github.com/MichaelGrafnetter/DSInternals/
package_uuid      : c561a523-4825-41c7-a836-2d7582d11453
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://github.com/MichaelGrafnetter/DSInternals/releases
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 8f14830d6e9a8d005ea600473e5ecfdd3c7dbb6b0899a44e8f1d040a6b1f7162
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : MW5xFEtOcP/p6p5N7XZIuc0lxVE+aWnJEfZUNN4wYA7rPXRkoSnNOBg2TZUx2WdDeuppHv50YDgCKc9dm4WCW47uFDmxGmxmBRW5QXvB7SRUt8YuLp/v3HDEdY2CYhi2FedantriQ0sl4Mmaj/n9HCQ3sed3AgNDaUtMZqCz9GRvlzQMmkMDu+YNtdBm9EpkekOCmKZTjWvw4zE7JAlFLKp2p8Q1MxpMlRpKH3UxdR3MKI1NZOjbH68fP3WpEolSo0baY5cqPothw43+KN74sHB3TzcQNeKklwqXE3mAwY/8bNzdDWfE5LhyVKhkrAFYuYP6dkyl3lgP9ziB1Wy0yQ==
signature_date    : 2023-09-02T18:00:11.644610
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
import shutil


app_name = "DSInternals"
app_dir = makepath(system32(), "WindowsPowerShell", "v1.0", "Modules", app_name)


def install():
    # Declaring local variables
    package_version = control.get_software_version()
    zip_name = glob.glob(app_name + "*.zip")[0]

    # killalltasks(ensure_list(control.impacted_process))
    print("Installing: %s (%s)" % (app_name, control.get_software_version()))
    if isdir(app_dir):
        remove_tree(app_dir)
    mkdirs(app_dir)

    # unziping archive and moving it to powershell modules folder
    print("Extracting: %s to: %s" % (zip_name, app_dir))
    unzipped_dir = zip_name.rsplit(".", 1)[0]
    unzip(zip_name, unzipped_dir)
    move_directory(makepath(unzipped_dir, app_name), app_dir)
    remove_tree(unzipped_dir)


def audit():
    # Declaring local variables
    package_version = control.get_software_version()

    if not isdir(app_dir):
        print("%s is not installed" % app_name)
        return "ERROR"

    result = run_powershell("Get-Module -ListAvailable -Name %s" % app_name)
    if not app_name in result["Name"]:
        print("%s is not installed" % app_name)
        return "ERROR"
    version = "%s.%s" % (result["Version"]["Major"], result["Version"]["Minor"])
    if Version(package_version) != Version(version):
        print("%s is installed but not up-to-date" % app_name)
        return "WARNING"

    # if everything is OK :
    print("%s (%s) is installed" % (app_name, package_version))
    return "OK"


def uninstall():
    # Uninstalling software
    # killalltasks(ensure_list(control.impacted_process))
    if isdir(app_dir):
        remove_tree(app_dir)


def move_directory(source, destination):
    """
    Moves a directory safely, avoiding unnecessary subfolders.

    Args:
        source (str): The path of the directory to move.
        destination (str): The destination path where the directory will be moved to.

    Returns:
        bool: True if the directory was successfully moved, False otherwise.
    """
    try:
        if not os.path.exists(destination):
            os.makedirs(destination)

        for item in os.listdir(source):
            item_path = os.path.join(source, item)
            if os.path.isfile(item_path):
                shutil.move(item_path, destination)
            elif os.path.isdir(item_path):
                new_destination = os.path.join(destination, item)
                move_directory(item_path, new_destination)

        os.rmdir(source)
        return True
    except Exception as e:
        print(f"ERROR: {e}")
        return False

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


def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    api_url = "https://api.github.com/repos/MichaelGrafnetter/DSInternals/releases/latest"

    # Getting latest version information from official sources
    print("API used is: %s" % api_url)
    json_load = wgets(api_url, proxies=proxies, as_json=True)
    version = json_load["tag_name"].replace("v", "")
    for to_download in json_load["assets"]:
        if "DSInternals" in to_download["name"] and ".zip" in to_download["name"]:
            download_url = to_download["browser_download_url"]
            latest_bin = to_download["name"]
            break

    # Downloading latest binaries
    print("Latest %s version is: %s" % (control.name, version))
    print("Download URL is: %s" % download_url)
    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies)
    else:
        print("Binary is present: %s" % latest_bin)

    # Deleting outdated binaries
    remove_outdated_binaries(latest_bin)

    # 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 update-package-sources
    return package_updated

5734216e4ec5629955223a2a7e29f9fa57c7dc533f7e418444ecbd1a3386d9c8 : DSInternals_v4.9.zip
0c3fb7c5ffa0fb31f933e45c42bf98359d64e88e0ebdd6809e49ee6fa1d09032 : setup.py
8de655386ae3cea23e8151f9432ea7577df95bc95fddeb2bf7765fbad2ba17d7 : update_package.py
8f14830d6e9a8d005ea600473e5ecfdd3c7dbb6b0899a44e8f1d040a6b1f7162 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
7064f09325592617616160264754eca816c2cf6d1d2654cbe15ea875e5ba9d6f : luti.json
dffee6ec8ed3b044aa0078a5472c927080e0f326f5965f97cf512515014160c2 : WAPT/control