tis-encrypt-sample icon

Encrypt Sample

Paquet d’installation silencieuse pour Encrypt Sample

0.1-2

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

package           : tis-encrypt-sample
version           : 0.1-2
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      : 6e06d225-ca0e-4105-8b80-67e073d44125
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 9420721210f5d9c50c9e35c9fdbf0a088b30e165df8311c5f2176ce60e122475
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : U+Z/K1kEw4Lv5SSfsY3SHF6VY+4MnkUiKPtFCqn6nJMyLecepxFKxoAATaA9bwZbz3lj6dgUtXw3FmN30p9eQCld81h3iUjuhPzwK1HxQzCW46FocUZTWa+QsI8mhBeIG1AoUYvCI5KNGkNrq1gwXcceOqCoWXJXZZemRBU7NIr6/gPXZnazCR3nQP7bDhZRuJ00HyYx4u5/Z1kn7EdRWLNFKHQ4yuKB5Y+sCgjO9rFUWmkJudSbWY7RXlJnA9L/BVsw2xuE8I3S4594iouIYFYPF1TUovjwGSuK2YXdzpON9ggRrkeJHCIboiPeuqTA2XchNfVCtPRFwiwgz3Xi0w==
signature_date    : 2023-06-23T18:00:11.975962
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")
    server = server = WaptServer()
    server.load_config_from_file(WAPT.config_filename)
    server.server_url = srvwapt_url

    credentials_url = waptguihelper.login_password_dialog("Credentials for WAPT Server", srvwapt_url, "admin", "")
    server.auth = lambda **kwargs: (credentials_url["user"], 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")
    encrypt_dict = {}
    # data = json.loads(
    #     wgets(
    #         "https://%s:%s@%s/api/v1/hosts?columns=host_certificate&limit=10000" % (credentials_url["user"], credentials_url["password"], srvwapt_url)
    #     )
    # )
    data = server.get("/api/v3/hosts?columns=host_certificate&limit=1000000")["result"]

    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
cd823c3df4ac8194b5483edbaec696ef6da3713f5162115d7a194ec35017a9a7 : update_package.py
9420721210f5d9c50c9e35c9fdbf0a088b30e165df8311c5f2176ce60e122475 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
f4deaa89e1426777a2f372b0bc591a7ed5ec36c5ae2fffc2d26b956032a97eb7 : luti.json
68870e54d97bfe8cd5852c831e1e7a9158281a84e30db591abf17a1295c5b555 : WAPT/control