Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
resinfo-gt
swmb
resinfo-swmb
Commits
8d8ab91d
Commit
8d8ab91d
authored
May 10, 2022
by
Gabriel Moreau
Browse files
Clean code
parent
1ed532d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
18 deletions
+35
-18
Modules/SWMB/Experimental.psm1
Modules/SWMB/Experimental.psm1
+22
-11
dists/uninstall-kaspersky/get-password-cleartext.ps1
dists/uninstall-kaspersky/get-password-cleartext.ps1
+11
-5
dists/uninstall-kaspersky/set-password-encrypted.ps1
dists/uninstall-kaspersky/set-password-encrypted.ps1
+2
-2
No files found.
Modules/SWMB/Experimental.psm1
View file @
8d8ab91d
...
...
@@ -69,29 +69,40 @@ Function TweakViewTargetRelease { # RESINFO
# Suppress Kaspersky Endpoint software
# Uninstall
Function
TweakUninstallKasperskyEndpoint
{
# RESINFO
Function
_String2Hex
{
Param
(
[
Parameter
(
Mandatory
=
$true
)]
[
string
]
$Text
)
$CharArray
=
$Text
.
ToCharArray
()
ForEach
(
$Char
in
$CharArray
)
{
$TextHex
=
$TextHex
+
" "
+
[
System.String
]::
Format
(
"{0:x2}"
,
[
System.Convert
]::
ToUInt32
(
$Char
))
}
Return
$TextHex
}
Write-Output
"Suppress software Kaspersky Endpoint protection..."
$Kes
=
Get-WmiObject
win32_product
|
Where
{
$_
.
Name
-like
"*Kaspersky Endpoint Security*"
}
If
(
$Kes
.
IdentifyingNumber
)
{
Write-Host
"Uninstalling Kaspersky version
$(
$Kes
.
Version
)
with GUID =>
$(
$Kes
.
IdentifyingNumber
)
"
# Remove Kaspersky Endpoint
$KesEndpoint
=
Get-WmiObject
win32_product
|
Where
{
$_
.
Name
-like
"*Kaspersky Endpoint Security*"
}
If
(
$KesEndpoint
.
IdentifyingNumber
)
{
Write-Host
"Uninstalling Kaspersky version
$(
$KesEndpoint
.
Version
)
with GUID =>
$(
$KesEndpoint
.
IdentifyingNumber
)
"
$PlainPassword
=
''
If
(
$
(
$
Global
:
SWMB_Custom
.
KesPassword
))
{
# Batch - password defined in clear text
$PlainPassword
=
$
(
$
Global
:
SWMB_Custom
.
KesPassword
)
}
ElseIf
((
$
(
$
Global
:
SWMB_Custom
.
KesSecureString
))
-And
(
Test-Path
-LiteralPath
"
$(
$
Global
:
SWMB_Custom
.
KesKeyFile
)
"
))
{
# Batch - encrypted (blurred) password
$Password
=
$
(
$
Global
:
SWMB_Custom
.
KesSecureString
)
|
ConvertTo-SecureString
-Key
(
Get-Content
$
(
$
Global
:
SWMB_Custom
.
KesKeyFile
))
$Credential
=
New-Object
System.Management.Automation.PsCredential
(
$
(
$
Global
:
SWMB_Custom
.
KesLogin
),
$Password
)
$
Crypt
Password
=
$
(
$
Global
:
SWMB_Custom
.
KesSecureString
)
|
ConvertTo-SecureString
-Key
(
Get-Content
$
(
$
Global
:
SWMB_Custom
.
KesKeyFile
))
$Credential
=
New-Object
System.Management.Automation.PsCredential
(
$
(
$
Global
:
SWMB_Custom
.
KesLogin
),
$
Crypt
Password
)
$PlainPassword
=
$Credential
.
GetNetworkCredential
()
.
Password
}
#Else {
# Interactive - ask password
#$PlainPassword = Read-Host -AsSecureString -Prompt "Give the Kaspersky endpoint password for $($($Global:SWMB_Custom.KesLogin))"
#}
# Uninstall
$MSIArguments
=
@(
"/x"
$Kes
.IdentifyingNumber
$Kes
Endpoint
.IdentifyingNumber
"KLLOGIN=
$(
$
(
$
Global
:
SWMB_Custom
.
KesLogin
)
)"
"KLPASSWD=
$PlainPassword
"
"/norestart"
...
...
@@ -110,7 +121,7 @@ Function TweakUninstallKasperskyEndpoint { # RESINFO
Start-Process
"msiexec.exe"
-ArgumentList
"/x
$(
$KesAgent
.
IdentifyingNumber
)
/qn"
-Wait
-NoNewWindow
}
Else
{
Write-Host
"Kaspersky
a
gent Security Center is not installed on this computer "
Write-Host
"Kaspersky
A
gent Security Center is not installed on this computer "
}
}
...
...
dists/uninstall-kaspersky/get-password-cleartext.ps1
View file @
8d8ab91d
...
...
@@ -3,9 +3,15 @@ Do {
$KeyFile
=
Read-Host
-Prompt
"Key File"
}
Until
(
Test-Path
-LiteralPath
"
$KeyFile
"
)
$EncryptedPass
=
Read-Host
-Prompt
"Encrypted blurred Password"
$EncryptedEndpointPass
=
Read-Host
-Prompt
"Encrypted blurred Endpoint Password"
$EncryptedAgentPass
=
Read-Host
-Prompt
"Encrypted blurred Agent Password"
$Password
=
$EncryptedPass
|
ConvertTo-SecureString
-Key
(
Get-Content
$KeyFile
)
$Credential
=
New-Object
System.Management.Automation.PsCredential
(
'AsYouWant'
,
$Password
)
$PlainPassword
=
$Credential
.
GetNetworkCredential
()
.
Password
Write-Output
"Password in clear text:
$PlainPassword
"
$EndpointPassword
=
$EncryptedEndpointPass
|
ConvertTo-SecureString
-Key
(
Get-Content
$KeyFile
)
$EndpointCredential
=
New-Object
System.Management.Automation.PsCredential
(
'AsYouWant'
,
$EndpointPassword
)
$EndpointPlainPassword
=
$EndpointCredential
.
GetNetworkCredential
()
.
Password
Write-Output
"Endpoint Password in clear text:
$EndpointPlainPassword
"
$AgentPassword
=
$EncryptedAgentPass
|
ConvertTo-SecureString
-Key
(
Get-Content
$KeyFile
)
$AgentCredential
=
New-Object
System.Management.Automation.PsCredential
(
'AsYouWant'
,
$AgentPassword
)
$AgentPlainPassword
=
$AgentCredential
.
GetNetworkCredential
()
.
Password
Write-Output
"Agent Password in clear text:
$AgentPlainPassword
"
dists/uninstall-kaspersky/set-password-encrypted.ps1
View file @
8d8ab91d
$KesKeyFile
=
Read-Host
-Prompt
"Key File (please put .key extension)"
$KesPassword
=
Read-Host
-AsSecureString
-Prompt
"Password to secure"
$KesAgentPassword
=
Read-Host
-AsSecureString
-Prompt
"Network Agent Password to secure"
$KesPassword
=
Read-Host
-AsSecureString
-Prompt
"
Kaspersky Endpoint
Password to secure"
$KesAgentPassword
=
Read-Host
-AsSecureString
-Prompt
"
Kaspersky
Network Agent Password to secure"
if
(
$KesKeyFile
)
{
$Key
=
New-Object
Byte
[]
32
# create key AES 256-bit key (32 bytes)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment