-
Notifications
You must be signed in to change notification settings - Fork 2
/
confuserEx.ps1
40 lines (34 loc) · 1.63 KB
/
confuserEx.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
param($exePath, $outDir, $level, $toolName)
$confuserConf =
@"
<project outputDir="{{OUTPUT_DIR}}" baseDir="{{BASE_DIR}}" xmlns="http://www.google.com">
<module path="{{MODULE_PATH}}" >
<rule pattern="true" preset="{{LEVEL}}" inherit="false">
<protection id="anti ildasm" />
<protection id="anti debug" action="remove" /> <!-- this breaks Assembly.Load. Maybe just use donut? -->
<protection id="anti dump" action="remove" /> <!-- this breaks sharphound -->
<protection id="anti tamper" action="remove" /> <!-- this breaks Assembly.Load. Maybe just use donut? -->
<protection id="invalid metadata" />
<protection id="resources" action="remove" /> <!-- this breaks sharphound -->
<protection id="constants" />
<protection id="ctrl flow" />
<protection id="typescramble" action="remove" />
<protection id="rename" action="remove" /> <!-- This just killed seatbelt for some reason -->
</rule>
</module>
</project>
"@
$baseDir = Split-Path $exePath -Parent
$exeFilename = Split-Path $exePath -Leaf
# Modify configuration file with params
$confuserConf = $confuserConf.
Replace("{{OUTPUT_DIR}}", $outDir).
Replace("{{BASE_DIR}}", $baseDir).
Replace("{{LEVEL}}", $level).
Replace("{{MODULE_PATH}}", $exeFilename)
$crprojFilename = join-path -path $outDir -childpath "\$toolName.crproj"
if(!(Test-Path $outDir -PathType Container)){
New-Item -ItemType Directory -Force -Path $outDir
}
echo $confuserConf | Set-Content -path $crprojFilename
echo "[+] ConfuserEx config file written: $crprojFilename"