Giter Club home page Giter Club logo

confuserex's Introduction

ConfuserEx

ConfuserEx is a open-source protector for .NET applications. It is the successor of Confuser project.

NOTICE

This project is discontinued and unmaintained. Alternative forked projects can be found in this issue.

Features

  • Supports .NET Framework 2.0/3.0/3.5/4.0/4.5
  • Symbol renaming (Support WPF/BAML)
  • Protection against debuggers/profilers
  • Protection against memory dumping
  • Protection against tampering (method encryption)
  • Control flow obfuscation
  • Constant/resources encryption
  • Reference hiding proxies
  • Disable decompilers
  • Embedding dependency
  • Compressing output
  • Extensible plugin API
  • Many more are coming!

Usage

Confuser.CLI <path to project file>

The project file is a ConfuserEx Project (*.crproj). The format of project file can be found in docs\ProjectFormat.md

Bug Report

See the Issues Report section of website.

License

See LICENSE file for details.

Credits

0xd4d for his awesome work and extensive knowledge!
Members of Black Storm Forum for their help!

confuserex's People

Contributors

agilejoshua avatar almightyju avatar ambyte avatar andrew-skybound avatar asdfgasdfsafgsdfa avatar caverna avatar coderdennis avatar cynecx avatar encey avatar gubed avatar ivan-danilov avatar jbeshir avatar maddnias avatar nik-net avatar picrap avatar sebastianhaeni avatar xenocoderce avatar yck1509 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

confuserex's Issues

Settings not stored in project file using GUI

I obtain the same crproj file whatever the settings I configured using the GUI for ConfuserEx v0.2.1. I would expect the crproj file to include configured settings so that I can save it and replay it.

None rules are still modifying local byte array

I tried the ConfuserEx to obfuscate my main dll and it turns out almost everything is working except one screen that does not shows up. I decided to use the None preset setting and it still didn't worked. So I used Reflector to decompile both dll (original and obfuscated) and exported the source code. Then I diff both code and I realized that ConfuserEx was modifying a local byte array even in None mode... The attachment shows the behaviour (the left is the obfucated version).

none_bytearray

Probe Path -> GUI Crashes on Save

Hey Ki (and team!)

I'll start off by saying, I'm pleased someone has picked up Confuser, and very impressed so far with the work you guys have done. Keep it up!

I've noticed an issue with the most recent build (0.2.1), whereby if you add a 'probe path' to the advanced settings, and then attempt to save the project, it crashes the app.

Let me know if you need any further info.

Thanks

compile error

hi sir
error on compile
Error 9 Missing compiler required member 'System.Runtime.CompilerServices.ExtensionAttribute..ctor' J:\ConfuserEx\ConfuserEx\Confuser.Core\CSC Confuser.Core

w7 w8 bit problem

once i protect a exe with max label in windows 7 or 8 my exe got crashes . but if i run that exe in xp , the exe run fine.

Build fail

Build Fail (update version: invalid argument length.) if have space in source directory name

stack trace decoder

Hi,

Awesome tool, but one missing piece I would love to have to round it out is a stack trace decoder. Any plans to add that any time soon?

Thanks

how to use compressor ?

my .csproj
http://pastebin.com/9MhkEnPQ

i get exception in compressor

Failed to load project:
Confuser.Core.Project.ProjectValidationException: The element 'rule' in namespac
e 'http://confuser.codeplex.com' has invalid child element 'packer' in namespace
'http://confuser.codeplex.com'. List of possible elements expected: 'protection
' in namespace 'http://confuser.codeplex.com'.
at Confuser.Core.Project.ConfuserProject.Load(XmlDocument doc) in e:\Source\P
ublic\Confuser2\Confuser.Core\Project\ConfuserProject.cs:line 452
at Confuser.CLI.Program.Main(String[] args) in e:\Source\Public\Confuser2\Con
fuser.CLI\Program.cs:line 27

Detailing: My Steps to convert from old Confuser .crproj file

hi,
As I had a lot of trouble writing mine from the start pre-EX version.
I will detail how I converted to the new .crproj EX format to help you.
This was a very simple config file.

  1. In the 'additional' folder of the source code are example .crproj files for EX
    This helps a lot to get the basic structure correct.
  2. the preset attribute has been moved to the next level below <project.
    e.g.,
    <proj...

The pattern attribute is mandatory so just use the above.

  1. <assembly has been changed to <module
    Again next level
    e.g.,
    <proj...
    <module path= the same format

