Creation du depot

This commit is contained in:
2024-03-11 10:16:21 +01:00
commit 48e6cae956
12 changed files with 910 additions and 0 deletions

2
.env Normal file
View File

@@ -0,0 +1,2 @@
VIRTUAL_ENV=C:\Program Files (x86)\wapt\
PYTHONPATH=C:\Program Files (x86)\wapt\

305
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,305 @@
{
"version": "0.2.4",
"configurations": [
{
"name": "WAPT: install",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "${config:python.wapt-get}",
"args": [
"install",
"--no-ide",
"${workspaceFolder}"
],
"console": "integratedTerminal",
"linux": {
"sudo": true
},
"osx": {
"sudo": true
},
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "WAPT: remove",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "${config:python.wapt-get}",
"args": [
"remove",
"--no-ide",
"${workspaceFolder}"
],
"console": "integratedTerminal",
"linux": {
"sudo": true
},
"osx": {
"sudo": true
},
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "WAPT: uninstall",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "${config:python.wapt-get}",
"args": [
"uninstall",
"--no-ide",
"${workspaceFolder}"
],
"console": "integratedTerminal",
"linux": {
"sudo": true
},
"osx": {
"sudo": true
},
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "WAPT: session-setup",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "${config:python.wapt-get}",
"args": [
"session-setup",
"--no-ide",
"${workspaceFolder}"
],
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "WAPT: audit",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "${config:python.wapt-get}",
"args": [
"audit",
"-f",
"--no-ide",
"${workspaceFolder}"
],
"console": "integratedTerminal",
"linux": {
"sudo": true
},
"osx": {
"sudo": true
},
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "WAPT: update-package",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "${config:python.wapt-get}",
"args": [
"update-package-sources",
"--no-ide",
"${workspaceFolder}"
],
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "WAPT: -i build-upload",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "${config:python.wapt-get}",
"args": [
"-i",
"--use-gui",
"build-upload",
"--no-ide",
"${workspaceFolder}"
],
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "WAPT: build-package",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "${config:python.wapt-get}",
"args": [
"build-package",
"--no-ide",
"${workspaceFolder}"
],
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: import setup.py",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_import_setup_template.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: import update_package.py",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_import_update_template.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: complete-package",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_complete_control.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: translate-control",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_translate_control.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: unify-control files",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_unify_control.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: duplicate-os-package-code",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_duplicate_os_package_code.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: duplicate update_package.py",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_duplicate_update_package.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: change luti.json",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/change_luti_json.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: import .gitignore",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_import_gitignore.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
},
{
"name": "DEV: quick testing",
"type": "python",
"request": "launch",
"justMyCode": false,
"program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_quick_testing.py",
"console": "integratedTerminal",
"python": "${command:python.interpreterPath}",
"pythonArgs": [
"-I",
"-B"
]
}
]
}

13
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"python.defaultInterpreterPath": "C:\\Program Files (x86)\\wapt\\waptpython.exe",
"python.pythonPath": "C:\\Program Files (x86)\\wapt\\waptpython.exe",
"python.wapt-get": "C:\\Program Files (x86)\\wapt\\wapt-get.py",
"python.formatting.provider": "black",
"python.formatting.blackArgs":
[
"--line-length",
"150"
],
"editor.insertSpaces": true,
"files.eol": "\n"
}

20
WAPT/certificate.crt Normal file
View File

