Beispiel #1
0
        protected virtual ModuleSetting MarkModule(AssemblySetting parent, ModuleDefinition mod, Marking mark)
        {
            ModuleSetting ret = new ModuleSetting(mod);

            ApplyRules(mod, mark);
            return(ret);
        }
Beispiel #2
0
        internal void MarkHelperAssembly(AssemblyDefinition asm, ObfuscationSettings settings, Confuser cr)
        {
            AssemblySetting ret = new AssemblySetting(asm);

            ret.GlobalParameters = new ObfuscationSettings(settings);

            ret.Modules = asm.Modules.Select(_ => new ModuleSetting(_)
            {
                Parameters = new ObfuscationSettings()
            }).ToArray();
            foreach (var mod in asm.Modules)
            {
                if (mod.GetType("<Module>").GetStaticConstructor() == null)
                {
                    MethodDefinition cctor = new MethodDefinition(".cctor", MethodAttributes.Private | MethodAttributes.HideBySig |
                                                                  MethodAttributes.SpecialName | MethodAttributes.RTSpecialName |
                                                                  MethodAttributes.Static, mod.TypeSystem.Void);
                    cctor.Body = new MethodBody(cctor);
                    cctor.Body.GetILProcessor().Emit(OpCodes.Ret);
                    mod.GetType("<Module>").Methods.Add(cctor);
                }
            }

            cr.settings.Add(ret);
        }
Beispiel #3
0
        protected virtual AssemblySetting MarkAssembly(ProjectAssembly asm, Marking mark)
        {
            AssemblySetting ret = new AssemblySetting(asm.Resolve(cr.param.Project.BasePath));

            ret.IsMain = asm.IsMain;
            ApplyRules(ret.Assembly, mark);
            return(ret);
        }
Beispiel #4
0
        private void MarkModule(AssemblySetting parent, ModuleDefinition mod, Marking mark, List <ModuleSetting> settings)
        {
            ModuleSetting ret = MarkModule(parent, mod, mark);

            ret.Parameters = mark.CurrentConfusions;

            using (mark.Level())
            {
                List <MemberSetting> typeSettings = new List <MemberSetting>();
                foreach (var t in ret.Module.Types)
                {
                    using (mark.Level())
                        MarkType(mod, t, mark, typeSettings);
                }
                ret.Types = typeSettings.ToArray();
            }
            settings.Add(ret);
        }
Beispiel #5
0
        private AssemblySetting _MarkAssembly(ProjectAssembly asm, Marking mark)
        {
            AssemblySetting ret = MarkAssembly(asm, mark);

            ret.GlobalParameters = mark.CurrentConfusions;

            using (mark.Level())
            {
                List <ModuleSetting> modSettings = new List <ModuleSetting>();
                foreach (var m in ret.Assembly.Modules)
                {
                    using (mark.Level())
                        MarkModule(ret, m, mark, modSettings);
                }
                ret.Modules = modSettings.ToArray();
                return(ret);
            }
        }
Beispiel #6
0
        private AssemblySetting MarkAssembly(AssemblyDefinition asm, Marking mark)
        {
            bool            exclude;
            AssemblySetting ret = MarkAssembly(asm, mark, out exclude);

            ret.GlobalParameters = mark.CurrentConfusions;

            if (!exclude)
            {
                List <ModuleSetting> modSettings = new List <ModuleSetting>();
                foreach (ModuleDefinition mod in asm.Modules)
                {
                    MarkModule(mod, mark, modSettings);
                }
                ret.Modules = modSettings.ToArray();
            }

            mark.LeaveLevel();
            return(ret);
        }
Beispiel #7
0
 public CopyMarker(AssemblySetting settings, IConfusion exclude)
 {
     origin = settings; this.exclude = exclude;
 }