This is my first and very basic conversion, a harder one is to come so will detail that!

HTH

Craig salon software
http://www.SalonSoftwareSystem.com

System.ArgumentNullException: Value cannot be null.

Hi.

Thank you for ConfuserEx.
Windows 7 x64 SP1
.NET Framework 3.5 Assembly
Confuser 0.1.2

Confuser.CLI.exe MyAssembly.crproj
MyAssembly.crproj:

<?xml version="1.0" encoding="utf-8"?>
<project baseDir="." outputDir="..\" xmlns="http://confuser.codeplex.com">
    <rule preset="none" pattern="true">
        <protection id="anti debug" />
        <protection id="anti dump" />
        <protection id="anti ildasm" />
        <protection id="anti tamper" />
        <protection id="constants" />
        <protection id="ctrl flow" />
        <protection id="invalid metadata" />
        <protection id="ref proxy" />
        <protection id="rename" />
        <protection id="resources" />
    </rule>
    <module path="MyAssembly.exe" snKey="..\..\..\..\StrongName.snk" />
</project>

Output:

 [INFO] ConfuserEx v0.1.0-21-g8d974cf Copyright (C) Ki 2014
 [INFO] Running on Microsoft Windows NT 6.1.7601 Service Pack 1, .NET Framework
v2.0.50727.5477, 64 bits
[DEBUG] Discovering plugins...
 [INFO] Discovered 10 protections, 1 packers.
[DEBUG] Resolving component dependency...
 [INFO] Loading input modules...
 [INFO] Loading 'MyAssembly.exe'...
 [INFO] Initializing...
[DEBUG] Building pipeline...
 [INFO] Resolving dependencies...
[DEBUG] Checking Strong Name...
[DEBUG] Creating global .cctors...
[DEBUG] Watermarking...
[DEBUG] Building VTables & identifier list...
[DEBUG] Analyzing...
[ERROR] Unknown error occured.
Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: obj
   at Confuser.Core.Annotations.GetOrCreate[TValue](Object obj, Object key, Func
`2 factory) in e:\Source\Public\Confuser2\Confuser.Core\Annotations.cs:line 87
   at Confuser.Renamer.NameService.AddReference[T](T obj, INameReference`1 refer
ence) in e:\Source\Public\Confuser2\Confuser.Renamer\NameService.cs:line 103
   at Confuser.Renamer.Analyzers.TypeBlobAnalyzer.Analyze(ConfuserContext contex
t, INameService service, IDnlibDef def) in e:\Source\Public\Confuser2\Confuser.R
enamer\Analyzers\TypeBlobAnalyzer.cs:line 73
   at Confuser.Renamer.AnalyzePhase.Analyze(NameService service, ConfuserContext
 context, IDnlibDef def, Boolean runAnalyzer) in e:\Source\Public\Confuser2\Conf
user.Renamer\AnalyzePhase.cs:line 69
   at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionP
arameters parameters) in e:\Source\Public\Confuser2\Confuser.Renamer\AnalyzePhas
e.cs:line 47
   at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action`
1 func, Func`1 targets, ConfuserContext context) in e:\Source\Public\Confuser2\C
onfuser.Core\ProtectionPipeline.cs:line 130
   at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, Conf
userContext context) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.
cs:line 187
   at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, Ca
ncellationToken token) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngin
e.cs:line 146
Failed at 11:48 AM, 0:03 elapsed.

Any ideas?

Thank you.

Entrypoint not callable

I've used confuser. Using Assembly.Load and entrypoint invoke throws a strange error message. Can i disable some plugin over the xml file ? After deleting a line like protection id="anti tamper" it's still use these protection.

ispublic pattern function

Hi. I really need to have pattern function like ispublic() or so for test member or class definition for visibility outside the assembly. thanks

Problem with resources when renaming

Hi,

i love the Confuser, but i noticed that my C# code for retrieving a resource, in this case a byte array is not working anymore.

This only happens if i use the Renamer option. once i disabled it, my program can find the resource again.

I´m using .NET 4.0.
Target machine: x86

and i use the standard generated static classes of .NET to access my resources: Resources.

Do i need to use a different way to retrieve my resource data, or is this a bug?

Ps. i also noticed that if i use the compressor the application fails completely, but i don't really need the compressor. but i want renaming to work!

Does Confuser(Ex) support WPF/MVVM application?

I have used Confuser (codeplex). It does not seem to support MVVM or I am lacking some knowledge on how to use the tool.

These days, I am trying to use ConfuserEx (v0.2.1) and I am hardly getting anywhere. I tried GUI as well as CLI tool but the output exe is crashing all the time. Tried a dozen crproj xml settings as per the ConfuserEx documentation in /docs/ProjectFormat.md and using /additional/ilspy.crproj but no luck.

Extract from crash window:
Problem Event Name: APPCRASH
Application Name: WpfApplication1.exe
Fault Module Name: KERNELBASE.dll
Fault Module Version: 6.2.9200.16864
Exception Code: e0434352

A sample code:
Created a simple new WPF application and added following code in XAML and Code behind.

namespace WpfApplication1
{
    public class MainViewModel : INotifyPropertyChanged
    {
        public string Name { get; private set; }

        public event PropertyChangedEventHandler PropertyChanged;

        public MainViewModel()
        {
            Name = DateTime.Now.ToString();
        }

        public void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        internal void update()
        {
            Name = DateTime.Now.ToString();
            RaisePropertyChanged("Name");
        }
    }

    public partial class MainWindow : Window
    {
        MainViewModel _mainViewModel;

        public MainWindow()
        {
            InitializeComponent();
            _mainViewModel = new MainViewModel();
            DataContext = _mainViewModel;
        }

        void refreshDataContextValue(object sender, RoutedEventArgs e)
        {
            if (DataContext != null && DataContext is MainViewModel)
            {
                (DataContext as MainViewModel).update();
            }
        }

        void showCurrentDataContextValue(object sender, RoutedEventArgs e)
        {
            if (DataContext != null && DataContext is MainViewModel)
            {
                MessageBox.Show((DataContext as MainViewModel).Name);
            }
        }
    }
}

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="WPF MVVM Confuser Test" Height="250" Width="425">
    <StackPanel VerticalAlignment="Center">
        <TextBlock Text="{Binding Path=Name}" HorizontalAlignment="Center" Margin="5"/>
        <Button Content="Refresh" Click="refreshDataContextValue" Width="200" Margin="5"/>
        <Button Content="Current Value" Click="showCurrentDataContextValue" Width="200" Margin="5"/>
    </StackPanel>
</Window>

The basic crproj file tried was:

<?xml version="1.0" encoding="utf-8"?>
<project baseDir="D:\delete\WpfApplication1\bin\Release" outputDir="Confused" xmlns="http://confuser.codeplex.com">
    <rule preset="none" pattern="true">
        <protection id="anti debug" />
        <protection id="anti dump" />
        <protection id="anti ildasm" />
        <protection id="anti tamper" />
        <protection id="constants" />
        <protection id="ctrl flow" />
        <protection id="invalid metadata" />
        <protection id="ref proxy" />
        <protection id="rename" />
        <protection id="resources" />
    </rule>
    <module path="WpfApplication1.exe" />
</project>

depth parameter

What does depth parameter exactly changes in the control flow obfuscation?

Get exception to use compressor

.csproj
http://pastebin.com/dX7X4f2e

the exception
Failed to load project:
System.Xml.XmlException: '<', hexadecimal value 0x3C, is an invalid attribute ch
aracter. Line 6, position 38.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char qu
oteChar, NodeData attr)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at Confuser.CLI.Program.Main(String[] args) in e:\Source\Public\Confuser2\Con
fuser.CLI\Program.cs:line 26

sample plss

NameSpace ImportResolver Not Found

Just pulled the code to see if it will work on my current project. Spent about 30 Minutes trying to resolve the build errors. Got the dnlib reference added. The only real build error its showing me now is:

Error 18 The type or namespace name 'ImportResolver' could not be found (are you missing a using directive or an assembly reference?) E:\Git Repository\ConfuserEX\Confuser.Core\Helpers\InjectHelper.cs 235 33 Confuser.Core

Please let me know if there is any more information that i can provide to get this solved. Thanks!

UnreachableException in BAMLAnalyzer.cs

Running ConfuserEx on my assemblies calls GetAttributeType(null), which throws an UnreachableException.

I don't really know what I could provide to help figure out what is happening.

I am running ConfuserEx from latest source.
Windows8.1, multiple exes and dlls of WPF, C#4.5.
I don't own the code I am obfuscating, so I cannot share the source executables or dlls.


BAMAnalyzer.cs method ResolveAttribute, line 199 gets info=

{(DockPanel, , System.Windows.Controls.Dock)}
    Item1: DockPanel
    Item2: null
    Item3: {System.Windows.Controls.Dock}

Which then returns Tuple.Create<IDnlibDef, TypeDef>(info.Item2, info.Item3); to ProcessElementBody() line 359. Notice that the first param is null!
Then it does

type = attrInfo.Item2;
attr = attrInfo.Item1;
if (elem.Attribute != null)
    type = GetAttributeType(attr);

which sends a null to GetAttributeType(), and that one does throw new UnreachableException();.


Foo.crproj:

<?xml version="1.0" encoding="utf-8"?>
<project  baseDir="D:\code\Foo"
        outputDir="D:\code\Foo\Obfuscated"
        xmlns="http://confuser.codeplex.com">
    <rule preset="none" pattern="true">
        <protection id="rename" />
    </rule>
    <module path="D:\code\Foo\Foo.Daemon.exe" />
    <module path="D:\code\Foo\Foo.Model.dll" />
    <module path="D:\code\Foo\Foo.Shared.dll" />
</project>

Anti-Debug - Antinet Preset

I tried using the "antinet" preset with the "anti debug" protection but it seems to cause an exception with ConfuserEx. The exception occurs in the method GetParameter in ProtectionParameters.cs which throws an exception for the key being null.

This is what the project looks like (might be something wrong):

<?xml version="1.0" encoding="utf-8"?>
<project baseDir="." outputDir="Confused" xmlns="http://confuser.codeplex.com">
    <rule preset="none" pattern="true">
        <protection id="anti debug">
            <argument name="mode" value="antinet" />
        </protection>
        <protection id="anti dump" />
        <protection id="anti ildasm" />
        <protection id="anti tamper">
            <argument name="mode" value="jit" />
        </protection>
        <protection id="constants">
            <argument name="mode" value="dynamic" />
        </protection>
        <protection id="ctrl flow" />
        <protection id="invalid metadata" />
        <protection id="ref proxy">
            <argument name="mode" value="strong" />
            <argument name="encoding" value="expression" />
        </protection>
        <protection id="rename">
            <argument name="mode" value="unicode" />
        </protection>
        <protection id="resources" />
    </rule>
    <module path="test.exe" />
</project>

EDIT - Also tried with other presets and it still produces the same issue. My guess it's to do with this line of code in NameService.cs:

analyze.Analyze(this, context, ProtectionParameters.Empty, def, true);

Which eventually leads to GetParameter in ProtectionParameters.cs and throws an exception for the key being null:

// For protections
var objParams = context.Annotations.Get<ProtectionSettings>(target, ParametersKey);
if (objParams == null)
    return defValue;
if (!objParams.TryGetValue(comp, out parameters))
    return defValue;

Making this edit seems to fix the problem:

if (comp == null)
    return defValue;
var objParams = context.Annotations.Get<ProtectionSettings>(target, ParametersKey);
if (objParams == null)
    return defValue;
if (!objParams.TryGetValue(comp, out parameters))
    return defValue;

How can I donate to this project ?

Hi, really sorry to post in here since I can't find any place for asking question about this.
I would like to donate ConfuserEX project, are you accepting any donation ?

Thanks

Renaming not work for public member

Hello, I confirmed renaming only work for exe but not dll in ConfuserEx v0.1.2,
Here is my crproj

<?xml version="1.0" encoding="utf-8"?>
<project baseDir=".\bin\Debug" outputDir="Confused" xmlns="http://confuser.codeplex.com">
    <rule preset="none" pattern="true">
        <protection id="rename" />
    </rule>
    <module path="ConsoleApplication1.exe" />
    <module path="ClassLibrary1.dll" />
</project>

Only members in ConsoleApplication1.exe are renamed.
Is it a bug or not supported yet?

