tis-encrypt-sample icon

Encrypt Sample

Paquet d’installation silencieuse pour Encrypt Sample

0.2-0

  • package: tis-encrypt-sample
  • name: Encrypt Sample
  • version: 0.2-0
  • categories: Template,Security
  • maintainer: Tranquil IT
  • target_os: all
  • architecture: all
  • signature_date:
  • size: 5.75 Ko

package           : tis-encrypt-sample
version           : 0.2-0
architecture      : all
section           : base
priority          : optional
name              : Encrypt Sample
categories        : Template,Security
maintainer        : Tranquil IT
description       : Encrypt Sample Example
depends           : 
conflicts         : 
maturity          : PROD
locale            : 
target_os         : all
min_wapt_version  : 2.2
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      : 629f120b-b508-4d7d-8827-6d128538b068
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 9420721210f5d9c50c9e35c9fdbf0a088b30e165df8311c5f2176ce60e122475
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : g9ytdpnmMGM9MGXKVYA02VsGILUO3Qr0vI0mtCycwNTZKPlwWqfHUYTx9w1VS+i1bRYHoYh25pAJxDQVQqybBgmRJzXSvaooD4hnzP27KEDcN0C7NzlguFs+XL62hMaLScywnO3h8QEF14Q+92KfTQ2kaSiIpYyV4ydx84b6HJ8SdwZcGLUnYCTFqk850gm35gkbGNjeAK7LNmeH9Hl53c1CJKUiWoZDOP7zlAHbhDw+WEVgWVbyKYmnVPPdbEaBEH/k5sfosVGyhtPw2M+azcLDH6S9/vbS8RzzYvF1X9p8m3bJ6PhLjeK42pxHL03uivEC01slhJPMaE01LRyRNQ==
signature_date    : 2024-03-11T12:00:07.074212
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
import base64

encrypted_txt_file = "encrypted_txt.json"


def install():
    encryptlist = json_load_file(encrypted_txt_file)
    if WAPT.host_uuid in encryptlist:
        host_key = WAPT.get_host_key()
        v = base64.b64decode(encryptlist[WAPT.host_uuid])
        encrypted_txt = host_key.decrypt(v).decode("utf-8")
        print(rf"Here is the decrypted text: {encrypted_txt}")
    else:
        error(f"{WAPT.host_uuid} not found in {encrypted_txt_file}\nYou have to update-package and build_upload this package again")

# -*- coding: utf-8 -*-
from setuphelpers import *
import json
import base64
from waptcrypto import SSLCertificate
import waptguihelper
from common import WaptServer

encrypted_txt_file = "encrypted_txt.json"


def update_package():
    srvwapt_url = inifile_readstring(makepath(install_location("WAPT_is1"), "wapt-get.ini"), "global", "wapt_server")

    credentials_url = waptguihelper.login_password_dialog("Credentials for WAPT Server", srvwapt_url, "admin", "")

    WAPT.waptserver.post('api/v3/login' ,data=json.dumps({'user': credentials_url["user"], 'password':credentials_url["password"]}))

    encrypt_txt = waptguihelper.input_dialog("Encrypting with WAPT", "Enter the text to be encrypted: ", "")
    if not encrypt_txt:
        error("Please provide text to be encrypted")

    data = WAPT.waptserver.get("api/v3/hosts?columns=host_certificate&limit=1000000")["result"]

    encrypt_dict={}
    for value in data:
        if value["host_certificate"]:
            host_cert = SSLCertificate(crt_string=value["host_certificate"])
            encrypt_dict[value["uuid"]] = base64.b64encode(host_cert.encrypt(encrypt_txt.encode("utf-8"))).decode("utf-8")
            print(value["computer_fqdn"] + ":" + value["uuid"] + ":" + encrypt_dict[value["uuid"]])

    json_write_file(encrypted_txt_file, encrypt_dict)

070954ecdfe2ddcbf17df698c5930892d46e2d47f7d803f752b8e361b6298e82 : setup.py
c97c68980c9001c4b8ebb5fa10dfadbf199f82014206dad44f0166141de2e6a9 : update_package.py
9420721210f5d9c50c9e35c9fdbf0a088b30e165df8311c5f2176ce60e122475 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
a55bce9922684125cbe30bdf393b9fcad5ae88c6c1b9ce98ad0e334181e6ee80 : luti.json
f3bdc6f18dca321e7746738ecf9ae91a692a0948a8209f703e2c955f84b56933 : WAPT/control