@@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDNzCCAh+gAwIBAgIUSsaILn1scDCUhHvihORUTceVhO8wDQYJKoZIhvcNAQEL
BQAwJDELMAkGA1UEBhMCRlIxFTATBgNVBAMMDGdnZW5kcm9uX3BlbTAeFw0yMzEx
MDgwODM0MjhaFw0zMzExMDUwODM0MjhaMCQxCzAJBgNVBAYTAkZSMRUwEwYDVQQD
DAxnZ2VuZHJvbl9wZW0wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCj
Qt/K76QyhKl8ulRmnrCSRnD3UyHBmgAxSDml14sVxuyjVE+WW3umCqrJ2/QL2Sqy
DbxiBeexaaVSM15pKcsHQSGnCy762IjBhJIc9iW1QxNi1z/BivBVmAZRmM12IsKj
VeVs5oKpHjO5Uw2R+/MKkqg/9rNk3MQNA44YcFIz4RSfU5IElKU3CwzYFPwdRBSv
Sjf+onG4MkbEbL7B0axeMsKYZ2gxyuU9H73eUwWXgs2ICUu0wlyzKil1jJabKlEr
vREIvt+TL1hUFVLzbADgQPmZhCC2aylzdiYlwaKgNUmwEOip3JpZe0ay8XkIhH2O
H0i5RzPHD0FJae1Og9J7AgMBAAGjYTBfMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
BBYEFIJMVc1b++36XjWfjFhF+5AfxigaMA4GA1UdDwEB/wQEAwIB1jAdBgNVHSUE
FjAUBggrBgEFBQcDAgYIKwYBBQUHAwMwDQYJKoZIhvcNAQELBQADggEBAJkDZMAN
7aI3TPEXKAHWFBI25+CkV1OL+/NIhgdI3JVvu3rQ2iUcFS08+7rMa555OT3YjTFJ
4Cm0onhdXhVS0ENjvlfm2gWoD5t9SP9ZN4t1K19PDY6SCAqV79pYu2KfuHRXhmSZ
2p/tS1i01dkulJ49AKZNSp3BJ3xThL5oJHHOMgF5msRjZHBMRPsz3HgksaKzn3TE
fzyJ2/izHvTzllez7Ns90eVGPKMvZtZDSq+YpAhVSb6Fn46WVS2Z6Ce3GfRUiN6b
RJ4IQ6a+JhTgjJR6XJFQcmfDWFyzHjajd8OhbLuQjTIaiHyYcUNB9oZeyonMZ4ea
5MedsXgtUISHfhs=
-----END CERTIFICATE-----

44
WAPT/control Normal file
View File

@@ -0,0 +1,44 @@
package : comi-info-shutdown
version : 2.3-34
architecture : all
section : base
priority : optional
name : Shutdown Information
categories : Security
maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
description : Annoy user about how long their PC is on - Only work with WAPT Enterprise
depends :
conflicts :
maturity : PROD
locale : all
target_os : windows
min_wapt_version : 1.8.2
sources : Ennuyer l'utilisateur à propos de la durée d'allumage de son PC - Fonctionne seulement avec WAPT Enterprise
installed_size :
impacted_process :
description_fr : Gêne l'utilisateur quant à la durée d'utilisation de son PC - Ne fonctionne qu'avec WAPT Enterprise
description_pl : Denerwowanie użytkownika o tym, jak długo komputer jest włączony - Działa tylko z WAPT Enterprise
description_de : Verärgert den Benutzer darüber, wie lange sein PC eingeschaltet ist - Funktioniert nur mit WAPT Enterprise
description_es : Molestar al usuario sobre el tiempo que su PC está encendido - Sólo funciona con WAPT Enterprise
description_pt : Utilizador irritado sobre quanto tempo o seu PC está ligado - Trabalhar apenas com a WAPT Enterprise
description_it : Infastidisce l'utente per quanto tempo il suo PC rimane acceso - Funziona solo con WAPT Enterprise
description_nl : De gebruiker ergeren over hoe lang hun PC aanstaat - Werkt alleen met WAPT Enterprise
description_ru : Раздражает пользователя тем, как долго включен его компьютер - Работает только с WAPT Enterprise
audit_schedule : 3h
editor :
keywords :
licence :
homepage :
package_uuid : f6f50aa7-8c73-411b-bc14-12e9b8af4bee
valid_from :
valid_until :
forced_install_on :
changelog :
min_os_version :
max_os_version :
icon_sha256sum : d9bb8c943e30af428be08e0ba3175a9320c235be8a950e086203c89e0dbd106f
signer : ggendron_pem
signer_fingerprint: 244cdf15fa2ea3ead58e4abf232fdf9a30a8a28a798677f71d6a3e76e65f9003
signature : l6mpqV5G3SEmAE66Fhi0XBMedYpCCQNB5WzAFkz2Xi0aPAxt2MIeujcolMB4TQzM3jSD7cckoA6WIyjvAng+zIhy8ufCjFoPVHs7PxJY/SAXcZn/m0Z1kKLT2sA2JtuPNgTbZM+WXSnII0kOYisoE2y/+OzokhwNujboKAirBDhDRyNC3mbAZ94Rj6I/OGD+T0yKatR9XAidRulqzXen0PmFFljh3iCh5pglGIaS7u0Y6hILr9MZYRwNWsOTEMGktDUXIpZwneITUuyEJa2xtzEsmT5aoAH88dLcsWSNX2Dw2o+rFwvvVxpg/v4IXW334yhvNkA3uouUdvwQUZPy8w==
signature_date : 2024-01-29T15:40:10.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

