mirror of
https://github.com/MadMin3r/UnconfuserEx
synced 2026-06-23 09:25:19 +00:00
Fix block signature in switch deobfuscator
This commit is contained in:
@@ -26,7 +26,7 @@ namespace UnConfuserEx.Protections.AntiDebug
|
||||
{
|
||||
var cctor = module.GlobalType.FindStaticConstructor();
|
||||
|
||||
if (cctor == null || !(cctor.HasBody))
|
||||
if (cctor == null || !(cctor.HasBody) || cctor.Body.Instructions.Count == 0)
|
||||
return false;
|
||||
|
||||
IList<Instruction> instrs;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace UnConfuserEx.Protections.AntiDump
|
||||
{
|
||||
var cctor = module.GlobalType.FindStaticConstructor();
|
||||
|
||||
if (cctor == null || !(cctor.HasBody))
|
||||
if (cctor == null || !(cctor.HasBody) || cctor.Body.Instructions.Count == 0)
|
||||
return false;
|
||||
|
||||
IList<Instruction> instrs;
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace UnConfuserEx.Protections
|
||||
{
|
||||
var cctor = module.GlobalType.FindStaticConstructor();
|
||||
|
||||
if (cctor == null || !(cctor.HasBody))
|
||||
if (cctor == null || !(cctor.HasBody) || cctor.Body.Instructions.Count == 0)
|
||||
return null;
|
||||
|
||||
IList<Instruction> instrs;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace UnConfuserEx.Protections
|
||||
{
|
||||
var cctor = module.GlobalType.FindStaticConstructor();
|
||||
|
||||
if (cctor == null || !(cctor.HasBody))
|
||||
if (cctor == null || !(cctor.HasBody) || cctor.Body.Instructions.Count == 0)
|
||||
return false;
|
||||
|
||||
IList<Instruction> instrs;
|
||||
|
||||
@@ -145,6 +145,7 @@ namespace UnConfuserEx.Protections.ControlFlow
|
||||
processedCount++;
|
||||
}
|
||||
else if (block.Instructions.Count >= 5 &&
|
||||
block.Instructions[^1].OpCode == OpCodes.Xor &&
|
||||
block.Instructions[^2].IsLdcI4() &&
|
||||
block.Instructions[^4].IsLdcI4())
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace UnConfuserEx.Protections
|
||||
{
|
||||
var cctor = module.GlobalType.FindStaticConstructor();
|
||||
|
||||
if (cctor == null || !(cctor.HasBody))
|
||||
if (cctor == null || !(cctor.HasBody) || cctor.Body.Instructions.Count == 0)
|
||||
return false;
|
||||
|
||||
IList<Instruction> instrs;
|
||||
|
||||
@@ -100,7 +100,6 @@ namespace UnConfuserEx
|
||||
else
|
||||
{
|
||||
NativeModuleWriterOptions writerOptions = new NativeModuleWriterOptions(module, true);
|
||||
//writerOptions.MetadataOptions.Flags = MetadataFlags.PreserveAll;
|
||||
module.NativeWrite(newPath, writerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>True</UseWindowsForms>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
|
||||
Reference in New Issue
Block a user