TypeResolveException: Could not resolve type: Microsoft.Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElementCollection`2

Hi.

Thank you for ConfuserEx.
Windows 7 x64 SP1
.NET Framework 3.5 Assembly
Confuser 0.1.2

Confuser.CLI.exe MyAssembly.crproj
MyAssembly.crproj:

<?xml version="1.0" encoding="utf-8"?>
<project baseDir="." outputDir="." xmlns="http://confuser.codeplex.com">
    <rule preset="none" pattern="true">
        <protection id="anti debug" />
        <protection id="anti dump" />
        <protection id="anti ildasm" />
        <protection id="anti tamper" />
        <protection id="constants" />
        <protection id="ctrl flow" />
        <protection id="invalid metadata" />
        <protection id="ref proxy" />
        <protection id="rename" />
        <protection id="resources" />
    </rule>
    <module path="MyAssembly.exe" snKey="..\StrongName.snk" />
</project>

Output:

 [INFO] ConfuserEx v0.1.0-21-g8d974cf Copyright (C) Ki 2014
 [INFO] Running on Microsoft Windows NT 6.1.7601 Service Pack 1, .NET Framework
v2.0.50727.5477, 64 bits
[DEBUG] Discovering plugins...
 [INFO] Discovered 10 protections, 1 packers.
[DEBUG] Resolving component dependency...
 [INFO] Loading input modules...
 [INFO] Loading 'MyAssembly.exe'...
 [INFO] Initializing...
[DEBUG] Building pipeline...
 [INFO] Resolving dependencies...
[DEBUG] Checking Strong Name...
 [WARN] [MyAssembly.exe] SN Key is not provided for a signed module, the
 output may not be working.
[DEBUG] Creating global .cctors...
[DEBUG] Watermarking...
[DEBUG] Building VTables & identifier list...
[DEBUG] Analyzing...
[ERROR] Failed to resolve a type, check if all dependencies are of correct versi
on.
Exception: dnlib.DotNet.TypeResolveException: Could not resolve type: Microsoft.
Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElementCol
lection`2
   at dnlib.DotNet.TypeRef.ResolveThrow() in e:\Source\Public\Confuser2\dnlib\sr
c\DotNet\TypeRef.cs:line 331
   at Confuser.Renamer.Analyzers.InterReferenceAnalyzer.Analyze(ConfuserContext
context, INameService service, IDnlibDef def) in e:\Source\Public\Confuser2\Conf
user.Renamer\Analyzers\InterReferenceAnalyzer.cs:line 36
   at Confuser.Renamer.AnalyzePhase.Analyze(NameService service, ConfuserContext
 context, IDnlibDef def, Boolean runAnalyzer) in e:\Source\Public\Confuser2\Conf
user.Renamer\AnalyzePhase.cs:line 69
   at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionP
arameters parameters) in e:\Source\Public\Confuser2\Confuser.Renamer\AnalyzePhas
e.cs:line 47
   at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action`
1 func, Func`1 targets, ConfuserContext context) in e:\Source\Public\Confuser2\C
onfuser.Core\ProtectionPipeline.cs:line 130
   at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, Conf
userContext context) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.
cs:line 187
   at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, Ca
ncellationToken token) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngin
e.cs:line 146
Failed at 5:03 PM, 0:04 elapsed.

The assembly has been merged with ilmerge but doesn't include Microsoft.Practices.EnterpriseLibrary.Common.dll.
In either case, Microsoft.Practices.EnterpriseLibrary.Common.dll exists in the same directory as MyAssembly.exe.

Any ideas?

Thank you.

Confuscating signed assemblies

Hello
I am not sure, if this is the right place to ask questions, but I don't know where to ask elsewhere.
Often assemblies need to be signed (with strong name) - for example when implementing own ProtectedConfigurationProvider for protecting sections in application configs.
How can this be achieved when using this confuscator?
Thanks in advance,
Roger

Figured out error while obfuscating Xamarin MONO generated dll

[INFO] ConfuserEx v0.2.2 Copyright (C) Ki 2014
[INFO] Running on Microsoft Windows NT 6.1.7601 Service Pack 1, .NET Framework
v2.0.50727.5477, 64 bits
[DEBUG] Discovering plugins...
[INFO] Discovered 10 protections, 1 packers.
[DEBUG] Resolving component dependency...
[INFO] Loading input modules...
[INFO] Loading 'MyDllName.dll'...
[INFO] Initializing...
[DEBUG] Building pipeline...
[INFO] Resolving dependencies...
[DEBUG] Checking Strong Name...
[DEBUG] Creating global .cctors...
[DEBUG] Watermarking...
[DEBUG] Executing 'Name analysis' phase...
[DEBUG] Building VTables & identifier list...
[ERROR] Failed to resolve a type, check if all dependencies are of correct versi
on.
Exception: dnlib.DotNet.TypeResolveException: Could not resolve type: System.Run
time.CompilerServices.IAsyncStateMachine
bei dnlib.DotNet.TypeRef.ResolveThrow() in e:\Source\Public\Confuser2\dnlib\s
rc\DotNet\TypeRef.cs:Zeile 331.
bei Confuser.Renamer.VTableStorage.GetVTable(ITypeDefOrRef type) in e:\Source
\Public\Confuser2\Confuser.Renamer\VTable.cs:Zeile 248.
bei Confuser.Renamer.VTable.ConstructVTable(TypeDef typeDef, VTableStorage st
orage) in e:\Source\Public\Confuser2\Confuser.Renamer\VTable.cs:Zeile 175.
bei Confuser.Renamer.VTableStorage.GetOrConstruct(TypeDef type) in e:\Source
Public\Confuser2\Confuser.Renamer\VTable.cs:Zeile 238.
bei Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, Protection
Parameters parameters) in e:\Source\Public\Confuser2\Confuser.Renamer\AnalyzePha
se.cs:Zeile 44.
bei Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action
1 func, Func1 targets, ConfuserContext context) in e:\Source\Public\Confuser2
Confuser.Core\ProtectionPipeline.cs:Zeile 132.
bei Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, Con
fuserContext context) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine
.cs:Zeile 191.
bei Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, C
ancellationToken token) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngi
ne.cs:Zeile 158.
Failed at 15:28, 0:00 elapsed.

