forked from EFTEC/Cyberarms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.ps1
More file actions
114 lines (95 loc) · 5.13 KB
/
Copy pathpackage.ps1
File metadata and controls
114 lines (95 loc) · 5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
$baseDir = "c:\Cyberarms\Cyberarms-master"
$packageDir = "$baseDir\ReleasePackage"
$binDir = "$packageDir\bin"
$pluginsDir = "$binDir\Plugins"
# Create clean packaging directories
if (Test-Path $packageDir) {
Remove-Item $packageDir -Recurse -Force
}
New-Item -ItemType Directory -Path $packageDir | Out-Null
New-Item -ItemType Directory -Path $binDir | Out-Null
New-Item -ItemType Directory -Path $pluginsDir | Out-Null
function Get-SourcePath($project, $file) {
$x86Path = "$baseDir\$project\bin\x86\Release\$file"
if (Test-Path $x86Path) { return $x86Path }
$anyCpuPath = "$baseDir\$project\bin\Release\$file"
if (Test-Path $anyCpuPath) { return $anyCpuPath }
return "$baseDir\$project\bin\Release 64-bit edition\$file"
}
# Copy main service binaries and dependencies
Copy-Item (Get-SourcePath "Cyberarms.IntrusionDetection.Service" "CyberarmsIdsService.exe") -Destination $binDir
$svcConfig = Get-SourcePath "Cyberarms.IntrusionDetection.Service" "CyberarmsIdsService.exe.config"
if (Test-Path $svcConfig) {
Copy-Item $svcConfig -Destination $binDir
} else {
Copy-Item "$baseDir\Cyberarms.IntrusionDetection.Service\app.config" -Destination "$binDir\CyberarmsIdsService.exe.config"
}
Copy-Item (Get-SourcePath "Cyberarms.IntrusionDetection.Service" "Cyberarms.IntrusionDetection.Api.dll") -Destination $binDir
Copy-Item (Get-SourcePath "Cyberarms.IntrusionDetection.Service" "Cyberarms.IntrusionDetection.Shared.dll") -Destination $binDir
# Copy Admin console
Copy-Item (Get-SourcePath "Cyberarms.IDDS.Management" "iddsadmin.exe") -Destination $binDir
Copy-Item "$baseDir\Cyberarms.IDDS.Management\app.config" -Destination "$binDir\iddsadmin.exe.config" -ErrorAction SilentlyContinue
# Copy GUI Admin panel
Copy-Item (Get-SourcePath "Cyberarms.IntrusionDetection.Admin" "IntrusionDetectionAdmin.exe") -Destination $binDir
Copy-Item (Get-SourcePath "Cyberarms.IntrusionDetection.Admin" "IntrusionDetectionAdmin.exe.config") -Destination $binDir -ErrorAction SilentlyContinue
# Copy CLI tool
Copy-Item (Get-SourcePath "Cyberarms.IntrusionDetection.Cmd" "CyberarmsIdsCmd.exe") -Destination $binDir
Copy-Item "$baseDir\Cyberarms.IntrusionDetection.Cmd\app.config" -Destination "$binDir\CyberarmsIdsCmd.exe.config" -ErrorAction SilentlyContinue
# Copy SQLite assemblies
Copy-Item "$baseDir\Dependencies\SQLite\System.Data.SQLite.dll" -Destination $binDir
Copy-Item "$baseDir\Dependencies\SQLite\SQLite.Interop.dll" -Destination $binDir
# Copy WebSecurity library
Copy-Item "$baseDir\Cyberarms.WebSecurity\bin\Release\Cyberarms.WebSecurity.dll" -Destination $binDir
# Copy Event Log Cleaner utility
Copy-Item "$baseDir\EventLogCleaner\bin\Release\EventLogCleaner.exe" -Destination $binDir -ErrorAction SilentlyContinue
# Copy Agent Plugins to the Plugins folder
$agents = @(
"Bind9", "FileMaker", "FtpServer", "MailServer", "MySql", "Smtp", "SqlServer", "TerminalServer", "WebSecurity"
)
foreach ($agent in $agents) {
$agentProject = "Cyberarms.Agents.$agent"
$agentFile = "$agentProject.dll"
$sourcePath = Get-SourcePath $agentProject $agentFile
if (Test-Path $sourcePath) {
Copy-Item $sourcePath -Destination $pluginsDir
} else {
Write-Warning "Could not find built assembly for agent $agent at: $sourcePath"
}
}
Copy-Item (Get-SourcePath "Cyberarms.IntrusionDetection.Base" "Cyberarms.IntrusionDetection.Base.Plugins.dll") -Destination $pluginsDir
# Copy installer scripts and batch files
Copy-Item "$baseDir\install.ps1" -Destination $packageDir -ErrorAction SilentlyContinue
Copy-Item "$baseDir\uninstall.ps1" -Destination $packageDir -ErrorAction SilentlyContinue
Copy-Item "$baseDir\install.bat" -Destination $packageDir -ErrorAction SilentlyContinue
Copy-Item "$baseDir\uninstall.bat" -Destination $packageDir -ErrorAction SilentlyContinue
# Create a README
$readmeText = @"
============================================================
Cyberarms Intrusion Detection and Prevention - Release 2.2.0
============================================================
This package contains the Cyberarms background service, administration
console, and command line tools configured to use Null Routing based blocking.
Prerequisites:
- Windows Server 2008 R2, 2012, 2016, 2019, 2022, or 2025.
- .NET Framework 4.8 or later installed.
- Administrator privileges on the machine.
Installation:
1. Right-click on "install.bat" and select "Run as administrator".
2. Confirm the UAC prompt.
3. The installer will copy files to C:\Program Files\Cyberarms Intrusion Detection,
register and start the background service, and create desktop shortcuts.
Uninstallation:
1. Right-click on "uninstall.bat" and select "Run as administrator".
2. Confirm the UAC prompt.
3. The uninstaller will stop and remove the background service and clean up
all deployed files and shortcuts.
"@
$readmeText | Out-File -FilePath "$packageDir\README.txt" -Encoding utf8
# Archive to zip
$zipPath = "$baseDir\Cyberarms-Release-2.2.0.zip"
if (Test-Path $zipPath) {
Remove-Item $zipPath -Force
}
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($packageDir, $zipPath)
Write-Host "Release package successfully created at: $zipPath"