Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions BitMono/BitMono.Obfuscation/ProtectionsExecutionNotifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,25 @@ public ProtectionsExecutionNotifier(ILogger logger)

public Task NotifyAsync(ProtectionsSortingResult protectionsSortingResult)
{
if (protectionsSortingResult.DeprecatedProtections.Any())
{
m_Logger.Warning("Deprecated protections which shouldn`t be used anymore: {0}", string.Join(", ", protectionsSortingResult.DeprecatedProtections.Select(p => p?.GetType()?.Name ?? "NULL")));
}
if (protectionsSortingResult.Skipped.Any())
{
m_Logger.Warning("Skip protections: {0}", string.Join(", ", protectionsSortingResult.Skipped.Select(p => p ?? "NULL")));
m_Logger.Warning("Skip protections: {0}", string.Join(", ", protectionsSortingResult.Skipped.Select(p => p?.GetType()?.Name ?? "NULL")));
}
if (protectionsSortingResult.ObfuscationAttributeExcludingProtections.Any())
{
m_Logger.Warning("Skip protections with obfuscation attribute excluding: {0}", string.Join(", ", protectionsSortingResult.ObfuscationAttributeExcludingProtections.Select(p => p.GetType().Name ?? "NULL")));
m_Logger.Warning("Skip protections with obfuscation attribute excluding: {0}", string.Join(", ", protectionsSortingResult.ObfuscationAttributeExcludingProtections.Select(p => p?.GetType()?.Name ?? "NULL")));
}
if (protectionsSortingResult.Protections.Any())
{
m_Logger.Information("Execute protections: {0}", string.Join(", ", protectionsSortingResult.Protections.Select(p => p.GetType().Name ?? "NULL")));
m_Logger.Information("Execute protections: {0}", string.Join(", ", protectionsSortingResult.Protections.Select(p => p?.GetType()?.Name ?? "NULL")));
}
if (protectionsSortingResult.StageProtections.Any())
{
m_Logger.Information("Execute calling condition protections: {0}", string.Join(", ", protectionsSortingResult.StageProtections.Select(p => p.GetType().Name ?? "NULL")));
m_Logger.Information("Execute calling condition protections: {0}", string.Join(", ", protectionsSortingResult.StageProtections.Select(p => p?.GetType()?.Name ?? "NULL")));
}
return Task.CompletedTask;
}
Expand Down
4 changes: 4 additions & 0 deletions BitMono/BitMono.Obfuscation/ProtectionsSorter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
using BitMono.Core.Models;
using BitMono.Core.Protecting.Resolvers;
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using ILogger = Serilog.ILogger;

Expand All @@ -31,6 +33,7 @@ public Task<ProtectionsSortingResult> SortAsync(ICollection<IProtection> protect
{
protections = new DependencyResolver(protections, protectionSettings, m_Logger)
.Sort(out ICollection<string> skipped);
var deprecatedProtections = protections.Where(p => p.GetType().GetCustomAttribute<ObsoleteAttribute>(false) != null);
var stageProtections = protections.Where(p => p is IStageProtection).Cast<IStageProtection>();
var pipelineProtections = protections.Where(p => p is IPipelineProtection).Cast<IPipelineProtection>();
var obfuscationAttributeExcludingProtections = protections.Where(p =>
Expand All @@ -41,6 +44,7 @@ public Task<ProtectionsSortingResult> SortAsync(ICollection<IProtection> protect
return Task.FromResult(new ProtectionsSortingResult
{
Protections = protections,
DeprecatedProtections = deprecatedProtections,
Skipped = skipped,
StageProtections = stageProtections,
PipelineProtections = pipelineProtections,
Expand Down
1 change: 1 addition & 0 deletions BitMono/BitMono.Obfuscation/ProtectionsSortingResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace BitMono.Obfuscation
public class ProtectionsSortingResult
{
public ICollection<IProtection> Protections { get; set; }
public IEnumerable<IProtection> DeprecatedProtections { get; set; }
public ICollection<string> Skipped { get; set; }
public IEnumerable<IStageProtection> StageProtections { get; set; }
public IEnumerable<IPipelineProtection> PipelineProtections { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Feature that allows to protect types/methods with the specified namespace in obfuscation.json configuration [#27](https://github.com/sunnamed434/BitMono/issues/27)

### Changed:
* FieldsHiding protection currently is currently deprecated and shouldn`t be used anymore
* FieldsHiding protection currently is deprecated and shouldn`t be used anymore

#### Fixed:
* AntiDebugBreakpoints Protection
Expand Down