How to make a custom version of ConfuserEx?

This is more like a Q&A than an issue report but I don't know where to ask so I post it here. Therefore, I'm sorry about that.
In your FAQ, you mention "a generic deobfuscator for different custom version of ConfuserEx would be virtually impossible to be created."

  1. What classes in the source code should I work on in order to make a custom version?
  2. Is it helpful if I provide a seed to crproj file?
  3. If my application includes a strong name key, does it make harder being deobfuscated?
  4. And how do I implement a plug-in?
    Thank you very much.

Failed to resolve a member, check if all dependencies are of correct version.

Getting the above error when trying to obfuscate a SharePoint client console application. Created a very simple console app to reproduce the error. Uploaded the sample and project xml file to https://onedrive.live.com/redir?resid=A8314A43FAE2ED81%21202

Just wondering what is causing the referenced Microsoft.SharePoint.Client.dll to be processed. I would expect it to be ignored?
Is there a way to tell ConfuserEx to ignore certain classes?

The output from ConfuserEx is:

C:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\Debug\bin>C:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\Debug\bin\Confuser.CLI.exe C:\Projects\Injasuti\Injasuti.MSS\Source-SPExplorer-Client\confuser.xml
[INFO] ConfuserEx v0.1 Copyright (C) Ki 2014
[INFO] Running on Microsoft Windows NT 6.1.7601 Service Pack 1, .NET Framework v2.0.50727.5477, 64 bits
[DEBUG] Discovering plugins...
[INFO] Discovered 10 protections, 0 packers.
[DEBUG] Resolving component dependency...
[INFO] Loading input modules...
[INFO] Loading 'Confusion.Test.exe'...
[INFO] Initializing...
[DEBUG] Building pipeline...
[INFO] Resolving dependencies...
[DEBUG] Checking Strong Name...
[DEBUG] Creating global .cctors...
[DEBUG] Watermarking...
[DEBUG] Building VTables & identifier list...
[DEBUG] Analyzing...
[ERROR] Failed to resolve a member, check if all dependencies are of correct version.
Exception: dnlib.DotNet.MemberRefResolveException: Could not resolve field: System.String Microsoft.SharePoint.Client.Web::get_ServerRelativeUrl()
at dnlib.DotNet.MemberRef.ResolveFieldThrow() in c:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\dnlib\src\DotNet\MemberRef.cs:line 369
at Confuser.Core.DnlibUtils.ResolveThrow(IField field) in c:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\Confuser.Core\DnlibUtils.cs:line 204
at Confuser.Renamer.Analyzers.LdtokenEnumAnalyzer.Analyze(ConfuserContext context, INameService service, IDnlibDef def) in c:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\Confuser.Renamer\Analyzers\LdtokenEnumAnalyzer.cs:line 31
at Confuser.Renamer.AnalyzePhase.Analyze(NameService service, ConfuserContext context, IDnlibDef def, Boolean runAnalyzer) in c:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\Confuser.Renamer\AnalyzePhase.cs:line 82
at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionParameters parameters) in c:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\Confuser.Renamer\AnalyzePhase.cs:line 59
at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action1 func, Func1 targets, ConfuserContext context) in c:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\Confuser.Core\ProtectionPipeline.cs:line 138
at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context) in c:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\Confuser.Core\ConfuserEngine.cs:line 181
at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) in c:\Projects\github.com\yck1509\ConfuserEx\ConfuserEx-master\Confuser.Core\ConfuserEngine.cs:line 131
Failed at 10:28 PM, 0:00 elapsed.

Any help gratefully accepted.

Finalizing IOException The requested operation cannot be performed on a file with a user-mapped section open.

