I'm Martin, a professional software developer, mainly using .NET languages.
The current project I'm mainly working on is the open-source .NET protector ConfuserEx.
This project forked from yck1509/confuserex
An open-source, free protector for .NET applications
Home Page: https://mkaring.github.io/ConfuserEx/
License: MIT License
I'm Martin, a professional software developer, mainly using .NET languages.
The current project I'm mainly working on is the open-source .NET protector ConfuserEx.
During the packing stage, a temp directory is created containing the packed exe. After the protection, the file and directory remain, my suggestion is to make ConfuserEx delete the temp directory after everything is done.
(Hello and many thanks in advance)
I have got problems with a library targeting to the dotnet 4.7.1 platform
• Using https://github.com/mkaring/ConfuserEx.git (release/2.0)
• ConfuserEx.CLi.exe
• Simple project file:
Problem:
• Looking into the output with dotpeek => no confusion takes place
• Doing the same stuff with the library targeting to dotnet 4.5.1 => the confusion takes place
Another problem:
• Another library targeting to dotnet standard 2.0 confused by confuserEx causes a System.TypeLoadException on startup
Question: Is dotnet standard 2.0 and dotnet 4.7.1 generally supported?
First, I'd like to thank you for providing the open source software to obfuscate the dll, exe and .csproj files. I tried to protect the dll using the ConfuseEx UI application from the latest release and tried to test it to decompile using dotPeek. I could see the source as is clearly. Is there any settings I must apply to properly protect it?
Some warning messages appeared, what problems will it cause, can I ignore?
...
[DEBUG] WinForms found, enabling compatibility.
[DEBUG] Newtonsoft.Json found, enabling compatibility.
[WARN] Failed to extract binding property name in 'System.Void xxx.FrmTerminal::InitializeComponent()'.
[INFO] Processing module 'xxx.Base.dll'...
[DEBUG] Executing 'Invalid metadata addition' phase...
...
[ERROR] Unknown error occurred.
Exception: System.ArgumentException: Feature property cannot be set when Exclude is true. Owner=Resque.Job
at Confuser.Core.ObfAttrMarker.ToInfo(ObfuscationAttributeInfo attr, ProtectionSettingsInfo& info)
at Confuser.Core.ObfAttrMarker.<ReadInfos>d__7.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Confuser.Core.ObfAttrMarker.ProtectionSettingsStack.Apply(IDnlibDef target, IEnumerable`1 infos)
at Confuser.Core.ObfAttrMarker.ProcessModule(ModuleDefMD module, ProtectionSettingsStack stack)
at Confuser.Core.ObfAttrMarker.MarkModule(ProjectModule projModule, ModuleDefMD module, Dictionary`2 rules, Boolean isMain)
at Confuser.Core.ObfAttrMarker.MarkProject(ConfuserProject proj, ConfuserContext context)
at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token)
Failed at 10:53, 0:00 elapsed.
The code injection is currently very … simple. It can't handle dependencies to other classes within the runtime assembly and it does not check if the injected code is actually properly referencing existing members in the new assembly.
All these problems need to be fixed.
The target framework of application to protect is .NET 2.0.
Following exception is thrown:
[ERROR] Failed to resolve a member, check if all dependencies are present in the correct version.
Exception: dnlib.DotNet.MemberRefResolveException: Could not resolve method: System.Boolean System.Reflection.MethodInfo::op_Inequality(System.Reflection.MethodInfo,System.Reflection.MethodInfo) (mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
in dnlib.DotNet.MemberRef.ResolveMethodThrow()
in Confuser.Core.DnlibUtils.ResolveThrow(IMethod method)
in Confuser.Protections.ReferenceProxy.MildMode.ProcessCall(RPContext ctx, Int32 instrIndex)
in Confuser.Protections.ReferenceProxy.ReferenceProxyPhase.ProcessMethod(RPContext ctx)
in Confuser.Protections.ReferenceProxy.ReferenceProxyPhase.Execute(ConfuserContext context, ProtectionParameters parameters)
in Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action1 func, Func
1 targets, ConfuserContext context)
in Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context)
in Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token)
[ERROR] ---BEGIN DEBUG INFO---
[ERROR] Installed Framework Versions:
[ERROR] v2.0.50727 2.0.50727.4927
[ERROR] v3.0 3.0.30729.4926
[ERROR] v3.5 3.5.30729.4926
[ERROR] v4
[ERROR] Client 4.7.03056
[ERROR] Full 4.7.03056
[ERROR] v4.0
[ERROR] Client 4.0.0.0
[ERROR] v4.5 461808
[ERROR]
The built file doesn't show at all and the output shows (Release 1.1.0):
[WARN] Could not find resource type 'DBMLBuilderLib.Dbml'.
[WARN] Could not find resource type 'DBMLBuilderLib.Gen'.
[WARN] Could not find resource type 'DBMLBuilderLib.Utis'.
[WARN] Could not find resource type 'DBMLBuilderLib.Sql'.
[WARN] Failed to extract binding property name in 'System.Windows.Forms.Binding DBMLBuilder.AdvancedBindingExtensions::AddOrReplace(System.Windows.Forms.ControlBindingsCollection,System.String,System.Object,System.String,System.Boolean,System.Windows.Forms.DataSourceUpdateMode,System.Object,System.String,System.IFormatProvider)'.
[WARN] Failed to extract binding property name in 'System.Windows.Forms.Binding DBMLBuilder.AdvancedBindingExtensions::AddBindingLazy<TControl,TDataObject,TBindingControlDataType,TBindingDataType>(TControl,System.Linq.Expressions.Expression1<System.Func
2<TControl,TBindingControlDataType>>,System.Object,TDataObject,System.Linq.Expressions.Expression1<System.Func
2<TDataObject,TBindingDataType>>,System.Boolean,System.Windows.Forms.DataSourceUpdateMode,System.Object,System.String,System.IFormatProvider,System.Windows.Forms.ConvertEventHandler,System.Windows.Forms.ConvertEventHandler)'.
[WARN] Failed to extract binding property name in 'System.Void FastColoredTextBoxNS.HotkeysEditorForm::InitializeComponent()'.
EDIT: I think that the issue is with the constraints renaming ... it seems to work when I don't use that.
I decided to try to go forward with some small customization of the RenamePhase so that all public artifacts keep their names, including Events and Fields as I want users of my obfuscated dlls to be able to reference all things that are public but I'm running into some difficulties with Enum.
When going through all the obfuscation targets: foreach (var def in target)
the target list doesn't seem to have the Enums in there although their names are being obfuscated.
Can you help me find where the Enums are being renamed?
While generally something that always should be avoided, tail recursions are something that is written every now and then in the code.
Detecting and optimizing this is relatively easy. There are in general two ways to optimize a tail recursion when it is written in C# or VB.
Both method should be supported. Adding the TailCall should be the default option, as it just causes the stack memory to be discarded before the resursive invoke.
In case the method that calls itself recursively is virtual
, only the first option is relevant, because the invocation may cause another implementation of the method to be called.
In InjectHelper.cs I found the error
'Importer' does not contain a definition for 'Resolver' and no accessible extension method 'Resolver' accepting a first argument of type 'Importer' could be found (are you missing a using directive or an assembly reference?)
The CLI application has to be rewritten so it is running on .NET core and not .NET framework anymore. This way the application will be cross platform and properly running faster.
Trying to run confuser against my project and some of the class libraries that it builds and get the following error:
[INFO] Initializing...
[DEBUG] Building pipeline...
[INFO] Resolving dependencies...
[DEBUG] Checking Strong Name...
[WARN] [EntityFramework.dll] SN Key is not provided for a signed module, the output may not be working.
[DEBUG] Creating global .cctors...
[DEBUG] Watermarking...
[DEBUG] Executing 'Name analysis' phase...
[DEBUG] Building VTables & identifier list...
[ERROR] Unknown error occurred.
Exception: System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable
1 source, Func2 keySelector, Func
2 elementSelector, IEqualityComparer1 comparer) at Confuser.Renamer.VTable.Implements(VTableConstruction vTbl, Dictionary
2 virtualMethods, VTable ifaceVTbl, TypeSig iface)
at Confuser.Renamer.VTable.ConstructVTable(TypeDef typeDef, VTableStorage storage)
at Confuser.Renamer.VTableStorage.GetOrConstruct(TypeDef type)
at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionParameters parameters)
at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action1 func, Func
1 targets, ConfuserContext context)
at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context)
at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token)
Failed at 11:10, 0:04 elapsed.
I may be missing something here.
If I activate Name Protection, all classes are being renamed, including public ones (I wanted public classes to keep their name and namespace) even though the default of the renPublic parameter is false.
After checking the code there seems to be no renPublic parameter implemented:
internal sealed class NameProtectionParameters : ProtectionParametersBase {
internal IProtectionParameter<bool> RickRoll { get; } = ProtectionParameter.Boolean(rickRoll, false);
internal IProtectionParameter<bool> RenameArguments { get; } = ProtectionParameter.Boolean("renameArgs", true);
internal IProtectionParameter<bool> RenamePdb { get; } = ProtectionParameter.Boolean("renPdb", false);
internal IProtectionParameter<bool> FlattenNamespace { get; } = ProtectionParameter.Boolean("flatten", true);
internal IProtectionParameter<RenameMode> Mode { get; } = ProtectionParameter.Enum("mode", RenameMode.Unicode);
internal IProtectionParameter<string> Password { get; } = ProtectionParameter.String("password", "");
internal IProtectionParameter<bool> ForceRename { get; } = ProtectionParameter.Boolean("forceRen", false);
internal IProtectionParameter<uint> IdOffset { get; } = ProtectionParameter.UInteger("idOffset", 0);
internal IProtectionParameter<string> SymbolMapFileName { get; } =
ProtectionParameter.String("mapFileName", "symbols.map");
internal IProtectionParameter<bool> RenameXaml { get; } = ProtectionParameter.Boolean("renXaml", true);
}
How can I rename only non public classes?
Hello,
I got the error
CS1061 'Importer' does not contain a definition for 'Resolver' and no accessible extension method 'Resolver' accepting a first argument of type 'Importer' could be found (are you missing a using directive or an assembly reference?)
Am I missing something? Or do I use wrong dnlib version?
This bug was notified in the old repository: yck1509#638
It still appears in the new version 2.0.
As a consequence, this warning is thrown while processing:
[WARN] Could not find resource type 'MyApp.Resources.FormStrings'.
Local variables are always declared for the entire method, but they may not be used for the entire method.
This optimization should reduce the local variables by analyzing the scope where the local variable is used. Two variables with disjoint scopes may be combined into a single variable, provided both are reference types or the same value type.
The challenge for this optimization is to properly detect the scope of the variables.
This "optimization" will reduce the size of the stack marginally. Also it is unlikely to have any measurable impact on the performance. How ever local variables that are being reused do not make for easier to read code. So if nothing else, it is something to make the deobfuscated sources a little harder to work with.
The UI Application of ConfuserEx needs to be updated to use .NET core, instead of .NET framework.
There are two ways to go about this:
Wait for .NET Core 3.0 and utilise the desktop packs to get everything working again, or use a cross platform UI framework (Avalonia?) to get this working.
Hi,
I got this error.
Severity Code Description Project File Line Suppression State
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\dnlib\src\bin\Debug\netstandard2.0\dnlib.dll' could not be found Confuser.Core.Exports D:\VisualStudio\confuserEX2\Confuser.Core.Exports\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\dnlib\src\bin\Debug\netstandard2.0\dnlib.dll' could not be found Confuser.Renamer.Exports D:\VisualStudio\confuserEX2\Confuser.Renamer.Exports\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\dnlib\src\bin\Debug\net461\dnlib.dll' could not be found Confuser.Helpers (net461) D:\VisualStudio\confuserEX2\Confuser.Helpers\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\dnlib\src\bin\Debug\netcoreapp2.1\dnlib.dll' could not be found Confuser.Helpers (net461) D:\VisualStudio\confuserEX2\Confuser.Helpers\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\dnlib\src\bin\Debug\net461\dnlib.dll' could not be found Confuser.Utilities (net461) D:\VisualStudio\confuserEX2\Confuser.Utilities\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\dnlib\src\bin\Debug\netcoreapp2.1\dnlib.dll' could not be found Confuser.Utilities (net461) D:\VisualStudio\confuserEX2\Confuser.Utilities\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\Confuser.Helpers\bin\Debug\netcoreapp2.1\Confuser.Helpers.dll' could not be found Confuser.Core (net461) D:\VisualStudio\confuserEX2\Confuser.Core\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\Confuser.Utilities\bin\Debug\netcoreapp2.1\Confuser.Utilities.dll' could not be found Confuser.Core (net461) D:\VisualStudio\confuserEX2\Confuser.Core\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\dnlib\src\bin\Debug\netcoreapp2.1\dnlib.dll' could not be found Confuser.Core (net461) D:\VisualStudio\confuserEX2\Confuser.Core\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\Confuser.Helpers\bin\Debug\net461\Confuser.Helpers.dll' could not be found Confuser.Core (net461) D:\VisualStudio\confuserEX2\Confuser.Core\CSC 1 Active
Error CS0006 Metadata file 'D:\VisualStudio\confuserEX2\dnlib\src\bin\Debug\net461\dnlib.dll' could not be found Confuser.Core (net461) D:\VisualStudio\confuserEX2\Confuser.Core\CSC 1 Active
Error Unable to locate repository containing directory 'D:\VisualStudio\confuserEX2\dnlib\src'. dnlib C:\Users\Admin\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta-63127-02\build\Microsoft.Build.Tasks.Git.targets 20
Error Unable to locate repository containing directory 'D:\VisualStudio\confuserEX2\dnlib\src'. dnlib C:\Users\Admin\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta-63127-02\build\Microsoft.Build.Tasks.Git.targets 20
Error Unable to locate repository containing directory 'D:\VisualStudio\confuserEX2\dnlib\src'. dnlib C:\Users\Admin\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta-63127-02\build\Microsoft.Build.Tasks.Git.targets 20
Did I miss something?
Thank in advance.
I get the following exception on an execution path in our app:
Err number: 5. System.ArgumentNullException: Argumentet name kan ikke være null.
Parameternavn: name
ved System.Data.DataColumnCollection.get_Item(String name)
ved System.Data.DataRow.GetDataColumn(String columnName)
ved Agendec.Client.rscActivitySrv.CheckRemindForAct(AgFoundation.rscActivityBE& , DateTime& )
"Argumentet name kan ikke være null" translates to something like "The argument 'name' cannot be null", and "Parameternavn" to "Parameter name".
As stated in the header it seems to happen when accessing a column item from a DataRow object.
We access the get property of a column item in two ways:
However, the exception doesn't seem to happen consistently; it seems to go ok in other parts of the code where we have the same type of code. Also, when I tried to add some logging code in the function where the exception occurred, the exception no longer occurred!?
When not obfuscated it works fine, and also works fine with ConfuserEx 1.0.0.
To support the feature requires in #23 and #24 it will be required to rework the project files. It is important that ConfuserEx will still be able to load the current project files to maintain proper backwards compatibility.
Required features:
is-public
doesn't actually trigger on public members, but it triggers on members that are visible outside of the assembly, unless the current assembly is a executable, where it doesn't trigger at all. Things like this have to be cleaned up.Thats the plan to get started. More ideas are welcome. 😉
The difference regarding what format is currently used will be done based on the namespace and the names of the XML tags. The new format simply gets a new namespace.
Hello,
I wanted import a object in InjectPhase class but the imported object always return null I added Export attribute to InjectPhase class but exclude plugin from protections.
I have an odd case where the override IL declaration for a method that implements an interface method does not have the generic parameter of the return type renamed. This only happens sometimes, though. Running Confuser for identical inputs (same project file/input assemblies) sometimes correctly does the rename, and other times it doesn't. I haven't been able to identify what triggers this, other than just rerunning Confuser until it fails to rename (although it's fairly frequent).
The class that implements the interface is in assembly A, while the interface itself is in assembly Dep
. Public member renaming is enabled.
This results in a TypeLoadException when trying to run the program/access the type:
Unhandled Exception: System.TypeLoadException: Type '_hEn8b4s8oBY1jgZcQVQz4THS2ij' from assembly 'ConfuserTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' tried to override method '_dmsD4dyBswIfo0cd1FveEj2vUhX' but does not implement or inherit that method. at _i3zNHiwCYlitdxpMvsALWfmv8OM._tZQC7BOe6PSavpqbssDocOJC0W7(String[] )
Below is a screenshot of what I mean. _c4N69m2rOXJXyRZw1HwXxNcEk7c
corresponds to Dep.IB
.
The corresponding code:
class A : Dep.IA<Dep.IB>
{
public Dep.IB Test(int a, string b, Dep.IB t) {
return default;
}
}
Version: 2.0-master
Example: ConfuserTest.zip
Private attributes, properties and methods are renamed, also invocation to public methods are obfuscated with a proxy, but local variables are kept clear. Is there any reason? It seems easier. There is a configuration for that?
Example of protected code:
int a = 1; int b = 2; int addition = iojw80efas6dfy2ay(a, b);
It seems the function iojw80efas6dfy2ay() is a+b, due to the local variable name :P
I'm having some issues running Confuser.CLI.exe under dotnet on Linux and MacOS.
$ dotnet Confuser.CLI.exe
A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/davidtavarez/Development/ConfuserEx/'.
Failed to run as a self-contained app. If this should be a framework-dependent app, add the /Users/davidtavarez/Development/ConfuserEx/Confuser.CLI.runtimeconfig.json file specifying the appropriate framework.
$ dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
I did create the file called: Confuser.CLI.runtimeconfig.json
:
{
"runtimeOptions": {
"framework": {
"name": "Microsoft.NETCore.App",
"version": "2.2.2"
}
}
}
Now I have:
$ dotnet Confuser.CLI.exe
Unhandled Exception: System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.ConsolePal.get_Title()
at Confuser.CLI.Program.Main(String[] args)
[1] 16476 abort dotnet Confuser.CLI.exe
Cannot compile "Error occurred while restoring NuGet packages: The operation failed as details for project Confuser.Optimizations.Exports could not be loaded."
Hi.
First of all I want to thank you for continuing development of ConfuserEx :)
We get the following exception when embedded resource are being used:
System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Agendec.Client.Resources.resources" was correctly embedded or linked into assembly "DPAgenda" at compile time, or that all the satellite assemblies required are loadable and fully signed.
We are using Normal preset and adding rename.
I've also tried removing resources but still get the same exception.
Without obfuscation it works fine.
Regards, Rolf
Hey!
Thanks for maintaining the project.
I've just run into an issue whilst migrating to this fork - we make heavy use of declarative obfuscation in our projects and found that this version throws a parsing error for our use case:
Broken:
preset(aggressive);+rename(mode=decodable)
Working:
false:preset(aggressive);+rename(mode=decodable)
I found out how to do this by looking at the feature match regex. Putting that colon in pushes the protection string into another capture group. I then checked the pattern parser's lexer to find a good value to use here, and false
turns out to be a noop.
For some commonly used list implementations, such as List<T>
, arrays, ImmutableArray<T>
and Span<T>
the enumerator based iteration (with foreach) is slower than the iteration with using the index.
So it would be good to change the iteration from enumerator based iteration to the indexed iteration, provided the list implementation is known.
Additional considerations are required for List<T>
, because the index based iteration does not check for concurrent modifications. It should be the default option to inject this check for modification into the code, but dropping this check should be possible as well, because the check will rely on reflection and may make thing slower than before.
So it needs to be checked if it is reasonable to create the indexed iteration with the modification check, or if that is slower than the iteration using the enumerator.
I've got a case where a generic type does not have its generic arguments applied to the name - instead, the name is obfuscated and the generic arguments are trimmed off (A'1 -> _ujkljsfuoiu
instead of the expected A'1 -> _ujkljsfuoiu'1
. It seems to happen with the following setup:
The problem only appears when the non-generic class A is loaded/obfuscated before the generic variant. If the generic class is processed first, it is named correctly.
As a result, attempting to run the program/load an assembly like this fails with a duplicate type exception similar to the following:
Unhandled Exception: System.BadImageFormatException: Duplicate type with name '_KXAnX9u6N2HxWpPt3OaOUtHSGLF' in assembly 'ConfuserTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Confuser version: 2.0-master
Minimal example: ConfuserTest.zip
Thanks!
Please add logger verbosity level, Is Possible?
Adding a filter to both shouldn't be difficult to filter the debug messages for example.
It seems the contents of public constants are being obfuscated, causing problems/exceptions during app runtime.
In my case it seems the "dpConfig" in a class level constant I have is being obfuscated:
Public Const DEFAULT_ROOT_ELEMENT_NAME As String = "dpConfig"
As I've understood from the issue below, such constants should not be obfuscated?
yck1509#369
Previously I was able to obfuscate assemblies in-place successfully, however now it fails every time.
Unfortunately I can't provide the project I was testing with. I looked into the issue with procmon
while stepping through code and found that there is a handle left open to one of the obfuscated modules.
This is even with the code that was originally intended to fix this problem: yck1509#76
I gave up here, as I'm not 100% sure where in ConfuserEx 2 to begin hunting for this!
I've got issues with the current 1.0 release of ConfuserEx, not renaming references in XAML, so all WPF applications break, unless I don't rename classes, which kinda defeats the purpose.
Could you make a release of this fork? I really don't wanna deal with .NET Core.
Currently the nuget deployment for release versions is not working properly. Needs to be fixed for the next version.
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<TextBlock>[123456</TextBlock>
</Grid>
</Window>
Currently there is always exactly one version of the runtime part of the ConfuserEx. The problem is that the version has to be compatible to the version ConfuserEx itself is build, due to the way the build process is set up.
How ever in order to properly cover a wide range of target platforms, the runtime needs to be provided compiled for and with the specific dependencies for multiple versions.
Goal of this enhancement is to deploy multiple versions of the runtime with ConfuserEx, to cover frameworks that are incompatible with the framework version of ConfuserEx itself.
[DEBUG] Encrypting resources... [ERROR] Unknown error occurred. Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.Collections.Generic.List
1.get_Item(Int32 index)
at dnlib.DotNet.Writer.MDTable1.get_Item(UInt32 rid) at Confuser.Core.Services.RandomGenerator.Shuffle[T](MDTable
1 table)
at Confuser.Protections.InvalidMetadataProtection.InvalidMDPhase.Randomize[T](MDTable1 table) at Confuser.Protections.InvalidMetadataProtection.InvalidMDPhase.OnWriterEvent(Object sender, ModuleWriterEventArgs e) at dnlib.DotNet.Writer.EventHandler2
1.Invoke(Object sender, TEventArgs e)
at dnlib.DotNet.Writer.ModuleWriterOptionsBase.RaiseEvent(Object sender, ModuleWriterEventArgs e)
at dnlib.DotNet.Writer.ModuleWriterBase.OnWriterEvent(ModuleWriterEvent evt)
at dnlib.DotNet.Writer.ModuleWriterBase.Metadata_MetadataEvent(Object sender, MetadataWriterEventArgs e)
at dnlib.DotNet.Writer.Metadata.OnMetadataEvent(MetadataEvent evt)
at dnlib.DotNet.Writer.Metadata.Create()
at dnlib.DotNet.Writer.Metadata.CreateTables()
at dnlib.DotNet.Writer.ModuleWriter.WriteImpl()
at dnlib.DotNet.Writer.ModuleWriterBase.Write(Stream dest)
at dnlib.DotNet.ModuleDef.Write(Stream dest, ModuleWriterOptions options)
at Confuser.Core.ConfuserEngine.WriteModule(ConfuserContext context)
at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action1 func, Func
1 targets, ConfuserContext context)
at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context)
at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token)
Failed at 2:04 PM, 0:08 elapsed.
`
Location : ConfuserEx\Confuser.Core\Services\RandomService.cs Line 208
Solution :
Xamarin obfuscation : unpack, obfuscate, repack apk files
Would it be possible to add Integration with ILMerger into ConfuserEx?
perhaps it could come in the form of a packer.
Regular Expressions are usually interpreted by the .NET regex implementation. How ever the implementation offers the possibility to compile the expressions into MSIL code that is exposed as an DynamicMethod
. The main disadvantage of the compiled version of the expressions is the high upfront cost of compiling the expression. Also there are reports of memory leaks popping up every now and then.
This optimization should compile every constant regular expression into MSIL and embed the result into the assembly. While this may increase the size of the assembly significantly, it offers the increased performance of the compiled assemblies with none of it drawbacks, because the upfront cost of compiling the expression is done by ConfuserEx.
The main challenge is to find as many combinations of pattern and options that are used as possible.
As of right now the compressor packer doesn't handle satellite assemblies for localisation correctly for net20 and net35. The reason is that the query for the satellite assembly isn't forwarded to the AssemblyResolve
event of the AppDomain.
A possible solution is to force loading satellite assemblies once the parent assembly is unpacked.
The Obfuscator can't handle reflections within the Assembly since it doesn't check for reflections before renaming.
Example: typeof(Program).GetMethod("HelloWorld"); will throw a NullReferenceException, because the "HelloWorld" method gets renamed after Obfuscation (if Renaming Feature is enabled).
Solution: Add a reflection analyzer to cex using blocks and analyze all methods before renaming them
Test files (unobf & obfed):
TestFile.zip
The compressor doesn't allow to select which assemblies you do want to pack into your executable module.
Let's say you have 5 DLLs, but you only want the compressor to pack three of them into your EXE, the other two you want as-is, unpacked.
Today all DLLs are packed.
This issue is to request a feature to allow you to choose which assemblies will be packed.
Hello, I compiled my self the app and when I try to use the renamer it does nothing, just saves the assembly.
Do you know what could it be?
I've successfully obfuscated an application using name protection only, but afterwards it crashes shortly after starting. It seems activating name protection results in failure during dll loading. This happens even when using name protection with debug mode:
System.IO.FileNotFoundException
HResult=0x80070002
Message=Die Datei oder Assembly "ProductName.slyckugiymmwnuoiyzbzdktvmzhgb, Culture=neutral" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
Source=mscorlib
StackTrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at System.Windows.Navigation.BaseUriHelper.GetLoadedAssembly(String assemblyName, String assemblyVersion, String assemblyKey)
at MS.Internal.AppModel.ResourceContainer.GetResourceManagerWrapper(Uri uri, String& partName, Boolean& isContentFile)
at MS.Internal.AppModel.ResourceContainer.GetPartCore(Uri uri)
at System.IO.Packaging.Package.GetPartHelper(Uri partUri)
at System.IO.Packaging.Package.GetPart(Uri partUri)
at System.Windows.Application.GetResourceOrContentPart(Uri uri)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at _ProductName.App.App.(Object , Uri )
at _ProductName.App.App._InitializeComponent()
at _ProductName.App.App._Main()
The application is targeting .NET 4.6.
The readme notes:
The nuget package can be accessed using the AppVeyor Nuget Feed or it has to be self-hosted.
But there doesn't seem to be any packages available from the feed:
C:\Users\user>nuget list -Source https://ci.appveyor.com/nuget/confuserex-r4olq7m3uysu
No packages found.
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.