tis-remote-repo-tftp icon

Remote Repository TFTP

Paquet d'installation silencieuse pour Remote Repository TFTP

2.6.1.17834-2
System and network
System and network

Les paquets PREPROD sont des paquets construits via LUTI. Ils restent généralement 5 jours en PREPROD, après quoi un deuxième scan VirusTotal est effectué pour vérifier que le status n'a pas changé.
Si le paquet réussit ce dernier contrôle, il est promu en PROD et publié sur le store.

  • package: tis-remote-repo-tftp
  • name: Remote Repository TFTP
  • version: 2.6.1.17834-2
  • categories: System and network
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ,Ingrid TALBOT
  • locale: all
  • target_os: windows
  • architecture: x64
  • signature_date:
  • size: 2.58 Mo
  • homepage : https://www.wapt.fr/en/doc/wapt-wads

package           : tis-remote-repo-tftp
version           : 2.6.1.17834-2
architecture      : x64
section           : base
priority          : optional
name              : Remote Repository TFTP
categories        : System and network
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ,Ingrid TALBOT
description       : Package for installing WaptTFTPServer for remote repositories agents
depends           : 
conflicts         : 
maturity          : PREPROD
locale            : all
target_os         : windows
min_wapt_version  : 2.3
sources           : 
installed_size    : 
impacted_process  : 
description_fr    : Paquet pour l'installation de WaptTFTPServer pour les agents de dépôts distants
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : 
keywords          : tftp,wapt
licence           : 
homepage          : https://www.wapt.fr/en/doc/wapt-wads
package_uuid      : 148eb105-065e-4e39-bfdd-3cfc293abcfa
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 29f1849f2f6845086ee6dd95bcaeae5cb0438ab7435b1af6d30d57f520a5cfe3
signer            : test
signer_fingerprint: b82fc8ef4a4475c0f69ac168176c2bfc58f572eb716c4eadd65e4785c155dd8e
signature_date    : 2026-08-14T07:54:27.000000
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
signature         : dCqda6jiY8z6Mh4PIMyoY+zFw7ia4ilgKv4vcuWXJktvYnaaiEMtBI/Pk0A387RR7JKOSuHtF9/wfWe2G464V+RGSOOIBVVIP6MegesBQDZ/2mAf3Zl1GgibU5dBz1jel8DmRUjJXElNG6V49T8yeNKgba+aYKaBoGUTscD8ArDUVttYwuKS5NtfKYxcMwN1SmSWMYCX1T0zgWiFY05KUyX1N8lJL4NOTOaIiXLOAnSCimDMquSJoy/M2fyIpT92+TfzEcprx/H6AIL9gboCRtOSD+CwkNhPmBKBXIUhnYX7JFuoVcyAF9BLg2QoDXkFreAVzmWh2HBSWkn2hOoEqg==

# -*- coding: utf-8 -*-

from setuphelpers import *

import psutil

bin_name = "wapttftpserver.exe"
service_name = "WaptTFTPServer"


def install():
    check_tftp_available()
    tftp_bin = os.path.join(WAPT.wapt_base_dir, bin_name)
    if service_installed(service_name):
        uninstall()
    killalltasks(bin_name)
    filecopyto(bin_name, tftp_bin)

    print("Apply WaptTFTPServer config")
    repo_path = inifile_readstring(WAPT.config_filename, "repo-sync", "local_repo_path") or makepath(WAPT.wapt_base_dir, "repository")
    tftp_path = makepath(repo_path, "wads", "pxe")
    mkdirs(tftp_path)
    server_conf_dir = makepath(WAPT.wapt_base_dir, "conf")
    server_ini = makepath(server_conf_dir, "waptserver.ini")
    mkdirs(server_conf_dir)
    inifile_writestring(server_ini, "tftpserver", "service_name", service_name)
    inifile_writestring(server_ini, "tftpserver", "root_dir", tftp_path)

    print("Add WaptTFTPServer firewall rule")
    run(f'netsh advfirewall firewall add rule name="{service_name}" dir=in action=allow program="{tftp_bin}" enable=yes')

    print("Create WaptTFTPServer service")
    if not service_installed(service_name):
        # run(rf'"{tftp_bin}" /install --service_name={service_name} --root_dir="{tftp_path}"')
        print(run(rf'"{tftp_bin}" --install'))
    if not service_is_running(service_name):
        service_start(service_name)
        
def audit():
    """
    Vérifie que tous les composants nécessaires pour WaptTFTPServer sont présents
    et correctement configurés.
    """
    errors = []

    # 1. Vérification du binaire principal
    tftp_bin = os.path.join(WAPT.wapt_base_dir, bin_name)
    if not isfile(tftp_bin):
        errors.append(f"Binaire manquant: {tftp_bin}")

    # 2. Vérification du répertoire de configuration
    server_conf_dir = makepath(WAPT.wapt_base_dir, "conf")
    if not isdir(server_conf_dir):
        errors.append(f"Répertoire de configuration manquant: {server_conf_dir}")

    # 3. Vérification du fichier de configuration
    server_ini = makepath(server_conf_dir, "waptserver.ini")
    if not isfile(server_ini):
        errors.append(f"Fichier de configuration manquant: {server_ini}")
    else:
        # Vérification des paramètres dans le fichier ini
        configured_service = inifile_readstring(server_ini, "tftpserver", "service_name")
        if not configured_service:
            errors.append(f"Paramètre 'service_name' manquant dans: {server_ini}")

        configured_root = inifile_readstring(server_ini, "tftpserver", "root_dir")
        if not configured_root:
            errors.append(f"Paramètre 'root_dir' manquant dans: {server_ini}")
        elif not isdir(configured_root):
            errors.append(f"Répertoire TFTP root manquant: {configured_root}")

    # 4. Vérification du répertoire TFTP
    repo_path = inifile_readstring(WAPT.config_filename, "repo-sync", "local_repo_path") or makepath(WAPT.wapt_base_dir, "repository")
    tftp_path = makepath(repo_path, "wads", "pxe")
    if not isdir(tftp_path):
        errors.append(f"Répertoire TFTP manquant: {tftp_path}")

    # 5. Vérification du service Windows
    if not service_installed(service_name):
        errors.append(f"Service Windows non installé: {service_name}")
    elif not service_is_running(service_name):
        errors.append(f"Service Windows non démarré: {service_name}")

    # Retour du résultat
    if errors:
        error_msg = "Erreurs détectées:\n" + "\n".join(f"  - {err}" for err in errors)
        print(error_msg)
        return "ERROR"
    else:
        return "OK"

def uninstall():
    tftp_bin = os.path.join(WAPT.wapt_base_dir, bin_name)
    server_conf_dir = makepath(WAPT.wapt_base_dir, "conf")

    print("Remove WaptTFTPServer service")
    if service_installed(service_name):
        if service_is_running(service_name):
            service_stop(service_name)
        print(run(rf'"{tftp_bin}" --uninstall'))

    print("Remove WaptTFTPServer firewall rule")
    run(f'netsh advfirewall firewall delete rule name="{service_name}" program="{tftp_bin}"')

    remove_file(tftp_bin)
    if len(glob.glob(server_conf_dir + os.sep + "*")) <= 1:
        remove_tree(server_conf_dir)

def check_tftp_available():
    for conn in psutil.net_connections(kind='udp'):
        if conn.laddr and conn.laddr.port == 69:
            local_addr = f"{conn.laddr.ip}:{conn.laddr.port}"
            pid = conn.pid
            exe_name = "unknown"

            if pid:
                try:
                    proc = psutil.Process(pid)
                    exe_name = proc.name()
                except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
                    pass

            if exe_name != "wapttftpserver.exe":
                error(f"port 69 already being listened to by {exe_name}")

from setuphelpers import *


def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    download_url = "https://wapt.tranquil.it/wapt/releases/latest/bin/win64/wapttftpserver.exe"
    latest_bin = download_url.split("/")[-1]

    # Deleting binaries
    for f in glob.glob("*.exe") + glob.glob("*.msi"):
        print("Removing: %s" % f)
        remove_file(f)

    # Downloading latest binaries
    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)

    # Changing version of the package
    version = get_version_from_binary(latest_bin, "FileVersion")
    if Version(version) > Version(control.get_software_version()):
        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

01ca7fe94636e5a08fcb73849d3b5df25d51e2c82f4dd1a08f01798b25899819 : WAPT/certificate.crt
0db5c7cd2f4a531585a45ab23d83aac5ec7fe73624a1cbc3a1eb790ccb427c00 : WAPT/control
29f1849f2f6845086ee6dd95bcaeae5cb0438ab7435b1af6d30d57f520a5cfe3 : WAPT/icon.png
d2f7d5e89160b77e38cf2c1c5fb9001a5b4b87b2c0a3b1316391836787a4f36a : luti.json
b5bb3263207e5e644c014282d06c5c9773d0b515734d3374170201a90fd08d09 : setup.py
27d1c4fab224fdf66f728ab34aa7636dfd7fb5cab01c009f0613731e48e7c256 : update_package.py
1782dc66d69cec2f7e5d5edce04cdf5ef1c1186b43741345d0efd7e727640f19 : wapttftpserver.exe