@@ -12,7 +12,7 @@ public class VariableOBF
12
12
"$myinvocation" , "$nestedpromptlevel" , "$pid" , "$profile" , "$psboundparameters" , "$pscmdlet" ,
13
13
"$pscommandpath" , "$psculture" , "$psdebugcontext" , "$psedition" , "$pshome" , "$psitem" , "$psscriptroot" ,
14
14
"$pssenderinfo" , "$psuiculture" , "$psversiontable" , "$pwd" , "$sender" , "$shellid" , "$stacktrace" ,
15
- "$switch" , "$this" , "$script" , "$kdot_"
15
+ "$switch" , "$this" , "$script" , "$kdot_" , "$erroractionpreference" , "$progresspreference" ,
16
16
} ;
17
17
18
18
private static readonly string [ ] choices = new [ ]
@@ -26,15 +26,15 @@ public class VariableOBF
26
26
"[bool][System.Collections.Hashtable]"
27
27
} ;
28
28
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:" } ;
30
30
private static readonly string GoodChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
31
31
private static readonly Random Random = new ( ) ;
32
32
33
33
public static string ObfuscateVariable ( string variable , bool parameter )
34
34
{
35
35
foreach ( var badPrefix in BadStart )
36
36
{
37
- if ( variable . StartsWith ( badPrefix , StringComparison . Ordinal ) )
37
+ if ( variable . StartsWith ( badPrefix , StringComparison . OrdinalIgnoreCase ) )
38
38
{
39
39
return variable ;
40
40
}
0 commit comments