BIN
WAPT/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

1
WAPT/manifest.sha256 Normal file
View File

@@ -0,0 +1 @@
[[".env","720b2be3b2d977425b68892f478262e7d3f764ca56c86e4d6aa2f639ea3dd214"],[".vscode/launch.json","7185f7797616d2fefe06cdb959ccb08bf0f677287a21aacc3111a65d4f072584"],[".vscode/settings.json","c4ef3e7d26642471ae3a2faaa131a40791fda1542ede085de266c5144adb2a3c"],["WAPT/certificate.crt","68194bca04eef7aaf4dc3c3bd12b017a1263bb5fcc034919fc7edda0c62db266"],["WAPT/control","3f8bc7b84f5615f840d21655e61f168d6ac86b60edcd93550a41fb5924fecdf8"],["WAPT/icon.png","d9bb8c943e30af428be08e0ba3175a9320c235be8a950e086203c89e0dbd106f"],["WAPT/wapt.psproj","c6246be77fa0d87cb8860fc9de433dfc02b56edaaca368712d5b6267141eeee4"],["__pycache__",""],["luti.json","09d2f4027795afcd146d3f63b7f34c148a358dc6b56d13f841d3c7f2c13b0974"],["setup.py","461c3e7f78fa47f31a1ef5814389534bba2f7f00fa3e348679922bdcf034f5e2"],["update_package.py","6dd3910b425b4e96407e01cdbd81f79547bd05c74a2d6aa267ff8f558ed403fd"]]

1
WAPT/signature.sha256 Normal file
View File

@@ -0,0 +1 @@
m5vuWf94oPHDXbUYsL32bTvpuvuh6csGm6NfKQUffcFqcaZtF2oqIuftz2AEvO7DpIkZgLNoUcIX4Pbng/PBCQk+smW15ZGLVo+GZWJV7I90CQFx+28+3WHmTjimxgbokTWf/f3GJv57rnshVhzvQImnHU4VvRAe2bC7bn1eRcrh+gT4tqjz2JU6AhkmBmeNRN+unDoC9VzV/bMEpKtvhafyeDOu4CW6atMTP+lVgFzk6JdIleYNfYvHUuauNaS2F/h4aiZCXaXWy8fnwMR1Jai+4Rq1+huxr7mIxSjA/ptrPHE74iAbafrLMp9YUvXWmne4/pxYfRUZSB3WBDGeKw==

235
WAPT/wapt.psproj Normal file
View File

