ConfuserEx
ConfuserEx copied to clipboard
Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
I am trying to use Confuser, but its confusing me 😆
- Following is my .crproject file
<?xml version="1.0" encoding="utf-8"?>
<project baseDir="myProjectBaseDir" outputDir="myConfusedOutputDir" 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="pathToDllFileToBeConfused.dll" />
<module path="pathToAllReferencesDlls.dll" />
<probePath>MySearchPathToFindDependecies</probePath>
</project>
- Everything goes well, my exception occurs within in the dnlib module. Following is the error message:
[INFO] ConfuserEx v1.0.0 Copyright (C) Ki 2014
[INFO] Running on Unix 17.2.0.0, 5.4.1.6 (2017-06/1f4613aa1ac Wed Oct 18 09:31:57 EDT 2017), 64 bits
[DEBUG] Discovering plugins...
[INFO] Discovered 10 protections, 1 packers.
[DEBUG] Resolving component dependency...
[INFO] Loading input modules...
[INFO] Loading 'pathToDllFileToBeConfused.dll'...
[INFO] Loading 'referenced.dll'...
[INFO] Loading 'anotherreferenced.dll'...
[INFO] Loading 'another.dll'...
[INFO] Loading 'onemore.dll'...
[INFO] Loading 'stillonemoretogo.dll'...
[INFO] Loading 'mylastreferencesDLL.dll'...
[INFO] Initializing...
[DEBUG] Building pipeline...
[INFO] Resolving dependencies...
[DEBUG] Checking Strong Name...
[WARN] [Newtonsoft.Json.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...
[DEBUG] Analyzing...
[DEBUG] Newtonsoft.Json found, enabling compatibility.
[INFO] Processing module 'pathToDllFileToBeConfused'...
[DEBUG] Executing 'Invalid metadata addition' phase...
[DEBUG] Executing 'Renaming' phase...
[DEBUG] Renaming...
[DEBUG] Executing 'Anti-debug injection' phase...
[DEBUG] Executing 'Anti-dump injection' phase...
[DEBUG] Executing 'Anti-ILDasm marking' phase...
[DEBUG] Executing 'Encoding reference proxies' phase...
[DEBUG] Executing 'Constant encryption helpers injection' phase...
[DEBUG] Executing 'Resource encryption helpers injection' phase...
[DEBUG] Executing 'Constants encoding' phase...
[DEBUG] Executing 'Anti-tamper helpers injection' phase...
[DEBUG] Executing 'Control flow mangling' phase...
[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 (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <4fdc5ed61a074cafb49fa42deb20d521>:0
at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <4fdc5ed61a074cafb49fa42deb20d521>:0
at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <4fdc5ed61a074cafb49fa42deb20d521>:0
at Confuser.Protections.ControlFlow.ControlFlowPhase.DisabledOptimization (dnlib.DotNet.ModuleDef module) [0x0005a] in <f5ee7f66a9a9406a85a7ee3af5d3ac67>:0
at Confuser.Protections.ControlFlow.ControlFlowPhase.Execute (Confuser.Core.ConfuserContext context, Confuser.Core.ProtectionParameters parameters) [0x00006] in <f5ee7f66a9a9406a85a7ee3af5d3ac67>:0
at Confuser.Core.ProtectionPipeline.ExecuteStage (Confuser.Core.PipelineStage stage, System.Action`1[T] func, System.Func`1[TResult] targets, Confuser.Core.ConfuserContext context) [0x00061] in <d2bd336d92d44b09ad2a273be80d7684>:0
at Confuser.Core.ConfuserEngine.RunPipeline (Confuser.Core.ProtectionPipeline pipeline, Confuser.Core.ConfuserContext context) [0x00144] in <d2bd336d92d44b09ad2a273be80d7684>:0
at Confuser.Core.ConfuserEngine.RunInternal (Confuser.Core.ConfuserParameters parameters, System.Threading.CancellationToken token) [0x0042f] in <d2bd336d92d44b09ad2a273be80d7684>:0
Failed at 11:34 AM, 0:01 elapsed.
Press any key to continue...
- I am using binary files downloaded from github. I am running following command in terminal
mono ConfuserEx_bin/Confuser.CLI.exe myProjectFile.crproj
@emysa341 - I'm running into the same issue when running ConfuserEx on Mac. To get passed this, I tried
<protection id="ctrl flow" action="remove"/>
in my crproj, but still get the exception.
Were you able to resolve this (even if temporarily)?