yck1509 / ConfuserEx

An open-source, free protector for .NET applications
http://yck1509.github.io/ConfuserEx/
Other
3.54k stars 1.61k forks source link

Declarative Obfuscation #268

Open ambyte opened 9 years ago

ambyte commented 9 years ago

This not working [Obfuscation(Exclude = true)] class Program {

ConfuserEx currently support this feature? I try in Confuser.CLI.exe

yck1509 commented 9 years ago

Hi, Please try the latest version at the CI Server.

ambyte commented 9 years ago

I tried the last version

[ERROR] Unknown error occurred. Exception: System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта. в Confuser.Core.ObfAttrMarker.MarkModule(ProjectModule projModule, ModuleDefMD module, Dictionary`2 rules, Boolean isMain) в d:\myprojects\EveryLang\ConfuserEx\new\ConfuserEx-master\Confuser.Core\ObfAttrMarker.cs:строка 238 в Confuser.Core.ObfAttrMarker.MarkProject(ConfuserProject proj, ConfuserContext context) в d:\myprojects\EveryLang\ConfuserEx\new\ConfuserEx-master\Confuser.Core\ObfAttrMarker.cs:строка 213 в Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) в d:\myprojects\EveryLang\ConfuserEx\new\ConfuserEx-master\Confuser.Core\ConfuserEngine.cs:строка 135

yck1509 commented 9 years ago

I just pushed a new commit, please try the build at the CI Server.

ambyte commented 9 years ago

new error [ERROR] Unknown error occurred. Exception: System.ArgumentNullException: Значение не может быть неопределенным. Имя параметра: key в System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) в Confuser.Core.ObfAttrParser.ParseProtectionString(ProtectionSettings settings, String str) в d:\myprojects\EveryLang\ConfuserEx\ConfuserEx-master\ConfuserEx\Confuser.Core\ObfAttrParser.cs:строка 185 в Confuser.Core.ObfAttrMarker.ApplySettings(IDnlibDef def, Dictionary2 rules, IEnumerable1 infos, ProtectionSettings settings) в d:\myprojects\EveryLang\ConfuserEx\ConfuserEx-master\ConfuserEx\Confuser.Core\ObfAttrMarker.cs:строка 153 в Confuser.Core.ObfAttrMarker.ProcessModule(ModuleDefMD module, Dictionary2 rules, String snKeyPath, String snKeyPass, List1 settingAttrs, Dictionary2 namespaceAttrs) в d:\myprojects\EveryLang\ConfuserEx\ConfuserEx-master\ConfuserEx\Confuser.Core\ObfAttrMarker.cs:строка 330 в Confuser.Core.ObfAttrMarker.MarkModule(ProjectModule projModule, ModuleDefMD module, Dictionary`2 rules, Boolean isMain) в d:\myprojects\EveryLang\ConfuserEx\ConfuserEx-master\ConfuserEx\Confuser.Core\ObfAttrMarker.cs:строка 300 в Confuser.Core.ObfAttrMarker.MarkProject(ConfuserProject proj, ConfuserContext context) в d:\myprojects\EveryLang\ConfuserEx\ConfuserEx-master\ConfuserEx\Confuser.Core\ObfAttrMarker.cs:строка 214 в Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) в d:\myprojects\EveryLang\ConfuserEx\ConfuserEx-master\ConfuserEx\Confuser.Core\ConfuserEngine.cs:строка 135 Failed at 12:36, 1:03 elapsed.

In line 153 ObfAttrMarker parser.ParseProtectionString(settings, info.Settings); settings count = 0

yck1509 commented 9 years ago

What is the settings of the ObfuscationAttributes you used?

ambyte commented 9 years ago

I removed all ObfuscationAttributes and error also appears

yck1509 commented 9 years ago

Would it be possible to send me a demo project that would demonstrate the issue?

ambyte commented 9 years ago

I cant reproduce this in demo project. I changed code in Confuser.Core.ObfAttrMarker in line 152 if (info.ApplyToMember && !string.IsNullOrEmpty(info.Settings)) { if (info.ApplyToMember && !string.IsNullOrEmpty(info.Settings) && settings.Count!=0) { And its work. But attribute Exclude = true is not work

ambyte commented 9 years ago

I found in my project third-party code with ObfuscationAttributes [assembly: Obfuscation(Feature = "encrypt resources", Exclude = false)] [assembly: Obfuscation(Feature = "string encryption", Exclude = false)] [Obfuscation(Feature = "virtualization", Exclude = false)] it was the cause of the error