-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathKnockKnock-Analyzer.ps1
More file actions
4203 lines (3771 loc) · 184 KB
/
KnockKnock-Analyzer.ps1
File metadata and controls
4203 lines (3771 loc) · 184 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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# KnockKnock-Analyzer v0.1
#
# @author: Martin Willing
# @copyright: Copyright (c) 2026 Martin Willing. All rights reserved. Licensed under the MIT license.
# @contact: Any feedback or suggestions are always welcome and much appreciated - mwilling@lethal-forensics.com
# @url: https://lethal-forensics.com/
# @date: 2026-03-16
#
#
# ██╗ ███████╗████████╗██╗ ██╗ █████╗ ██╗ ███████╗ ██████╗ ██████╗ ███████╗███╗ ██╗███████╗██╗ ██████╗███████╗
# ██║ ██╔════╝╚══██╔══╝██║ ██║██╔══██╗██║ ██╔════╝██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝██║██╔════╝██╔════╝
# ██║ █████╗ ██║ ███████║███████║██║█████╗█████╗ ██║ ██║██████╔╝█████╗ ██╔██╗ ██║███████╗██║██║ ███████╗
# ██║ ██╔══╝ ██║ ██╔══██║██╔══██║██║╚════╝██╔══╝ ██║ ██║██╔══██╗██╔══╝ ██║╚██╗██║╚════██║██║██║ ╚════██║
# ███████╗███████╗ ██║ ██║ ██║██║ ██║███████╗ ██║ ╚██████╔╝██║ ██║███████╗██║ ╚████║███████║██║╚██████╗███████║
# ╚══════╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═════╝╚══════╝
#
#
# Dependencies:
#
# ImportExcel v7.8.10 (2024-10-21)
# https://github.com/dfinke/ImportExcel
#
# jq v1.8.1 (2025-07-01)
# https://jqlang.org/ --> jq-windows-amd64.exe
# https://github.com/stedolan/jq
#
# VirusTotal-CLI v1.3.0 (2026-02-17)
# https://github.com/VirusTotal/vt-cli --> Windows64.zip
#
# yq v4.52.4 (2026-02-14)
# https://github.com/mikefarah/yq --> yq_windows_amd64.zip
#
#
# Changelog:
# Version 0.1
# Release Date: 2026-03-16
# Initial Release
#
#
# Tested on Windows 10 Pro (x64) Version 22H2 (10.0.19045.6456) and PowerShell 5.1 (5.1.19041.6456)
# Tested on Windows 10 Pro (x64) Version 22H2 (10.0.19045.6456) and PowerShell 7.5.5
#
#
#############################################################################################################################################################################################
#############################################################################################################################################################################################
<#
.SYNOPSIS
KnockKnock-Analyzer v0.1 - Automated Forensic Analysis of KnockKnock Findings for DFIR
.DESCRIPTION
KnockKnock-Analyzer.ps1 is a PowerShell script utilized to simplify the analysis of KnockKnock results (KnockKnock_Results_yyyy-MM-dd.json).
https://objective-see.org/products/knockknock.html
https://github.com/objective-see/KnockKnock
.PARAMETER OutputDir
Specifies the output directory. Default is "$env:USERPROFILE\Desktop\KnockKnock-Analyzer".
Note: The subdirectory 'KnockKnock-Analyzer' is automatically created.
.PARAMETER Path
Specifies the path to the input file (KnockKnock_Results_yyyy-MM-dd.json).
.PARAMETER skipVT
Do not query VirusTotal with item hashes.
.EXAMPLE
PS> .\KnockKnock-Analyzer.ps1
.EXAMPLE
PS> .\KnockKnock-Analyzer.ps1 -Path "$env:USERPROFILE\Desktop\KnockKnock_Results_2026-03-13.json"
.EXAMPLE
PS> .\KnockKnock-Analyzer.ps1 -Path "H:\macos-collector\KnockKnock\KnockKnock_Results_2026-03-13.json" -OutputDir "H:\MacOS-Analyzer-Suite"
.EXAMPLE
PS> .\KnockKnock-Analyzer.ps1 -Path "H:\macos-collector\KnockKnock\KnockKnock_Results_2026-03-13.json" -OutputDir "H:\MacOS-Analyzer-Suite" --skipVT
.NOTES
Author - Martin Willing
.LINK
https://lethal-forensics.com/
#>
#############################################################################################################################################################################################
#############################################################################################################################################################################################
#region CmdletBinding
[CmdletBinding()]
Param(
[String]$Path,
[String]$OutputDir,
[Switch]$skipVT
)
#endregion CmdletBinding
#############################################################################################################################################################################################
#############################################################################################################################################################################################
#region Initialisations
# Set Progress Preference to Silently Continue
$OriginalProgressPreference = $Global:ProgressPreference
$Global:ProgressPreference = 'SilentlyContinue'
#endregion Initialisations
#############################################################################################################################################################################################
#############################################################################################################################################################################################
#region Declarations
# Declarations
# Script Root
if ($PSVersionTable.PSVersion.Major -gt 2)
{
# PowerShell 3+
$SCRIPT_DIR = $PSScriptRoot
}
else
{
# PowerShell 2
$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Definition
}
# Output Directory
if (!($OutputDir))
{
$script:OUTPUT_FOLDER = "$env:USERPROFILE\Desktop\KnockKnock-Analyzer" # Default
}
else
{
if ($OutputDir -cnotmatch '.+(?=\\)')
{
Write-Host "[Error] You must provide a valid directory path." -ForegroundColor Red
Exit
}
else
{
$script:OUTPUT_FOLDER = "$OutputDir\KnockKnock-Analyzer" # Custom
}
}
# Colors
Add-Type -AssemblyName System.Drawing
$script:Green = [System.Drawing.Color]::FromArgb(0,176,80) # Green
$script:Orange = [System.Drawing.Color]::FromArgb(255,192,0) # Orange
# Tools
# jq
$script:jq = "$SCRIPT_DIR\Tools\jq\jq-windows-amd64.exe"
# VirusTotal-CLI
$script:vt = "$SCRIPT_DIR\Tools\VirusTotal-CLI\vt.exe"
# yq
$script:yq = "$SCRIPT_DIR\Tools\yq\yq_windows_amd64.exe"
# Configuration File (JSON)
if(!(Test-Path "$PSScriptRoot\Config.json"))
{
Write-Host "[Error] Config.json NOT found." -ForegroundColor Red
Exit
}
else
{
$Config = Get-Content "$PSScriptRoot\Config.json" | ConvertFrom-Json
# BackgroundColor
if ($Config.ImportExcel.BackgroundColor)
{
if ($Config.ImportExcel.BackgroundColor -cnotmatch '^(([0-1]?[0-9]?[0-9])|([2][0-4][0-9])|(25[0-5])),(([0-1]?[0-9]?[0-9])|([2][0-4][0-9])|(25[0-5])),(([0-1]?[0-9]?[0-9])|([2][0-4][0-9])|(25[0-5]))$') # <0-255>,<0-255>,<0-255>
{
Write-Host "[Error] You must provide a valid RGB Color Code." -ForegroundColor Red
Return
}
}
# Excel - Color Scheme
$script:BackgroundColor = [System.Drawing.Color]$Config.ImportExcel.BackgroundColor
$script:FontColor = $Config.ImportExcel.FontColor
# VirusTotal CLI - API Key
$script:APIKey = $Config.VirusTotal.APIKey
}
#endregion Declarations
#############################################################################################################################################################################################
#############################################################################################################################################################################################
#region Initialisations
# Set Progress Preference to Silently Continue
$script:ProgressPreference = 'SilentlyContinue'
#endregion Initialisations
#############################################################################################################################################################################################
#############################################################################################################################################################################################
#region Header
# Windows Title
$DefaultWindowsTitle = $Host.UI.RawUI.WindowTitle
$Host.UI.RawUI.WindowTitle = "KnockKnock-Analyzer v0.1 - Automated Forensic Analysis of KnockKnock Findings for DFIR"
# Check if the PowerShell script is being run with admin rights
if (!([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
Write-Host "[Error] This PowerShell script must be run with admin rights." -ForegroundColor Red
Exit
}
# Check if PowerShell module 'ImportExcel' is installed
if (!(Get-Module -ListAvailable -Name ImportExcel))
{
Write-Host "[Error] Please install 'ImportExcel' PowerShell module." -ForegroundColor Red
Write-Host "[Info] Check out: https://github.com/dfinke/ImportExcel"
Exit
}
# Check if jq-windows-amd64.exe exists
if (!(Test-Path "$($jq)"))
{
Write-Host "[Error] jq-windows-amd64.exe NOT found." -ForegroundColor Red
Stop-Transcript
$Host.UI.RawUI.WindowTitle = "$DefaultWindowsTitle"
Exit
}
# Flush Output Directory
if (Test-Path "$OUTPUT_FOLDER")
{
Get-ChildItem -Path "$OUTPUT_FOLDER" -Force -Recurse -ErrorAction SilentlyContinue | Remove-Item -Force -Recurse
New-Item "$OUTPUT_FOLDER" -ItemType Directory -Force | Out-Null
}
else
{
New-Item "$OUTPUT_FOLDER" -ItemType Directory -Force | Out-Null
}
# Function Get-FileSize
Function Get-FileSize()
{
Param ([long]$Length)
If ($Length -gt 1TB) {[string]::Format("{0:0.00} TB", $Length / 1TB)}
ElseIf ($Length -gt 1GB) {[string]::Format("{0:0.00} GB", $Length / 1GB)}
ElseIf ($Length -gt 1MB) {[string]::Format("{0:0.00} MB", $Length / 1MB)}
ElseIf ($Length -gt 1KB) {[string]::Format("{0:0.00} KB", $Length / 1KB)}
ElseIf ($Length -gt 0) {[string]::Format("{0:0.00} Bytes", $Length)}
Else {""}
}
Function Test-Csv {
<#
.SYNOPSIS
Test-Csv - Fast Check if CSV is NOT empty
.DESCRIPTION
The Test-Csv cmdlet checks if the rows of your CSV file are NOT empty.
.PARAMETER Path
Specifies the path to the CSV file.
.PARAMETER MaxLines
Specifies the maximum of lines to read from CSV file.
.PARAMETER NoHeader (Optional)
If this switch is specified, function will NOT skip first line of the file.
.EXAMPLE
Test-Csv -Path <CSV> -MaxLines 2
.EXAMPLE
Test-Csv -Path <CSV> -MaxLines 1 -NoHeader
.NOTES
Author - Martin Willing
.LINK
https://lethal-forensics.com/
#>
Param
(
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[string]$Path,
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[ValidateRange(1, [int]::MaxValue)]
[int]$MaxLines,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[switch]$NoHeader
)
Begin
{
$Quotes = '"'
$Delimiter = ','
$Regex = "$Delimiter(?=(?:[^$Quotes]|$Quotes[^$Quotes]*$Quotes)*$)"
}
Process
{
$Reader = New-Object -TypeName System.IO.StreamReader -ArgumentList $Path -ErrorAction Stop
$CsvRawLinesCount = 0
$CsvDataLinesCount = 0
while($null -ne ($Line = $Reader.ReadLine()))
{
$CsvRawLinesCount++
if(!$NoHeader -and ($CsvRawLinesCount -eq 1))
{
continue
}
if($CsvRawLinesCount -gt $MaxLines)
{
break
}
if($Line -match $Regex)
{
$CsvDataLinesCount++
}
}
}
End
{
$Reader.Close()
$Reader.Dispose()
if($CsvDataLinesCount -gt 0)
{
$true
}
else
{
$false
}
}
}
# Select JSON File (KnockKnock_Results_yyyy-MM-dd.json) --> Default Report and Detailed Report (-verbose) supported
if(!($Path))
{
Function Get-LogFile($InitialDirectory)
{
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.InitialDirectory = $InitialDirectory
$OpenFileDialog.Filter = "KnockKnock|KnockKnock_Results_*.json|All Files (*.*)|*.*"
$OpenFileDialog.ShowDialog()
$OpenFileDialog.Filename
$OpenFileDialog.ShowHelp = $true
$OpenFileDialog.Multiselect = $false
}
$Result = Get-LogFile
if($Result -eq "OK")
{
$script:LogFile = $Result[1]
}
else
{
$Host.UI.RawUI.WindowTitle = "$DefaultWindowsTitle"
Exit
}
}
else
{
$script:LogFile = $Path
}
# Create a record of your PowerShell session to a text file
Start-Transcript -Path "$OUTPUT_FOLDER\Transcript.txt"
# Get Start Time
$startTime = (Get-Date)
# Logo
$Logo = @"
██╗ ███████╗████████╗██╗ ██╗ █████╗ ██╗ ███████╗ ██████╗ ██████╗ ███████╗███╗ ██╗███████╗██╗ ██████╗███████╗
██║ ██╔════╝╚══██╔══╝██║ ██║██╔══██╗██║ ██╔════╝██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝██║██╔════╝██╔════╝
██║ █████╗ ██║ ███████║███████║██║█████╗█████╗ ██║ ██║██████╔╝█████╗ ██╔██╗ ██║███████╗██║██║ ███████╗
██║ ██╔══╝ ██║ ██╔══██║██╔══██║██║╚════╝██╔══╝ ██║ ██║██╔══██╗██╔══╝ ██║╚██╗██║╚════██║██║██║ ╚════██║
███████╗███████╗ ██║ ██║ ██║██║ ██║███████╗ ██║ ╚██████╔╝██║ ██║███████╗██║ ╚████║███████║██║╚██████╗███████║
╚══════╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═════╝╚══════╝
"@
Write-Output ""
Write-Output "$Logo"
Write-Output ""
# Header
Write-Output "KnockKnock-Analyzer v0.1 - Automated Forensic Analysis of KnockKnock Findings for DFIR"
Write-Output "(c) 2026 Martin Willing at Lethal-Forensics (https://lethal-forensics.com/)"
Write-Output ""
# Analysis date (ISO 8601)
$AnalysisDate = [datetime]::Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss")
Write-Output "Analysis date: $AnalysisDate UTC"
Write-Output ""
# Create HashTable and import 'WhitelistedFiles.csv'
$script:WhitelistedFiles_HashTable = [ordered]@{}
if (Test-Path "$SCRIPT_DIR\Tools\KnockKnock\Whitelists\WhitelistedFiles.csv")
{
if(Test-Csv -Path "$SCRIPT_DIR\Tools\KnockKnock\Whitelists\WhitelistedFiles.csv" -MaxLines 2)
{
Import-Csv "$SCRIPT_DIR\Tools\KnockKnock\Whitelists\WhitelistedFiles.csv" -Delimiter "," -Encoding UTF8 | ForEach-Object { $WhitelistedFiles_HashTable[$_.MD5] = $_.Info }
# Count Ingested Properties
$Count = $WhitelistedFiles_HashTable.Count
Write-Output "[Info] Initializing 'WhitelistedFiles.csv' Lookup Table ($Count) ..."
}
}
#endregion Header
#############################################################################################################################################################################################
#############################################################################################################################################################################################
#region Analysis
# KnockKnock - Like AutoRuns ...but for macOS!
# https://objective-see.org/products/knockknock.html
# Notarized
# Notarization is the term Apple gives to the process of uploading an asset to Apple for inspection.
# In order to help safeguard and control their software ecoysystems. Apple imposes requirements that applications and installers be inspected by Apple before they are allowed to run on Apple operating systems - either at all or without scary warning signs.
# Check if JSON File exists
if (!(Test-Path "$($LogFile)"))
{
Write-Host "[Error] $LogFile does not exist." -ForegroundColor Red
Write-Host ""
Stop-Transcript
$Host.UI.RawUI.WindowTitle = "$DefaultWindowsTitle"
Exit
}
# Check File Extension
$Extension = [IO.Path]::GetExtension($LogFile)
if (!($Extension -eq ".json" ))
{
Write-Host "[Error] No JSON File provided." -ForegroundColor Red
Stop-Transcript
$Host.UI.RawUI.WindowTitle = "$DefaultWindowsTitle"
Exit
}
$FileName = [IO.Path]::GetFileName($LogFile)
Write-Output "[Info] Processing KnockKnock Findings ($FileName) ..."
# MD5 Hash
$MD5 = (Get-FileHash -LiteralPath "$LogFile" -Algorithm MD5).Hash
Write-Output "[Info] MD5 Hash: $MD5"
# SHA1 Hash
$SHA1 = (Get-FileHash -LiteralPath "$LogFile" -Algorithm SHA1).Hash
Write-Output "[Info] SHA1 Hash: $SHA1"
# SHA256 Hash
$SHA256 = (Get-FileHash -LiteralPath "$LogFile" -Algorithm SHA256).Hash
Write-Output "[Info] SHA256 Hash: $SHA256"
# Input Size
$InputSize = Get-FileSize((Get-Item "$LogFile").Length)
Write-Output "[Info] Total Input Size: $InputSize"
# Count rows of JSON (w/ thousands separators)
$Count = 0
switch -File "$LogFile" { default { ++$Count } }
$Rows = '{0:N0}' -f $Count
Write-Output "[Info] Total Lines: $Rows"
# Processing KnockKnock Findings (KnockKnock_Results_yyyy-MM-dd.json)
New-Item "$OUTPUT_FOLDER\KnockKnock\JSON" -ItemType Directory -Force | Out-Null
New-Item "$OUTPUT_FOLDER\KnockKnock\CSV" -ItemType Directory -Force | Out-Null
New-Item "$OUTPUT_FOLDER\KnockKnock\XLSX" -ItemType Directory -Force | Out-Null
# Check for KnockKnock Pretty Format
if ($Count -eq "1")
{
# Check for KnockKnock Verbose Information (Detailed Report)
if (Get-Content "$LogFile" | Select-String -Pattern "Starting KnockKnock scan..." -CaseSensitive -Quiet)
{
# Import JSON (from last line)
$Data = Get-Content "$LogFile" -Tail 1 | ConvertFrom-Json
$JSON = Get-Content "$LogFile" -Tail 1
}
else
{
# Import JSON
$Data = Get-Content "$LogFile" | ConvertFrom-Json
$JSON = Get-Content "$LogFile"
}
}
else
{
# Check for KnockKnock Verbose Information (Detailed Report)
if (Get-Content "$LogFile" | Select-String -Pattern "Starting KnockKnock scan..." -CaseSensitive -Quiet)
{
# Import JSON (and exclude Verbose Information)
$Content = Get-Content "$LogFile" -Raw
$JSON = if ($Content -match "{(?s)(.*)") {$Matches[0]}
$Data = $JSON | ConvertFrom-Json
}
else
{
# Import JSON
$Data = Get-Content "$LogFile" | ConvertFrom-Json
$JSON = Get-Content "$LogFile"
}
}
# Total Entries
$Total = $JSON | & $jq 'map(length) | add'
Write-Output "[Info] $Total Persistent Item(s) found"
# Check if VirusTotal Lookup was enabled
if (Get-Content "$LogFile" | Select-String -Pattern "VT detection" -CaseSensitive -Quiet)
{
$ExcludeApple = $JSON | & $jq -r 'map(.[] | select(.""signature(s)"" | ."signatureSigner" != "1")) | .[]'
[int]$FlaggedItems = ($JSON | & $jq -r '.[] | .[] | .""VT detection"" | select( . != null )' | Select-String -Pattern "^0" -NotMatch | Measure-Object).Count
[int]$UnknownItems = ($ExcludeApple | & $jq -r '.""VT detection""' | Select-String -Pattern "^0/0" | Measure-Object).Count
if ($FlaggedItems = "0")
{
Write-Host "[Info] $FlaggedItems Flagged Item(s)" -ForegroundColor Green
}
else
{
Write-Host "[ALERT] $FlaggedItems Flagged Item(s)" -ForegroundColor Red
}
Write-Host "[Info] $UnknownItems Unknown Item(s)" -ForegroundColor Yellow
}
else
{
Write-Host "[Info] VirusTotal Results: N/A (Disabled)" -ForegroundColor Yellow
}
# MD5 Hash List
$MD5 = $JSON | & $jq -r '.[] | map(."hashes" | .md5) | .[] | select( . != null )' | Sort-Object -Unique
($MD5 | Out-String).Trim() | Out-File "$OUTPUT_FOLDER\KnockKnock\MD5.txt"
$Count = ($MD5 | Measure-Object).Count
Write-Output "[Info] $Count MD5 Hashes found ($Total)"
# Check if 'WhitelistedFiles.csv' contains MD5
$Whitelisted=0
foreach ($FileHash in $MD5) {
if(!($WhitelistedFiles_HashTable.Contains("$FileHash")))
{
Write-Output "$FileHash" | Out-File "$OUTPUT_FOLDER\KnockKnock\Unknown_MD5.txt" -Append
}
else
{
# Whitelist
# https://github.com/objective-see/KnockKnock/tree/main/WhiteList
Write-Output "$FileHash" | Out-File "$OUTPUT_FOLDER\KnockKnock\Whitelisted_MD5.txt" -Append
$Whitelisted++
}
}
Write-Output "[Info] $Whitelisted whitelisted MD5 Hashes found ($Count)"
# SHA1 Hash List
($JSON | & $jq -r '.[] | map(."hashes" | .sha1) | .[] | select( . != null )' | Sort-Object -Unique | Out-String).Trim() | Out-File "$OUTPUT_FOLDER\KnockKnock\SHA1.txt"
# SHA256 Hash List
($JSON | & $jq -r '.[] | map(."hashes" | .sha256) | .[] | select( . != null )' | Sort-Object -Unique | Out-String).Trim() | Out-File "$OUTPUT_FOLDER\KnockKnock\SHA256.txt"
# Categories (Overview)
$JSON | & $jq -r 'keys | .[]' | Out-File "$OUTPUT_FOLDER\KnockKnock\Categories.txt" -Encoding UTF8
$Total = ($JSON | & $jq -r 'keys | .[]' | Measure-Object).Count
$Count = ($JSON | & $jq -r 'with_entries(select(.value != [])) | keys | .[]' | Measure-Object).Count
Write-Output "[Info] $Count Categories found ($Total)"
if ($Total -gt "20")
{
Write-Host "[Info] New Category found. Please check!" -ForegroundColor Yellow
}
# KnockKnock v4.0.3
# 1. Authorization Plugins
# 2. Background Managed Tasks
# 3. Browser Extensions
# 4. Cron Jobs
# 5. Dir. Services Plugins
# 6. Dock Tiles Plugins
# 7. Event Rules
# 8. Extensions and Widgets
# 9. Kernel Extensions
# 10. Launch Items
# 11. Library Inserts
# 12. Library Proxies
# 13. Login Items
# 14. Login/Logout Hooks
# 15. Periodic Scripts
# 16. Quicklook Plugins
# 17. Shell Configuration Files
# 18. Spotlight Importers
# 19. Startup Scripts
# 20. System Extensions
# Categories
# JSON
$Data.'Authorization Plugins' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\1-AuthorizationPlugins.json" -Encoding UTF8
$Data.'Background Managed Tasks' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\2-BackgroundManagedTasks.json" -Encoding UTF8
$Data.'Browser Extensions' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\3-BrowserExtensions.json" -Encoding UTF8
$Data.'Cron Jobs' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\4-CronJobs.json" -Encoding UTF8
$Data.'Dir. Services Plugins' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\5-DirectoryServicesPlugins.json" -Encoding UTF8
$Data.'Dock Tiles Plugins' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\6-DockTilesPlugins.json" -Encoding UTF8
$Data.'Event Rules' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\7-EventRules.json" -Encoding UTF8
$Data.'Extensions and Widgets' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\8-ExtensionsWidgets.json" -Encoding UTF8
$Data.'Kernel Extensions' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\9-KernelExtensions.json" -Encoding UTF8
$Data.'Launch Items' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\10-LaunchItems.json" -Encoding UTF8
$Data.'Library Inserts' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\11-LibraryInserts.json" -Encoding UTF8
$Data.'Library Proxies' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\12-LibraryProxies.json" -Encoding UTF8
$Data.'Login Items' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\13-LoginItems.json" -Encoding UTF8
$Data.'Login/Logout Hooks' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\14-LoginLogoutHooks.json" -Encoding UTF8
$Data.'Periodic Scripts' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\15-PeriodicScripts.json" -Encoding UTF8
$Data.'Quicklook Plugins' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\16-QuicklookPlugins.json" -Encoding UTF8
$Data.'Shell Configuration Files' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\17-ShellConfigurationFiles.json" -Encoding UTF8
$Data.'Spotlight Importers' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\18-SpotlightImporters.json" -Encoding UTF8
$Data.'Startup Scripts' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\19-StartupScripts.json" -Encoding UTF8
$Data.'System Extensions' | ConvertTo-Json -Depth 5 | Out-File "$OUTPUT_FOLDER\KnockKnock\JSON\20-SystemExtensions.json" -Encoding UTF8
# Stats
if ($PSEdition -eq "Core")
{
$AuthorizationPlugins = $JSON | & $jq '."Authorization Plugins" | length'
$BackgroundManagedTasks = $JSON | & $jq '."Background Managed Tasks" | length'
$BrowserExtensions = $JSON | & $jq '."Browser Extensions" | length'
$CronJobs = $JSON | & $jq '."Cron Jobs" | length'
$DirectoryServicesPlugins = $JSON | & $jq '."Dir. Services Plugins" | length'
$DockTilesPlugins = $JSON | & $jq '."Dock Tiles Plugins" | length'
$EventRules = $JSON | & $jq '."Event Rules" | length'
$ExtensionsWidgets = $JSON | & $jq '."Extensions and Widgets" | length'
$KernelExtensions = $JSON | & $jq '."Kernel Extensions" | length'
$LaunchItems = $JSON | & $jq '."Launch Items" | length'
$LibraryInserts = $JSON | & $jq '."Library Inserts" | length'
$LibraryProxies = $JSON | & $jq '."Library Proxies" | length'
$LoginItems = $JSON | & $jq '."Login Items" | length'
$LoginLogoutHooks = $JSON | & $jq '."Login/Logout Hooks" | length'
$PeriodicScripts = $JSON | & $jq '."Periodic Scripts" | length'
$QuicklookPlugins = $JSON | & $jq '."Quicklook Plugins" | length'
$ShellConfigurationFiles = $JSON | & $jq '."Shell Configuration Files" | length'
$SpotlightImporters = $JSON | & $jq '."Spotlight Importers" | length'
$StartupScripts = $JSON | & $jq '."Startup Scripts" | length'
$SystemExtensions = $JSON | & $jq '."System Extensions" | length'
}
else
{
$AuthorizationPlugins = $JSON | & $jq '.""Authorization Plugins"" | length'
$BackgroundManagedTasks = $JSON | & $jq '.""Background Managed Tasks"" | length'
$BrowserExtensions = $JSON | & $jq '.""Browser Extensions"" | length'
$CronJobs = $JSON | & $jq '.""Cron Jobs"" | length'
$DirectoryServicesPlugins = $JSON | & $jq '.""Dir. Services Plugins"" | length'
$DockTilesPlugins = $JSON | & $jq '.""Dock Tiles Plugins"" | length'
$EventRules = $JSON | & $jq '.""Event Rules"" | length'
$ExtensionsWidgets = $JSON | & $jq '.""Extensions and Widgets"" | length'
$KernelExtensions = $JSON | & $jq '.""Kernel Extensions"" | length'
$LaunchItems = $JSON | & $jq '.""Launch Items"" | length'
$LibraryInserts = $JSON | & $jq '.""Library Inserts"" | length'
$LibraryProxies = $JSON | & $jq '.""Library Proxies"" | length'
$LoginItems = $JSON | & $jq '.""Login Items"" | length'
$LoginLogoutHooks = $JSON | & $jq '.""Login/Logout Hooks"" | length'
$PeriodicScripts = $JSON | & $jq '.""Periodic Scripts"" | length'
$QuicklookPlugins = $JSON | & $jq '.""Quicklook Plugins"" | length'
$ShellConfigurationFiles = $JSON | & $jq '.""Shell Configuration Files"" | length'
$SpotlightImporters = $JSON | & $jq '.""Spotlight Importers"" | length'
$StartupScripts = $JSON | & $jq '.""Startup Scripts"" | length'
$SystemExtensions = $JSON | & $jq '.""System Extensions"" | length'
}
Write-Output ""
Write-Output "[Info] Authorization Plugins: $AuthorizationPlugins"
Write-Output "[Info] Background Managed Tasks: $BackgroundManagedTasks"
Write-Output "[Info] Browser Extensions: $BrowserExtensions"
Write-Output "[Info] Cron Jobs: $CronJobs"
Write-Output "[Info] Directory Services Plugins: $DirectoryServicesPlugins"
Write-Output "[Info] Dock Tiles Plugins: $DockTilesPlugins"
Write-Output "[Info] Event Rules: $EventRules"
Write-Output "[Info] Extensions and Widgets: $ExtensionsWidgets"
Write-Output "[Info] Kernel Extensions: $KernelExtensions"
Write-Output "[Info] Launch Items: $LaunchItems"
Write-Output "[Info] Library Inserts: $LibraryInserts"
Write-Output "[Info] Library Proxies: $LibraryProxies"
Write-Output "[Info] Login Items: $LoginItems"
Write-Output "[Info] Login/Logout Hooks: $LoginLogoutHooks"
Write-Output "[Info] Periodic Scripts: $PeriodicScripts"
Write-Output "[Info] Quicklook Plugins: $QuicklookPlugins"
Write-Output "[Info] Shell Configuration Files: $ShellConfigurationFiles"
Write-Output "[Info] Spotlight Importers: $SpotlightImporters"
Write-Output "[Info] Startup Scripts: $StartupScripts"
Write-Output "[Info] System Extensions: $SystemExtensions"
# Signature Signer --> Tells you "who signed it".
$SignerKeys = @{
0 = "None"
1 = "Apple"
2 = "App Store"
3 = "Developer ID"
4 = "AdHoc"
}
# Signature Status --> Tells you if the code signing checks passed. A non-zero value will be the error returned by the OS.
# Note: Check Unknown Error Code --> https://www.osstatus.com/
# https://eclecticlight.co/2022/09/17/how-to-check-an-apps-signature/
$StatusKeys = @{
0 = "Valid" # Error Name
-67007 = "WeakResourceEnvelope" # errSecCSWeakResourceEnvelope
-67008 = "UnsealedFrameworkRoot" # errSecCSUnsealedFrameworkRoot
-67013 = "WeakResourceRules" # errSecCSWeakResourceRules
-67021 = "BadNestedCode" # errSecCSBadNestedCode
-67023 = "ResourceDirectoryFailed" # errSecCSResourceDirectoryFailed
-67028 = "BadBundleFormat" # errSecCSBadBundleFormat
-67029 = "NoMainExecutable" # errSecCSNoMainExecutable
-67030 = "InfoPlistFailed" # errSecCSInfoPlistFailed
-67049 = "BadObjectFormat" # errSecCSBadObjectFormat
-67050 = "RequirementsFailed" # errSecCSReqFailed
-67051 = "RequirementsUnsupported" # errSecCSReqUnsupported
-67052 = "RequirementsInvalid" # errSecCSReqInvalid
-67053 = "ResourceRulesInvalid" # errSecCSResourceRulesInvalid
-67054 = "BadResource" # errSecCSBadResource
-67055 = "ResourcesInvalid" # errSecCSResourcesInvalid
-67056 = "ResourcesNotFound" # errSecCSResourcesNotFound
-67057 = "ResourcesNotSealed" # errSecCSResourcesNotSealed
-67058 = "BadDictionaryFormat" # errSecCSBadDictionaryFormat
-67059 = "Unsupported" # errSecCSSignatureUnsupported
-67060 = "NotVerifiable" # errSecCSSignatureNotVerifiable
-67061 = "Invalid" # errSecCSSignatureFailed
-67062 = "Unsigned" # errSecCSUnsigned
-67072 = "Unimplemented" # errSecCSUnimplemented
}
# Signature Flags --> Code Signing Attributes (CodeSignAttrs)
# https://docs.hdoc.io/hdoc/llvm-project/e9A2AC4ABC3B174A7.html
# https://newosxbook.com/code/xnu-3789.70.16/bsd/sys/codesign.h
[Flags()] enum SignatureFlags
{
CS_VALID = 1 # dynamically valid
CS_ADHOC = 2 # ad hoc signed
CS_GET_TASK_ALLOW = 4 # has get-task-allow entitlement
CS_INSTALLER = 8 # has installer entitlement
CS_FORCED_LV = 16
CS_INVALID_ALLOWED = 32
CS_HARD = 256 # don't load invalid pages
CS_KILL = 512 # kill process if it becomes invalid
CS_CHECK_EXPIRATION = 1024 # force expiration checking
CS_RESTRICT = 2048 # tell dyld to treat restricted
CS_ENFORCEMENT = 4096 # require enforcement
CS_REQUIRE_LV = 8192 # require library validation
CS_ENTITLEMENTS_VALIDATED = 16384 # code signature permits restricted entitlements
CS_NVRAM_UNRESTRICTED = 32768
CS_RUNTIME = 65536
CS_LINKER_SIGNED = 131072
CS_ALLOWED_MACHO = 212738
CS_EXEC_SET_HARD = 1048576 # set CS_HARD on any exec'ed process
CS_EXEC_SET_KILL = 2097152 # set CS_KILL on any exec'ed process
CS_EXEC_SET_ENFORCEMENT = 4194304 # set CS_ENFORCEMENT on any exec'ed process
CS_EXEC_INHERIT_SIP = 8388608 # set CS_INSTALLER on any exec'ed process
CS_KILLED = 16777216 # was killed by kernel for invalidity
CS_DYLD_PLATFORM = 33554432 # dyld used to load this is a platform binary
CS_PLATFORM_BINARY = 67108864 # this is a platform binary
CS_PLATFORM_PATH = 134217728 # platform binary by the fact of path
CS_DEBUGGED = 268435456 # process is currently or has previously been debugged and allowed to run with invalid pages
CS_SIGNED = 536870912 # process has a signature (may have gone invalid)
CS_DEV_CODE = 1073741824 # code is dev signed, cannot be loaded into prod signed code
}
#############################################################################################################################################################################################
# CSV / XLSX
# Check if VirusTotal Lookup was enabled
if (Get-Content "$LogFile" | Select-String -Pattern "VT detection" -CaseSensitive -Quiet)
{
# 1. Authorization Plugins
$Records = $Data.'Authorization Plugins'
$Results = [Collections.Generic.List[PSObject]]::new()
ForEach($Record in $Records)
{
$Hashes = $Record | Select-Object -ExpandProperty hashes
$Signatures = $Record | Select-Object -ExpandProperty "signature(s)"
$SignatureAuthorities = ($Signatures | Select-Object -ExpandProperty signatureAuthorities -ErrorAction SilentlyContinue) -join ", "
# Flags
if ($Signatures.signingFlags -eq "0")
{
$Flags = "0"
}
else
{
if ($Signatures.signingFlags)
{
$Flags = [SignatureFlags] $Signatures.signingFlags
}
else
{
$Flags = "Not Signed"
}
}
# Status
if($StatusKeys.ContainsKey($Signatures.signatureStatus))
{
$Status = $StatusKeys[$Signatures.signatureStatus]
}
else
{
$Status = "Unknown"
}
# Signer
if($Signatures.signatureSigner)
{
if($SignerKeys.ContainsKey($Signatures.signatureSigner))
{
$Signer = $SignerKeys[$Signatures.signatureSigner]
}
else
{
$Signer = "Unknown"
}
}
else
{
$Signer = "N/A"
}
# Identifier
if($Signatures.signatureIdentifier)
{
$Identifier = $Signatures.signatureIdentifier
}
else
{
$Identifier = "N/A"
}
$Line = [PSCustomObject]@{
"Name" = $Record.name
"Path" = $Record.path
"Plist" = $Record.plist | ForEach-Object { $_.Replace("n/a","N/A") }
"MD5" = $Hashes.md5
"SHA1" = $Hashes.sha1
"SHA256" = $Hashes.sha256
"VirusTotal" = $Record."VT detection"
"Signing Flags" = $Flags
"Signature Status" = $Status
"Signature Signer" = $Signer
"Signature Identifier" = $Identifier
"Signature Authorities" = $SignatureAuthorities
}
$Results.Add($Line)
}
$Results | Export-Csv -Path "$OUTPUT_FOLDER\KnockKnock\CSV\1-AuthorizationPlugins.csv" -NoTypeInformation -Encoding UTF8
# XLSX
if (Test-Path "$OUTPUT_FOLDER\KnockKnock\CSV\1-AuthorizationPlugins.csv")
{
if(Test-Csv -Path "$OUTPUT_FOLDER\KnockKnock\CSV\1-AuthorizationPlugins.csv" -MaxLines 2)
{
$IMPORT = Import-Csv "$OUTPUT_FOLDER\KnockKnock\CSV\1-AuthorizationPlugins.csv" -Delimiter ","
$IMPORT | Export-Excel -Path "$OUTPUT_FOLDER\KnockKnock\XLSX\1-AuthorizationPlugins.xlsx" -NoNumberConversion * -FreezeTopRow -BoldTopRow -AutoSize -AutoFilter -WorkSheetname "Authorization Plugins" -CellStyleSB {
param($WorkSheet)
# BackgroundColor and FontColor for specific cells of TopRow
Set-Format -Address $WorkSheet.Cells["A1:L1"] -BackgroundColor $BackgroundColor -FontColor $FontColor
# HorizontalAlignment "Center" of columns A-A and C-K
$WorkSheet.Cells["A:A"].Style.HorizontalAlignment="Center"
$WorkSheet.Cells["C:K"].Style.HorizontalAlignment="Center"
# ConditionalFormatting - VirusTotal
$LastRow = $WorkSheet.Dimension.End.Row
Add-ConditionalFormatting -Address $WorkSheet.Cells["G2:$LastRow"] -WorkSheet $WorkSheet -RuleType 'Expression' '(ISERROR(FIND("0/",$G1)))' -BackgroundColor Red
Add-ConditionalFormatting -Address $WorkSheet.Cells["G:G"] -WorkSheet $WorkSheet -RuleType 'Expression' 'NOT(ISERROR(FIND("0/",$G1)))' -BackgroundColor $Green
# ConditionalFormatting - Signature Status
Add-ConditionalFormatting -Address $WorkSheet.Cells["I:I"] -WorkSheet $WorkSheet -RuleType 'Expression' 'NOT(ISERROR(FIND("Valid",$I1)))' -BackgroundColor $Green
Add-ConditionalFormatting -Address $WorkSheet.Cells["I:I"] -WorkSheet $WorkSheet -RuleType 'Expression' 'NOT(ISERROR(FIND("Unsigned",$I1)))' -BackgroundColor Red
# ConditionalFormatting - Signing Signer
Add-ConditionalFormatting -Address $WorkSheet.Cells["J:J"] -WorkSheet $WorkSheet -RuleType 'Expression' 'NOT(ISERROR(FIND("Apple",$J1)))' -BackgroundColor $Green
Add-ConditionalFormatting -Address $WorkSheet.Cells["J:J"] -WorkSheet $WorkSheet -RuleType 'Expression' 'NOT(ISERROR(FIND("AdHoc",$J1)))' -BackgroundColor $Orange
}
}
}
# 2. Background Managed Tasks
$Records = $Data.'Background Managed Tasks'
$Results = [Collections.Generic.List[PSObject]]::new()
ForEach($Record in $Records)
{
$Hashes = $Record | Select-Object -ExpandProperty hashes
$Signatures = $Record | Select-Object -ExpandProperty "signature(s)"
$SignatureAuthorities = ($Signatures | Select-Object -ExpandProperty signatureAuthorities -ErrorAction SilentlyContinue) -join ", "
# Flags
if ($Signatures.signingFlags -eq "0")
{
$Flags = "0"
}
else
{
if ($Signatures.signingFlags)
{
$Flags = [SignatureFlags] $Signatures.signingFlags
}
else
{
$Flags = "Not Signed"
}
}
# IsNotarized
if ($Signatures.notarized -eq "True")
{
$IsNotarized = "True"
}
else
{
$IsNotarized = "False"
}
# Status
if($StatusKeys.ContainsKey($Signatures.signatureStatus))
{
$Status = $StatusKeys[$Signatures.signatureStatus]
}
else
{
$Status = "Unknown"
}
# Signer
if($Signatures.signatureSigner)
{
if($SignerKeys.ContainsKey($Signatures.signatureSigner))
{
$Signer = $SignerKeys[$Signatures.signatureSigner]
}
else
{
$Signer = "Unknown"
}
}
else
{
$Signer = "N/A"
}
# Identifier
if($Signatures.signatureIdentifier)
{
$Identifier = $Signatures.signatureIdentifier
}
else
{
$Identifier = "N/A"
}
# Authorities
if($SignatureAuthorities)
{
$Authorities = $SignatureAuthorities
}
else
{
$Authorities = "N/A"
}
$Line = [PSCustomObject]@{
"Name" = $Record.name
"Path" = $Record.path
"Plist" = $Record.plist | ForEach-Object { $_.Replace("n/a","N/A") }
"MD5" = $Hashes.md5
"SHA1" = $Hashes.sha1
"SHA256" = $Hashes.sha256
"VirusTotal" = $Record."VT detection"
"Signing Flags" = $Flags
"IsNotarized" = $IsNotarized
"Signature Status" = $Status