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
615f578e
Commit
615f578e
authored
May 16, 2022
by
Gabriel Moreau
Browse files
Better test
parent
e2ab7cae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
Modules/SWMB/Experimental.psm1
Modules/SWMB/Experimental.psm1
+20
-16
No files found.
Modules/SWMB/Experimental.psm1
View file @
615f578e
...
...
@@ -89,14 +89,16 @@ Function TweakUninstallKasperskyEndpoint { # RESINFO
If
(
$KesEndpoint
.
IdentifyingNumber
)
{
Write-Host
"Uninstalling Kaspersky version
$(
$KesEndpoint
.
Version
)
with GUID =>
$(
$KesEndpoint
.
IdentifyingNumber
)
"
$EndpointPlainPassword
=
''
If
((
$
(
$
Global
:
SWMB_Custom
.
KesPassword
))
-And
(
Test-Path
-LiteralPath
"
$(
$
Global
:
SWMB_Custom
.
KesKeyFile
)
"
))
{
# Batch - encrypted (blurred) password
$EndpointCryptPassword
=
$
(
$
Global
:
SWMB_Custom
.
KesPassword
)
|
ConvertTo-SecureString
-Key
(
Get-Content
$
(
$
Global
:
SWMB_Custom
.
KesKeyFile
))
$EndpointCredential
=
New-Object
System.Management.Automation.PsCredential
(
$
(
$
Global
:
SWMB_Custom
.
KesLogin
),
$EndpointCryptPassword
)
$EndpointPlainPassword
=
$EndpointCredential
.
GetNetworkCredential
()
.
Password
}
ElseIf
(
$
(
$
Global
:
SWMB_Custom
.
KesPassword
))
{
# Batch - password defined in clear text
$EndpointPlainPassword
=
$
(
$
Global
:
SWMB_Custom
.
KesPassword
)
If
(
$
(
$
Global
:
SWMB_Custom
.
KesPassword
))
{
If
((
$
(
$
Global
:
SWMB_Custom
.
KesKeyFile
))
-And
(
Test-Path
-LiteralPath
"
$(
$
Global
:
SWMB_Custom
.
KesKeyFile
)
"
))
{
# Batch - encrypted (blurred) password
$EndpointCryptPassword
=
$
(
$
Global
:
SWMB_Custom
.
KesPassword
)
|
ConvertTo-SecureString
-Key
(
Get-Content
$
(
$
Global
:
SWMB_Custom
.
KesKeyFile
))
$EndpointCredential
=
New-Object
System.Management.Automation.PsCredential
(
$
(
$
Global
:
SWMB_Custom
.
KesLogin
),
$EndpointCryptPassword
)
$EndpointPlainPassword
=
$EndpointCredential
.
GetNetworkCredential
()
.
Password
}
Else
{
# Batch - password defined in clear text
$EndpointPlainPassword
=
$
(
$
Global
:
SWMB_Custom
.
KesPassword
)
}
}
# Uninstall
...
...
@@ -122,14 +124,16 @@ Function TweakUninstallKasperskyEndpoint { # RESINFO
If
(
$KesAgent
.
IdentifyingNumber
)
{
Write-Output
"Suppress Agent Kaspersky Security Center
$(
$KesAgent
.
Version
)
with GUID =>
$(
$KesAgent
.
IdentifyingNumber
)
"
$AgentPlainPassword
=
''
If
((
$
(
$
Global
:
SWMB_Custom
.
KesAgentPass
))
-And
(
Test-Path
-LiteralPath
"
$(
$
Global
:
SWMB_Custom
.
KesKeyFile
)
"
))
{
# Batch - encrypted (blurred) password
$AgentCryptPassword
=
$
(
$
Global
:
SWMB_Custom
.
KesAgentPass
)
|
ConvertTo-SecureString
-Key
(
Get-Content
$
(
$
Global
:
SWMB_Custom
.
KesKeyFile
))
$AgentCredential
=
New-Object
System.Management.Automation.PsCredential
(
$
(
$
Global
:
SWMB_Custom
.
KesLogin
),
$AgentCryptPassword
)
$AgentPlainPassword
=
$AgentCredential
.
GetNetworkCredential
()
.
Password
}
ElseIf
(
$
(
$
Global
:
SWMB_Custom
.
KesAgentPass
))
{
# Batch - password defined in clear text
$AgentPlainPassword
=
$
(
$
Global
:
SWMB_Custom
.
KesPassword
)
If
(
$
(
$
Global
:
SWMB_Custom
.
KesAgentPass
))
{
If
((
$
(
$
Global
:
SWMB_Custom
.
KesKeyFile
))
-And
(
Test-Path
-LiteralPath
"
$(
$
Global
:
SWMB_Custom
.
KesKeyFile
)
"
))
{
# Batch - encrypted (blurred) password
$AgentCryptPassword
=
$
(
$
Global
:
SWMB_Custom
.
KesAgentPass
)
|
ConvertTo-SecureString
-Key
(
Get-Content
$
(
$
Global
:
SWMB_Custom
.
KesKeyFile
))
$AgentCredential
=
New-Object
System.Management.Automation.PsCredential
(
$
(
$
Global
:
SWMB_Custom
.
KesLogin
),
$AgentCryptPassword
)
$AgentPlainPassword
=
$AgentCredential
.
GetNetworkCredential
()
.
Password
}
Else
{
# Batch - password defined in clear text
$AgentPlainPassword
=
$
(
$
Global
:
SWMB_Custom
.
KesAgentPass
)
}
}
$AgentHexPassword
=
(
_
String2Hex00
-Text
$AgentPlainPassword
)
...
...
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