public void ChangeParams() { foreach (Parameter param in methodDef.Parameters) { param.CreateParamDef(); param.Name = renamer.GetObfuscated(false); } }
public IEnumerable <TypeDefUser> Execute(ICorLibTypes types) { string current_namespace = "DEFAULT_IF_NOT_EXISTS"; for (int i = 0; i < junksAmount; i++) { if (i % 4 == 0) { current_namespace = renamer.GetObfuscated(false); } TypeDefUser tdu = new TypeDefUser(current_namespace, renamer.GetObfuscated(false)); tdu.Attributes = TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed; MethodDef md_obf = createObfuscatedByMethod(types, tdu); for (int fields_i = 0; fields_i < random.Next(junksFieldsA, junksFieldsB); fields_i++) { tdu.Fields.Add(new FieldDefUser(renamer.GetObfuscated(false), new FieldSig(getRandomTypeSigForField(types)), fields_i % 3 == 0 ? FieldAttributes.Private : FieldAttributes.Public)); } for (int methods_i = 0; methods_i < random.Next(junksFieldsA, junksFieldsB); methods_i++) { MethodDefUser mdu = new MethodDefUser(renamer.GetObfuscated(false), new MethodSig(CallingConvention.Default, 0, types.String), methods_i % 3 == 0 ? MethodAttributes.Public : MethodAttributes.Private); mdu.Body = new CilBody(true, new Instruction[] { OpCodes.Nop.ToInstruction(), OpCodes.Ldstr.ToInstruction("Obfuscated by Wisser Tg"), OpCodes.Callvirt.ToInstruction(md_obf), OpCodes.Ret.ToInstruction() }, new ExceptionHandler[0], new Local[0]); tdu.Methods.Add(mdu); } yield return(tdu); } }
protected void executeTypes(IEnumerable <TypeDef> types) { string current_namespace = "DEFAULT_IF_NOT_EXISTS"; int current_namespace_indexer = 0; foreach (TypeDef td in types) { if (td.IsPublic) { continue; } if (current_namespace_indexer++ % 4 == 0) { current_namespace = renamer.GetObfuscated(false); } td.Namespace = current_namespace; td.Name = renamer.GetObfuscated(false); } }
public void ChangeLocals() { LocalList ll = new LocalList(methodDef.Body.Variables.Select(k => new Local(k.Type, renamer.GetObfuscated(false), k.Index)).ToList()); methodDef.Body = new CilBody(methodDef.Body.InitLocals, methodDef.Body.Instructions, methodDef.Body.ExceptionHandlers, ll); }