Skip to content

Commit 6941ddf

Browse files
author
KingKDot
committed
more fixes for globals
1 parent fa5ad45 commit 6941ddf

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

PowerCrypt/Obfuscator/Methods/VariableObfuscation/VariableOBF.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class VariableOBF
1212
"$myinvocation", "$nestedpromptlevel", "$pid", "$profile", "$psboundparameters", "$pscmdlet",
1313
"$pscommandpath", "$psculture", "$psdebugcontext", "$psedition", "$pshome", "$psitem", "$psscriptroot",
1414
"$pssenderinfo", "$psuiculture", "$psversiontable", "$pwd", "$sender", "$shellid", "$stacktrace",
15-
"$switch", "$this", "$script", "$kdot_"
15+
"$switch", "$this", "$script", "$kdot_", "$erroractionpreference", "$progresspreference",
1616
};
1717

1818
private static readonly string[] choices = new[]
@@ -26,15 +26,15 @@ public class VariableOBF
2626
"[bool][System.Collections.Hashtable]"
2727
};
2828

29-
private static readonly HashSet<string> BadStart = new HashSet<string> { "$env:", "$script:", "$kdot_" };
29+
private static readonly HashSet<string> BadStart = new HashSet<string> { "$env:", "$script:", "$kdot_", "$global:" };
3030
private static readonly string GoodChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
3131
private static readonly Random Random = new();
3232

3333
public static string ObfuscateVariable(string variable, bool parameter)
3434
{
3535
foreach (var badPrefix in BadStart)
3636
{
37-
if (variable.StartsWith(badPrefix, StringComparison.Ordinal))
37+
if (variable.StartsWith(badPrefix, StringComparison.OrdinalIgnoreCase))
3838
{
3939
return variable;
4040
}

PowerCrypt/Obfuscator/Passes/FourthPass.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ private static List<ReplacementMapUniversal> CollectReplacements(ScriptBlockAst
4747
continue;
4848
}
4949

50-
if (isFunction)
51-
{
52-
Console.WriteLine(((FunctionDefinitionAst)node).Name);
53-
}
54-
5550
string obfuscatedText = WrapOBF.ObfuscateWithWrap(node.Extent.Text);
5651
allReplacements.Add(new ReplacementMapUniversal
5752
{

0 commit comments

Comments
 (0)