Remove all invalid methods

This commit is contained in:
de4dot 2012-02-12 16:29:29 +01:00
parent 4691c805d8
commit c2d13d9059
2 changed files with 14 additions and 0 deletions

View File

@ -273,6 +273,8 @@ namespace de4dot.code.deobfuscators.CodeVeil {
addTypeToBeRemoved(proxyDelegateFinder.MethodInfoType, "Obfuscator proxy method MethodInfo type");
}
addMethodsToBeRemoved(InvalidMethodsFinder.findInvalidMethods(module), "Anti-reflection method");
base.deobfuscateEnd();
}

View File

@ -17,10 +17,22 @@
along with de4dot. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Collections.Generic;
using Mono.Cecil;
namespace de4dot.code.deobfuscators.CodeVeil {
class InvalidMethodsFinder {
public static List<MethodDefinition> findInvalidMethods(ModuleDefinition module) {
var list = new List<MethodDefinition>();
foreach (var type in module.GetTypes()) {
foreach (var method in type.Methods) {
if (isInvalidMethod(method))
list.Add(method);
}
}
return list;
}
public static bool isInvalidMethod(MethodDefinition method) {
if (method == null)
return false;