Init a functional script

This commit is contained in:
Heuze Florent 2020-12-31 16:28:47 +01:00
parent 2b86e88873
commit 3cd8b78aba
2 changed files with 71 additions and 68 deletions

View File

@ -3,41 +3,41 @@ version : 1
architecture : all
section : base
priority : optional
name :
categories :
name :
categories :
maintainer : Heuzef <heuzef@firewall-services.com>
description : Ghostscript for Windows
depends :
conflicts :
depends :
conflicts :
maturity : PROD
locale :
target_os :
min_os_version :
max_os_version :
min_wapt_version :
sources :
installed_size :
impacted_process :
description_fr : SMB1 Client on Windows
description_pl :
description_de :
description_es :
description_pt :
description_it :
description_nl :
description_ru :
audit_schedule :
editor :
keywords :
licence :
locale :
target_os :
min_os_version :
max_os_version :
min_wapt_version :
sources :
installed_size :
impacted_process :
description_fr : SMBv1 Client on Windows
description_pl :
description_de :
description_es :
description_pt :
description_it :
description_nl :
description_ru :
audit_schedule :
editor :
keywords :
licence :
homepage : https://docs.microsoft.com/fr-fr/windows-server/storage/file-server/troubleshoot/detect-enable-and-disable-smbv1-v2-v3
package_uuid :
valid_from :
valid_until :
forced_install_on :
changelog :
signer :
signer_fingerprint:
signature :
signature_date :
signed_attributes :
package_uuid :
valid_from :
valid_until :
forced_install_on :
changelog :
signer :
signer_fingerprint:
signature :
signature_date :
signed_attributes :

View File

@ -1,37 +1,40 @@
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
def install():
print("Enable SMB v1")
print('Checking status')
if:
else:
def uninstall():
print('Disable SMB v1')
print('Checking status')
if:
else:
# -*- coding: utf-8 -*-
from setuphelpers import *
import re
uninstallkey = []
def install():
print("Enable SMBv1 ...")
# print('Checking status of SMBv1 ...')
# smbv1_status = run_powershell('Get-WindowsOptionalFeature -Online -FeatureName smb1protocol | out-string -stream | select-string State')
# print('Current status : %s' % (smbv1_status,))
# patterns = ["Enabled"]
# text = smbv1_status
# for pattern in patterns:
# print('Looking for "%s" in "%s" ->' % (pattern, text),)
# if re.search(pattern, text):
# print('FOUND A MATCH!')
# else:
# print('NO MATCH')
smbv1_enable = run_powershell('Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart')
print('Turn ON SMBv1 : %s' % (smbv1_enable,))
print('Done, SMBv1 is now enabled. Reboot is required.')
# SMBv1 already enable
# else:
# print('SMBv1 is already enabled. No reboot required.')
def uninstall():
# Disable :
#
# Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart
#
# Enable :
#
# Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart
#
# Status :
#
# Get-WindowsOptionalFeature -Online -FeatureName smb1protocol
#
# https://docs.microsoft.com/fr-fr/windows-server/storage/file-server/troubleshoot/detect-enable-and-disable-smbv1-v2-v3
print("Disable SMBv1 ...")
smbv1_disable = run_powershell('Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart')
print('Turn OFF SMBv1 : %s' % (smbv1_disable,))
print('Done, SMBv1 is now disabled. Reboot is required.')