-
Notifications
You must be signed in to change notification settings - Fork 51
/
CyberPipe.ps1
executable file
·211 lines (200 loc) · 6.44 KB
/
CyberPipe.ps1
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<#
CyberPipe.ps1
https://github.com/dwmetz/CyberPipe
previously named "CSIRT-Collect"
Author: @dwmetz
This script will:
- capture a memory image with DumpIt for Windows, (x32, x64, ARM64), or Magnet RAM capture on legacy systems
- capture a triage image with MAGNET Response,
- check for encrypted disks,
- recover the active BitLocker Recovery key,
- save all artifacts, output and audit logs to USB or source network drive.
Release Notes:
v5.0 RESPONSE Edition
Prerequisites: (in \Tools directory)
- [MAGNET Response](https://magnetforensics.com) (MagnetRESPONSE.exe)
- [Encrypted Disk Detector](https://www.magnetforensics.com/resources/encrypted-disk-detector/) (EDDv310.exe)
- CyberPipe5.ps1 next to your TOOLS directory (whether on network or USB)
Operation:
- Open PowerShell as Adminstrator
- Execute ./CyberPipe.ps1
#>
param ([switch]$Elevated)
function Test-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
if ((Test-Admin) -eq $false) {
if ($elevated) {
} else {
Write-host " "
Write-host "CyberPipe requires Admin permissions (not detected). Exiting."
Write-host " "
}
exit
}
[console]::ForegroundColor="Cyan"
Clear-Host
Write-Host ""
Write-Host ""
Write-Host ""
Write-host "
.',;::cccccc:;. ...'''''''..'.
.;ccclllloooddxc. .';clooddoolcc::;:;.
.:ccclllloooddxo. .,coxxxxxdl:,'..
'ccccclllooodddd' .,,'lxkxxxo:'.
'ccccclllooodddd' .,:lxOkl,;oxo,.
':cccclllooodddo. .:dkOOOOkkd;''.
.:cccclllooooddo. ..;lxkOOOOOkkkd;
.;ccccllloooodddc:coxkkkkOOOOOOx:.
'cccclllooooddddxxxxkkkkOOOOx:.
,ccclllooooddddxxxxxkkkxlc,.
':llllooooddddxxxxxoc;.
.';:clooddddolc:,..
''''''''''
"
Write-Host "CyberPipe IR Collection Script v5.0"
Write-Host "https://github.com/dwmetz/CyberPipe"
Write-Host "@dwmetz | $([char]0x00A9)2024 bakerstreetforensics.com"
Write-Host ""
Write-Host ""
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
[console]::ForegroundColor="DarkCyan"
## Network Collection - uncomment the section below for Network use
<#
$server = "\\server\share" # Server configuration
Write-Host "Mapping network drive..."
$Networkpath = "Z:\"
If (Test-Path -Path $Networkpath) {
Write-Host "Drive is mapped."
}
Else {
# map network drive
(New-Object -ComObject WScript.Network).MapNetworkDrive("Z:","$server")
# check mapping again
If (Test-Path -Path $Networkpath) {
Write-Host "Drive has been mapped."
}
Else {
Write-Host -Fore Red "Error mapping drive."
}
}
Set-Location $Networkpath
## End of Network section
#>
## Below is for USB and Network:
$tstamp = (Get-Date -Format "yyyyMMddHHmm")
$wd = Get-Location
$outputpath = "$wd\Collections\$env:COMPUTERNAME-$tstamp"
If (Test-Path -Path $wd\Tools) {
}
Else {
Write-Host " "
Write-Host -For DarkCyan "Tools directory not present."
Write-Host " "
exit
}
If (Test-Path -Path Collections) {
Write-Host "Collections directory exists."
}
Else {
$null = mkdir Collections
If (Test-Path -Path Collections) {
Write-Host "Collection directory created."
}
Else {
Write-Host -For DarkCyan "Error creating directory."
}
}
Set-Location Collections
If (Test-Path -Path $outputpath) {
Write-Host "Host directory already exists."
}
Else {
$null = mkdir $outputpath
If (Test-Path -Path $outputpath) {
Write-Host "Host directory created."
}
Else {
Write-Host -For DarkCyan "Error creating directory."
}
}
### VARIABLE SETUP
$profileName = "Volatile (testing)"
$arguments = "/capturevolatile"
#>
<#
$profileName = "MAGNET Triage"
$arguments = "/captureram /capturepagefile /capturevolatile /capturesystemfiles"
#>
<#
$profileName = "RAM Dump"
$arguments = "/captureram"
#>
<#
$profileName = "RAM & Pagefile"
$arguments = "/captureram /capturepagefile"
#>
Write-Host ""
$tstamp = (Get-Date -Format "yyyyMMddHHmm")
$global:progressPreference = 'silentlyContinue'
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
Write-Host -Fore Cyan "
Running MAGNET Response...
"
Write-Host ""
Write-Host "Magnet RESPONSE v1.7
$([char]0x00A9)2021-2024 Magnet Forensics Inc
"
$OS = $(((gcim Win32_OperatingSystem -ComputerName $server.Name).Name).split('|')[0])
$arch = (get-wmiobject win32_operatingsystem).osarchitecture
$name = (get-wmiobject win32_operatingsystem).csname
Write-host "
Hostname: $name
Operating System: $OS
Architecture: $arch
Selected Profile: $profileName
Output Directory: $outputpath
"
.$wd\Tools\MagnetRESPONSE.exe /accepteula /unattended /silent /caseref:CyberPipe /output:"$outputpath" $arguments
Write-Host -Fore Cyan "
Collecting Artifacts...
"
Wait-Process -name "MagnetRESPONSE"
$null = $stopwatch.Elapsed
$Minutes = $StopWatch.Elapsed.Minutes
$Seconds = $StopWatch.Elapsed.Seconds
Write-Host -Fore Cyan "** Magnet RESPONSE Completed in $Minutes minutes and $Seconds seconds. **
"
Write-Host -Fore Cyan "Running Encrypted Disk Detector (EDD)...
"
$collection = "$env:COMPUTERNAME-$tstamp"
.$wd\Tools\EDDv310.exe /batch >> $outputpath\$collection-edd.txt
Start-Sleep 1
Get-Content $outputpath\$collection-edd.txt
Write-Host -Fore Cyan "
Checking for BitLocker Key...
"
(Get-BitLockerVolume -MountPoint C).KeyProtector > $outputpath\$collection-key.txt
If ($Null -eq (Get-Content "$outputpath\$collection-key.txt")) {
Write-Host -Fore yellow "
Bitlocker key not identified.
"
Set-Content -Path $outputpath\$collection-key.txt -Value "
No Bitlocker key identified for $env:computername
"
}
Else {
Write-Host -Fore Cyan "
Bitlocker key recovered.
"
}
Set-Content -Path $outputpath\$collection-complete.txt -Value "Collection complete: $((Get-Date).ToString())"
Set-Location ~
$StopWatch.Stop()
$null = $stopwatch.Elapsed
$Minutes = $StopWatch.Elapsed.Minutes
$Seconds = $StopWatch.Elapsed.Seconds
Write-Host -Fore Cyan "
*** Collection Completed in $Minutes minutes and $Seconds seconds. ***
"