@@ -0,0 +1,235 @@
[PyScripter]
Version=3.6.4.0
[Project]
ClassName=TProjectRootNode
StoreRelativePaths=TRUE
ShowFileExtensions=FALSE
[Project\ChildNodes\Node0]
ClassName=TProjectFilesNode
[Project\ChildNodes\Node0\ChildNodes\Node0]
ClassName=TProjectFolderNode
Name=wapt
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node0]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\common.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node1]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\setuphelpers.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node2]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\setuphelpers_linux.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node3]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\setuphelpers_macos.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node4]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\setuphelpers_unix.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node5]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\setuphelpers_windows.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node6]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\wapt-get.ini
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node7]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\wapt-get.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node8]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\waptpackage.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes]
Count=9
[Project\ChildNodes\Node0\ChildNodes\Node1]
ClassName=TProjectFileNode
FileName=$[Project-Path]changelog.txt
[Project\ChildNodes\Node0\ChildNodes\Node2]
ClassName=TProjectFileNode
FileName=$[Project-Path]control
[Project\ChildNodes\Node0\ChildNodes\Node3]
ClassName=TProjectFileNode
FileName=$[Project-Path]..\setup.py
[Project\ChildNodes\Node0\ChildNodes]
Count=4
[Project\ChildNodes\Node1]
ClassName=TProjectRunConfiguationsNode
[Project\ChildNodes\Node1\ChildNodes\Node0]
ClassName=TProjectRunConfiguationNode
Name=WAPT: install
[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
Description=Launch package installation.
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=install "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
[Project\ChildNodes\Node1\ChildNodes\Node1]
ClassName=TProjectRunConfiguationNode
Name=WAPT: remove
[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
Description=Launch uninstallation (the uninstallation code found in local wapt database, remember to launch after an installation).
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=remove "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
[Project\ChildNodes\Node1\ChildNodes\Node2]
ClassName=TProjectRunConfiguationNode
Name=WAPT: uninstall
[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
Description=Launch uninstallation code (for debugging purpose, it only runs the code of uninstall function).
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=uninstall "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[Project-Path]..
[Project\ChildNodes\Node1\ChildNodes\Node3]
ClassName=TProjectRunConfiguationNode
Name=WAPT: session-setup
[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
Description=Launch session-setup (it runs directly as current user).
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=session-setup "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
[Project\ChildNodes\Node1\ChildNodes\Node4]
ClassName=TProjectRunConfiguationNode
Name=WAPT: audit
[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
Description=Launch package audit.
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=audit -f "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
[Project\ChildNodes\Node1\ChildNodes\Node5]
ClassName=TProjectRunConfiguationNode
Name=WAPT: update-package
[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
Description=Launch update_package (it usually serve to update binaries of the package).
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=update-package-sources "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
[Project\ChildNodes\Node1\ChildNodes\Node6]
ClassName=TProjectRunConfiguationNode
Name=WAPT: -i build-upload
[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
Description=Build and upload package to the waptserver.
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=--use-gui -i build-upload "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
[Project\ChildNodes\Node1\ChildNodes]
Count=7
[Project\ChildNodes]
Count=2
[Project\ExtraPythonPath]
Count=0

28
luti.json Normal file
View File

@@ -0,0 +1,28 @@
{
"do_update_package": true,
"do_install": true,
"do_remove": true,
"do_session_setup": true,
"do_audit": true,
"do_upgrade": true,
"upgrade_with_custom_operand_version": null,
"build_package": true,
"upload_to_store": true,
"retention_time": 5,
"upload_files_to_virustotal": true,
"virustotal_exclusion_regex": null,
"virustotal_hash_allowlist": [],
"virustotal_bypass_antivirus_list": [],
"wait_update_package_before_generating_vm": false,
"update_package_dependencies": [],
"force_template_update_package": null,
"keywords_checklist": [],
"run_with_psexec": false,
"check_higher_version": true,
"uninstallkey_timeout": 120,
"preinstalled_package_list": [],
"acceptable_audit_output": "-> OK",
"taskid_luti": "72e807a9-2875-48e1-8114-fde203e71c00",
"commit": "84eca861b5d8c53b57687792cb7d0e26750c565a",
"folder_in_git_repo": "tis-info-shutdown/windows"
}

181
setup.py Normal file
View File

@@ -0,0 +1,181 @@
# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
import psutil
import time
import datetime
import ctypes
try:
from waptenterprise.waptservice.enterprise import get_active_sessions, start_interactive_process
except:
from waptservice.enterprise import get_active_sessions, start_interactive_process
import win32api
import sys
import platform
# Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
allow_force_reboot = True
boot_limit = 4
boot_limit_max = 7
force_reboot_timeout = 7200 # In seconds
message_box_title = "Information message about your PC uptime - The IT Support"
message_box_title_fr = "Message d'information à propos de la durée d'allumage du PC - Le Support Informatique"
# boot_limit_message = "This PC must be reboot because he's up since too long, Would you like to reboot now?"
boot_limit_message_string = "This PC must be rebooted because he's up since: %s, Would you like to reboot now?"
boot_limit_message_fr_string = "Ce PC doit être redémarré, car il est allumé depuis : %s, Voulez-vous redémarrer maintenant ?"
# boot_limit_max_message = "This PC will be FORCE reboot in 2 hours because he's up since too long"
boot_limit_max_message_string = "This PC will be FORCE reboot in %s hours because he's up since: %s"
boot_limit_max_message_fr_string = "Ce PC va être redémarré de manière FORCÉ dans %s heures, car il est allumé depuis : %s"
def install():
pass
r""" # Initializing variables
wapt_enterprise_dir = makepath(WAPT.wapt_base_dir,'waptenterprise')
# Checking that the WAPT Agent is well in Enterprise version
if isdir(wapt_enterprise_dir):
print('Continuing: WAPT Agent is well installed in Enterprise version')
else:
error('WAPT Agent is NOT installed in Enterprise version, please upgrade')
"""
def session_setup():
print("This PC is up since:")
print(convert_time_to_date(uptime_seconds()))
# Translating message
if get_language() == "fr":
message_box_title = message_box_title_fr
boot_limit_message_string = boot_limit_message_fr_string
boot_limit_max_message_string = boot_limit_max_message_fr_string
# Avoiding user pop-up spamming
check_timeout = 1800
date_format = "%Y-%m-%d %H:%M:%S" # datetime.datetime.strptime(date_pwsh, "%Y/%m/%d %H:%M:%S")
date = run_powershell('Get-Date -Format "yyyy-MM-dd HH:mm:ss"') # datetime.datetime.now()
date_reg = registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\Shutdown Information", "Last Check")
if date_reg != "":
date_diff = datetime.datetime.strptime(date, date_format) - datetime.datetime.strptime(date_reg, date_format)
if date_diff.total_seconds() < check_timeout:
return "Already checked"
registry_set(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\Shutdown Information", "Last Check", date)
# Notify the user
if allow_force_reboot:
if uptime_days() > boot_limit_max:
# message_box(
# message_box_title,
# boot_limit_max_message_string % (convert_time_to_hours(force_reboot_timeout), convert_time_to_date(uptime_seconds(), translate=True)),
# )
ask_message(message_box_title, boot_limit_max_message_string % (convert_time_to_hours(force_reboot_timeout), convert_time_to_date(uptime_seconds(), translate=True)), flags=0, raise_error=False,)
#reboot_machine(force=1, timeout=force_reboot_timeout)
print("reboot")
return "ERROR"
else :
print("toto")
if uptime_days() > boot_limit:
#message_box_ask_reboot(message_box_title, boot_limit_message_string % convert_time_to_date(uptime_seconds(), translate=True))
if ask_message(message_box_title, boot_limit_message_string % convert_time_to_date(uptime_seconds(), translate=True), flags=4, raise_error=False,) == "6" :
reboot_machine()
return "WARNING"
if uptime_days() < boot_limit:
return "OK"
def audit():
print("This PC is up since:")
print(convert_time_to_date(uptime_seconds()))
if allow_force_reboot:
if uptime_days() > boot_limit_max:
run_session_setup(control.package)
print("Force rebooting the PC after the defined timeout.")
reboot_machine(force=1, timeout=force_reboot_timeout)
return "ERROR"
if uptime_days() > boot_limit:
run_session_setup(control.package)
return "WARNING"
if uptime_days() < boot_limit:
return "OK"
def run_session_setup(package_name):
for session_id in get_active_sessions():
start_interactive_process("wapt-get", "--hide session-setup %s -f" % package_name, session_id=session_id) # , minimize=True
# def message_box(title, text, style=0):
# if platform.python_version_tuple()[0] == "3":
# import importlib
# importlib.reload(sys)
# else:
# reload(sys)
# sys.setdefaultencoding("utf-8")
# MB_OK = 0
# MB_OKCANCEL = 1
# MB_YESNOCANCEL = 3
# MB_YESNO = 4
# ctypes.windll.user32.MessageBoxW(0, "%s" % text, "%s" % title, style)
# return
# def message_box_ask_reboot(title, text):
# if platform.python_version_tuple()[0] == "3":
# import importlib
# importlib.reload(sys)
# else:
# reload(sys)
# sys.setdefaultencoding("utf-8")
# ID_OK = 0
# ID_CANCEL = 2
# ID_ABORT = 3
# ID_YES = 6
# ID_NO = 7
# response = ctypes.windll.user32.MessageBoxW(0, "%s" % text, "%s" % title, 4)
# if response == ID_YES:
# reboot_machine()
# else:
# pass
def uptime_seconds():
return time.time() - psutil.boot_time()
def uptime_minutes():
return (time.time() - psutil.boot_time()) / 60
def uptime_hours():
return (time.time() - psutil.boot_time()) / 3600
def uptime_days():
return ((time.time() - psutil.boot_time()) / 3600) / 24
def convert_time_to_hours(seconds):
return seconds / 3600
def convert_time_to_date(seconds, translate=False):
from datetime import datetime, timedelta
sec = timedelta(seconds=seconds)
d = datetime(1, 1, 1) + sec
# print("DAYS:HOURS:MIN:SEC")
# up 23 weeks, 3 days, 23 hours, 16 minutes
# up 23 weeks 3 days 23 hours 16 minutes
if translate:
if get_language() == "fr":
return "%d jours %d heures %d minutes %d secondes" % (d.day - 1, d.hour, d.minute, d.second)
return "%d days %d hours %d minutes %d seconds" % (d.day - 1, d.hour, d.minute, d.second)

80
update_package.py Normal file
View File

@@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
import waptguihelper
def update_package():
# Modify the values from setup.py
define_allow_force_reboot = ask_message("Allow Force Reboot", "Allow Force Reboot", flags=4, raise_error=False,)
define_boot_limit = ask_input("Uptime for prevent user", "Uptime for prevent user in Days", "7")
if define_allow_force_reboot == 6 :
define_boot_limit_max = ask_input("Uptime for force shutdown", "Uptime for force shutdown", "30")
new_lines = []
with open("setup.py", "r", encoding="utf8") as f:
for line in f.readlines():
if line.startswith("allow_force_reboot"):
line = 'allow_force_reboot = True\n'
new_lines.append(line)
with open("setup.py", "w", encoding="utf8", newline="\n") as f:
f.writelines(new_lines)
new_lines = []
with open("setup.py", "r", encoding="utf8") as f:
for line in f.readlines():
if line.startswith("boot_limit_max ="):
line = 'boot_limit_max = '+ f'{define_boot_limit_max}''\n'
new_lines.append(line)
with open("setup.py", "w", encoding="utf8", newline="\n") as f:
f.writelines(new_lines)
else :
new_lines = []
with open("setup.py", "r", encoding="utf8") as f:
for line in f.readlines():
if line.startswith("allow_force_reboot"):
line = 'allow_force_reboot = False\n'
new_lines.append(line)
with open("setup.py", "w", encoding="utf8", newline="\n") as f:
f.writelines(new_lines)
new_lines = []
with open("setup.py", "r", encoding="utf8") as f:
for line in f.readlines():
if line.startswith("boot_limit ="):
line = 'boot_limit = '+ f'{define_boot_limit}''\n'
new_lines.append(line)
with open("setup.py", "w", encoding="utf8", newline="\n") as f:
f.writelines(new_lines)
# Edit Control
return ask_control_version(control.get_software_version())
def ask_control_version(version, inc_build=False):
"""Requesting that the user supply package version for the `control.version`. Additionally it will make sure user will be able to upload_package from WAPT Console"""
package_updated = False
# 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:
version_plus = (
".".join(version.split(".")[: len(version.split(".")) - 1]) + "." + str(int(version.split(".")[len(version.split(".")) - 1]) + 1)
)
version = ask_dialog(control.package, "Version must be %s minimum to upload from WAPT Console" % version_plus, version_plus)
if not version:
version = control.get_software_version()
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
control.set_software_version(version)
if inc_build:
control.inc_build()
control.save_control_to_wapt()
return package_updated
def ask_dialog(title, text, default="", stay_on_top=False):
"""This function opens a dialog box with a action input"""
return waptguihelper.input_dialog(title, text, default, stay_on_top)