Push it to the limit

This commit is contained in:
2019-12-20 14:24:42 +01:00
commit 2b99257891
3 changed files with 140 additions and 0 deletions

16
README.md Normal file
View File

@@ -0,0 +1,16 @@
# KSW-Importer
A simple powershell script to create a valid xml file for exclusions in Kaspersky Server for Windows
You can create an input file easily by using the windows build in dir command. Something like:
dir /s/b *.exe -> exclusionlist.txt
How to use:
Simply execute create_trusted_files.ps1 from powershell. You musst use parameters for input and output file.
Example: ./create_trusted_files.ps1 -in exclusionlist.txt -out exclusions.xml
The input file musst be a simple text file which contains one file to exclude per line.
The output file musste be a xml file.
Works for KSC10 SP3!

63
create_trusted_files.ps1 Normal file
View File

@@ -0,0 +1,63 @@
Param(
[string]$in,
[string]$out
)
$xml = @'
<?xml version="1.0" encoding="UTF-8"?>
<KAV-WSEE-Settings xmlns="urn:kaspersky.com/products/wsee/8.0/export/settings">
<ProductInfo>
<ProductName>WSEE</ProductName>
<ProductVersion>8.0.0.0</ProductVersion>
</ProductInfo>
<Settings>
<TrustedZone>
<__VersionInfo>
<element>1</element>
<element>1</element>
</__VersionInfo>
<TrustedProcessesEnabled>no</TrustedProcessesEnabled>
<TrustedProcesses>
</TrustedProcesses>
<TrustAllBackupReadOperations>yes</TrustAllBackupReadOperations>
<ExclutionRules>
'@
$xml | out-file $out -encoding utf8
foreach($line in Get-Content $in)
{ $xml = "<element>
<__VersionInfo>
<element>1</element>
<element>4</element>
</__VersionInfo>
<Enabled>yes</Enabled>
<UseObjects>yes</UseObjects>
<Objects>
<element>
<__VersionInfo>
<element>1</element>
<element>0</element>
</__VersionInfo>
<Type>4</Type>
<Path>$line</Path>
</element>
</Objects>
<UseThreatNameMasks>no</UseThreatNameMasks>
<ThreatNameMasks>
</ThreatNameMasks>
<ApplyForFileMonitor>yes</ApplyForFileMonitor>
<ApplyForOnDemandScan>yes</ApplyForOnDemandScan>
<ApplyForScriptChecker>no</ApplyForScriptChecker>
<Description>$line</Description>
<ApplyForNetAppMonitor>yes</ApplyForNetAppMonitor>
<ApplyForICAPScanner>no</ApplyForICAPScanner>
</element>"
$xml | out-file $out -encoding utf8 -Append
}
$xml = @'
</ExclutionRules>
</TrustedZone>
</Settings>
</KAV-WSEE-Settings>
'@
$xml | out-file $out -encoding utf8 -Append

View File

@@ -0,0 +1,61 @@
Param(
[string]$in,
[string]$out
)
$xml = @'
<?xml version="1.0" encoding="UTF-8"?>
<KAV-WSEE-Settings xmlns="urn:kaspersky.com/products/wsee/8.0/export/settings">
<ProductInfo>
<ProductName>WSEE</ProductName>
<ProductVersion>8.0.0.0</ProductVersion>
</ProductInfo>
<Settings>
<TrustedZone>
<__VersionInfo>
<element>1</element>
<element>1</element>
</__VersionInfo>
<TrustedProcessesEnabled>no</TrustedProcessesEnabled>
<TrustedProcesses>
</TrustedProcesses>
<TrustAllBackupReadOperations>no</TrustAllBackupReadOperations>
<ExclutionRules>
'@
$xml | out-file $out -encoding utf8
foreach($line in Get-Content $in)
{ $xml = " <element>
<__VersionInfo>
<element>1</element>
<element>4</element>
</__VersionInfo>
<Enabled>yes</Enabled>
<UseObjects>yes</UseObjects>
<Objects>
<element>
<__VersionInfo>
<element>1</element>
<element>0</element>
</__VersionInfo>
<Type>3</Type>
<Path>$line</Path>
</element>
</Objects>
<UseThreatNameMasks>no</UseThreatNameMasks>
<ThreatNameMasks>
</ThreatNameMasks>
<ApplyForFileMonitor>yes</ApplyForFileMonitor>
<ApplyForOnDemandScan>yes</ApplyForOnDemandScan>
<ApplyForScriptChecker>no</ApplyForScriptChecker>
<Description>$line</Description>
<ApplyForNetAppMonitor>yes</ApplyForNetAppMonitor>
<ApplyForICAPScanner>no</ApplyForICAPScanner>
</element>"
$xml | out-file $out -encoding utf8 -Append
}
$xml = @'
</ExclutionRules>
</TrustedZone>
</Settings>
</KAV-WSEE-Settings>
'@
$xml | out-file $out -encoding utf8 -Append