Add Name property to ProtectionPhase
This commit is contained in:
Родитель
8b92dc5a79
Коммит
5459687e21
|
@ -23,6 +23,12 @@
|
|||
/// <value>The protection targets.</value>
|
||||
public abstract ProtectionTargets Targets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the phase.
|
||||
/// </summary>
|
||||
/// <value>The name of phase.</value>
|
||||
public abstract string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this phase process all targets, not just the targets that requires the component.
|
||||
/// </summary>
|
||||
|
|
|
@ -120,12 +120,14 @@ namespace Confuser.Core {
|
|||
/// <param name="context">The working context.</param>
|
||||
internal void ExecuteStage(PipelineStage stage, Action<ConfuserContext> func, Func<IList<IDnlibDef>> targets, ConfuserContext context) {
|
||||
foreach (ProtectionPhase pre in preStage[stage]) {
|
||||
context.Logger.DebugFormat("Executing '{0}' phase...", pre.Name);
|
||||
pre.Execute(context, new ProtectionParameters(pre.Parent, Filter(context, targets(), pre)));
|
||||
context.CheckCancellation();
|
||||
}
|
||||
func(context);
|
||||
context.CheckCancellation();
|
||||
foreach (ProtectionPhase post in postStage[stage]) {
|
||||
context.Logger.DebugFormat("Executing '{0}' phase...", post.Name);
|
||||
post.Execute(context, new ProtectionParameters(post.Parent, Filter(context, targets(), post)));
|
||||
context.CheckCancellation();
|
||||
}
|
||||
|
|
|
@ -49,6 +49,10 @@ namespace Confuser.Protections {
|
|||
get { return ProtectionTargets.Modules; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Anti-debug injection"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
var rt = context.Registry.GetService<IRuntimeService>();
|
||||
var marker = context.Registry.GetService<IMarkerService>();
|
||||
|
|
|
@ -49,6 +49,10 @@ namespace Confuser.Protections {
|
|||
get { return ProtectionTargets.Modules; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Anti-dump injection"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
TypeDef rtType = context.Registry.GetService<IRuntimeService>().GetRuntimeType("Confuser.Runtime.AntiDump");
|
||||
|
||||
|
|
|
@ -43,6 +43,10 @@ namespace Confuser.Protections {
|
|||
get { return ProtectionTargets.Modules; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Anti-ILDasm marking"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
foreach (ModuleDef module in parameters.Targets.OfType<ModuleDef>()) {
|
||||
TypeRef attrRef = module.CorLibTypes.GetTypeRef("System.Runtime.CompilerServices", "SuppressIldasmAttribute");
|
||||
|
|
|
@ -53,6 +53,10 @@ namespace Confuser.Protections {
|
|||
get { return ProtectionTargets.Methods; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Anti-tamper helpers injection"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
if (!parameters.Targets.Any())
|
||||
return;
|
||||
|
@ -82,6 +86,10 @@ namespace Confuser.Protections {
|
|||
get { return ProtectionTargets.Methods; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Anti-tamper metadata preparation"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
if (!parameters.Targets.Any())
|
||||
return;
|
||||
|
|
|
@ -14,6 +14,10 @@ namespace Confuser.Protections.Compress {
|
|||
get { return ProtectionTargets.Modules; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Packer info extraction"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
if (context.Packer == null)
|
||||
return;
|
||||
|
|
|
@ -49,6 +49,10 @@ namespace Confuser.Protections.Compress {
|
|||
get { return ProtectionTargets.Modules; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Packer info encoding"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
context.CurrentModuleWriterListener.OnWriterEvent += (sender, e) => {
|
||||
if (e.WriterEvent == ModuleWriterEvent.MDBeginCreateTables) {
|
||||
|
|
|
@ -20,6 +20,10 @@ namespace Confuser.Protections.Constants {
|
|||
get { return ProtectionTargets.Methods; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Constants encoding"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
var moduleCtx = context.Annotations.Get<CEContext>(context.CurrentModule, ConstantProtection.ContextKey);
|
||||
if (!parameters.Targets.Any() || moduleCtx == null)
|
||||
|
|
|
@ -18,6 +18,10 @@ namespace Confuser.Protections.Constants {
|
|||
get { return ProtectionTargets.Methods; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Constant encryption helpers injection"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
if (parameters.Targets.Any()) {
|
||||
var compression = context.Registry.GetService<ICompressionService>();
|
||||
|
|
|
@ -20,6 +20,10 @@ namespace Confuser.Protections.ControlFlow {
|
|||
get { return ProtectionTargets.Methods; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Control flow mangling"; }
|
||||
}
|
||||
|
||||
private static CFContext ParseParameters(MethodDef method, ConfuserContext context, ProtectionParameters parameters, RandomGenerator random, bool disableOpti) {
|
||||
var ret = new CFContext();
|
||||
ret.Type = parameters.GetParameter(context, method, "type", CFType.Switch);
|
||||
|
|
|
@ -49,6 +49,10 @@ namespace Confuser.Protections {
|
|||
get { return ProtectionTargets.Modules; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Invalid metadata addition"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
if (parameters.Targets.Contains(context.CurrentModule)) {
|
||||
random = context.Registry.GetService<IRandomService>().GetRandomGenerator(_FullId);
|
||||
|
|
|
@ -16,6 +16,10 @@ namespace Confuser.Protections.ReferenceProxy {
|
|||
get { return ProtectionTargets.Methods; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Encoding reference proxies"; }
|
||||
}
|
||||
|
||||
private static RPContext ParseParameters(MethodDef method, ConfuserContext context, ProtectionParameters parameters, RPStore store) {
|
||||
var ret = new RPContext();
|
||||
ret.Mode = parameters.GetParameter(context, method, "mode", Mode.Mild);
|
||||
|
|
|
@ -19,6 +19,10 @@ namespace Confuser.Protections.Resources {
|
|||
get { return ProtectionTargets.Methods; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Resource encryption helpers injection"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
if (parameters.Targets.Any()) {
|
||||
var compression = context.Registry.GetService<ICompressionService>();
|
||||
|
|
|
@ -15,6 +15,10 @@ namespace Confuser.Renamer {
|
|||
get { return ProtectionTargets.AllDefinitions; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Name analysis"; }
|
||||
}
|
||||
|
||||
private void ParseParameters(IDnlibDef def, ConfuserContext context, NameService service, ProtectionParameters parameters) {
|
||||
var mode = parameters.GetParameter<RenameMode?>(context, def, "mode", null);
|
||||
if (mode != null)
|
||||
|
|
|
@ -14,6 +14,10 @@ namespace Confuser.Renamer {
|
|||
get { return ProtectionTargets.AllDefinitions; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Post-renaming"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
var service = (NameService)context.Registry.GetService<INameService>();
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@ namespace Confuser.Renamer {
|
|||
get { return ProtectionTargets.AllDefinitions; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "Renaming"; }
|
||||
}
|
||||
|
||||
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
|
||||
var service = (NameService)context.Registry.GetService<INameService>();
|
||||
|
||||
|
|
|
@ -32,8 +32,12 @@ namespace ConfuserEx {
|
|||
|
||||
public static void OnRTBDocumentChanged(DependencyObject d, DependencyPropertyChangedEventArgs dpe) {
|
||||
var rtb = (RichTextBox)d;
|
||||
rtb.Document = (FlowDocument)dpe.NewValue;
|
||||
rtb.TextChanged += (sender, e) => rtb.ScrollToEnd();
|
||||
if (dpe.NewValue != null) {
|
||||
rtb.Document = (FlowDocument)dpe.NewValue;
|
||||
rtb.TextChanged += (sender, e) => rtb.ScrollToEnd();
|
||||
}
|
||||
else
|
||||
rtb.Document = new FlowDocument();
|
||||
}
|
||||
|
||||
public static FlowDocument GetRTBDocument(DependencyObject obj) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче