-
Notifications
You must be signed in to change notification settings - Fork 0
/
Add_root_trust_for_signed_PE.ps1
53 lines (35 loc) · 1.22 KB
/
Add_root_trust_for_signed_PE.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
#Author: https://github.com/terracuda/workpow
#Welcome message
clear-host
echo ""
echo " ___________________________ "
echo "| |"
echo "| SignTruster v1.1 |"
echo "| Author: TerraCuda |"
echo "|___________________________|"
echo ""
#Variables
$path = (Get-Item -Path ".\").FullName
$trusted_path = "cert:\localmachine\authroot"
$signfiles = Get-ChildItem $path -Exclude '*.ps1' | ForEach-object {Get-AuthenticodeSignature $_} | Where-Object {$_.Status -ne "NotSigned"}
$signTotcount = ($signfiles).count
# $DateStamp = get-date
if ($signTotcount -gt 0)
{
echo "$signTotcount signed executable files were found:"
foreach($signfile in $signfiles)
{
$cert = ($signfile).SignerCertificate
Export-Certificate -Cert $cert -FilePath $path\temp.p7b -Type p7b | Out-Null
Start-Sleep -m 200
Import-Certificate -filepath $path\temp.p7b -CertStoreLocation $trusted_path | Out-Null
Start-Sleep -m 200
Remove-item $path\temp.p7b -Confirm:$false -Force
Start-Sleep -m 200
echo $cert
echo "----------------------------------------"
}
exit
}
echo "Please put the signed executable files into this folder."
exit