[INFO] Finalizing...
[ERROR] An IO error occured, check if all input/output locations are read/writable.
Exception: System.IO.IOException: The requested operation cannot be performed on
a file with a user-mapped section open.

(just at the last second before the end...config is basic, similar one works on another far-simpler project)

(latest confuser exe)
visual studio closed
restart computer
anti virus off(panda)

Slowing an important release going out of the door!
Thanks,
Craig

Abstract methods are not renamed

It looks like abstract methods are specifically excluded from renaming, but I'm not sure why.

To fix it I just commented out line 21 of VTableAnalyzer.cs:

20:    if (method.IsAbstract) {
21:        //service.SetCanRename(method, false);

And now abstract methods are being properly renamed (and overridden methods in derived types correctly pick up the same name).

Rule exclude all member

I want to exclude all member from (ref proxy) only my method added execute process but following project not work, Also, How can add several method without add new rule tag? Thanks.

<rule preset="none" pattern=".*">
    <protection id="rename">
        <argument name="mode" value="unicode" />
    </protection>
    <protection id="anti ildasm" />
    <protection id="anti debug" />
    <protection id="rename">
        <argument name="mode" value="unicode" />
    </protection>
    <protection id="ref proxy" />
    <protection id="ctrl flow" />
</rule>
<rule preset="none" pattern="PaintDotNet.Menus\..*Menu(|Item|Base)$">
    <protection id="rename" action="remove" />
</rule>
<rule preset="none" pattern="PaintDotNet.Menus\..*Menu::menu.*$">
    <protection id="rename" action="remove" />
</rule>
<rule preset="none" pattern="PaintDotNet.Tools\..*Tool(|Base)$">
    <protection id="rename" action="remove" />
</rule>
<rule preset="none" pattern="PaintDotNet.IndirectUI\..*PropertyControl.*\(\)$">
    <protection id="rename" action="remove" />
</rule>
<rule preset="none" pattern="PaintDotNet.ShapeDrawType PaintDotNet.AppEnvironment::get_ShapeDrawType()">
    <protection id="ref proxy" action="add" />
</rule>
<module path="PaintDotNet.Base.dll" />
<module path="PaintDotNet.Core.dll" />
<module path="PaintDotNet.Data.dll" />
<module path="PaintDotNet.Effects.dll" />
<module path="PaintDotNet.exe" />
<module path="PaintDotNet.SystemLayer.dll" />

Empty output

Today i was using ConfuserEX for obfuscating "MegaDumper" (pretty famus dotnet dumper)
but when ConfuserEx finished to obfuscate, "confused" directory was empty. I tried to obfuscate MegaDumper many times but confused directory still empty. Is there a bug?
Protection prameters that i used:
cattura

error KeyNotFoundException

I got an error when launched protect. Log below.

[INFO] ConfuserEx v0.2.2 Copyright (C) Ki 2014
[INFO] Running on Microsoft Windows NT 6.1.7601 Service Pack 1, .NET Framework v4.0.30319.18408, 64 bits
[DEBUG] Discovering plugins...
[INFO] Discovered 10 protections, 1 packers.
[DEBUG] Resolving component dependency...
[INFO] Loading input modules...
[INFO] Loading 'EveryLang.exe'...
[INFO] Initializing...
[DEBUG] Building pipeline...
[INFO] Resolving dependencies...
[DEBUG] Checking Strong Name...
[DEBUG] Creating global .cctors...
[DEBUG] Watermarking...
[DEBUG] Executing 'Name analysis' phase...
[DEBUG] Building VTables & identifier list...
[ERROR] Unknown error occured.
Exception: System.Collections.Generic.KeyNotFoundException: Данный ключ отсутствует в словаре.
в System.Collections.Generic.Dictionary2.get_Item(TKey key) в Confuser.Renamer.VTable.Override(Dictionary2 slotDict, VTableSignature sig, VTableSlot slot, MethodDef target) в e:\Source\Public\Confuser2\Confuser.Renamer\VTable.cs:строка 125
в Confuser.Renamer.VTable.ConstructVTable(TypeDef typeDef, VTableStorage storage) в e:\Source\Public\Confuser2\Confuser.Renamer\VTable.cs:строка 198
в Confuser.Renamer.VTableStorage.GetOrConstruct(TypeDef type) в e:\Source\Public\Confuser2\Confuser.Renamer\VTable.cs:строка 238
в Confuser.Renamer.VTableStorage.GetVTable(ITypeDefOrRef type) в e:\Source\Public\Confuser2\Confuser.Renamer\VTable.cs:строка 246
в Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionParameters parameters) в e:\Source\Public\Confuser2\Confuser.Renamer\AnalyzePhase.cs:строка 44
в Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action1 func, Func1 targets, ConfuserContext context) в e:\Source\Public\Confuser2\Confuser.Core\ProtectionPipeline.cs:строка 132
в Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context) в e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.cs:строка 191
в Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) в e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.cs:строка 158
Failed at 14:03, 0:00 elapsed.

Assembly.GetType(...) fails with names starting with \u2028

Assembly.GetType(...) fails when a name starts with the unicode character \u2028.

For example, the following program obfuscated with only the renamer and a seed = "12" will fail.

internal static class Program
{
    static void Main()
    {
        Do<MyClass1>();
        Do<MyClass2>();
        Do<MyClass3>();
        Do<MyClass4>();
        Do<MyClass5>();
        Do<MyClass6>();
        Do<MyClass7>();
        Do<MyClass8>();
        Do<MyClass9>();
    }

    public static void Do<T>()
    {
        Console.WriteLine("Doing {0}", String.Concat(from c in typeof(T).Name
                                                        select String.Format(@"\u{0:x4}", (int)c)));
        var t = Assembly.GetExecutingAssembly().GetType(typeof(T).FullName);
        if (t == null)
            throw new Exception("Type not found!!");
    }
}

internal sealed class MyClass1 { }
internal sealed class MyClass2 { }
internal sealed class MyClass3 { }
internal sealed class MyClass4 { }
internal sealed class MyClass5 { }
internal sealed class MyClass6 { }
internal sealed class MyClass7 { }
internal sealed class MyClass8 { }
internal sealed class MyClass9 { }

Maybe, you should remove the \u2028 character from the allowed characters for the renaming.

External plugins

Is there support for external plugins implemented yet? As far as I can see ConfuserEx only looks for protections and packers in Confuser.Protections, Confuser.Renamer and Confuser.DynCipher.

Is this intended or am I missing something?

packer : Compressor - gives error in build - [ERROR] No main module specified!

Hi yck, (long time!)

In the documentation the packer tag is said to be unused but it definitely is not ignored.

gives me a build error as below.

when removed it builds fine.

BTW, I have used ILmerge on two assemblies and then renamed that resulting assembly?

[DEBUG] Resolving component dependency...
[INFO] Loading input modules...
[INFO] Loading 'g:\project\runme.exe'
[INFO] Initializing...
[DEBUG] Building pipeline...
[INFO] Resolving dependencies...
[DEBUG] Checking Strong Name...
[DEBUG] Creating global .cctors...
[DEBUG] Watermarking...
[DEBUG] Building VTables & identifier list...
[DEBUG] Analyzing...
[INFO] Processing module 'runme-merged.exe'...
[DEBUG] Renaming...
[INFO] Writing module 'runme-merged.exe'...
[INFO] Finalizing...
[INFO] Packing...
[ERROR] No main module specified!

Tks,
Craig

Virus Detection

Confuser has worked great for us except that anti-virus software flagging our apps as malware. There have been many tickets open for this on codeplex: #8900, #8899, #8645, and esp. #8899 one where you (@yck1509) mentioned that it will be hard to fix. Has this been taken care of or any way for us to fix it compiling from the source? One way that I can think of is to allow to pass some guids or unique signatures in *.crproj that can be used during obfuscation (sorry if this doesn't make sense; I wish I knew more about obfuscation processes).

invalid MD

var root = writer.MetaData.TablesHeap.TypeDefTable.Add(new RawTypeDefRow(0, 0x7fff7fff, 0, 0x3FFFD, fieldLen, methodLen));

What is "0x3FFFD" ? Since if i try to modd the loop statement it doesnt work anymore (app isnt runnable, i meanà

foreach (var ns in namespaces)
{
if (ns == 0) continue;
var type = writer.MetaData.TablesHeap.TypeDefTable.Add(new RawTypeDefRow(0, 0, ns, 0x6FFFD, fieldLen, methodLen));
writer.MetaData.TablesHeap.NestedClassTable.Add(new RawNestedClassRow(root, type));
var type2 = writer.MetaData.TablesHeap.TypeDefTable.Add(new RawTypeDefRow(0, 0, ns, 0x5FFFD, fieldLen, methodLen));
writer.MetaData.TablesHeap.NestedClassTable.Add(new RawNestedClassRow(root, type2));
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.