C#动态库混淆并在Unity3D中的应用

因为动态库是要用在Unity3D开发环境的,所以本文记录了使用Eazfuscator.NET混淆C#动态库的一些注意事项。

Eazfuscator.NET是针对.NET开发环境的混淆工具。现在已经开始收费,这里有一个免费版https://download.csdn.net/download/andyhebear/4765606

1.准备动态库。

由于历史原因我使用了MonoDevelop来写动态库。由于在Unity3D中,继承MonoBehaviour的脚本有私有的事件方法,为了使这部分方法在混淆后有效,根据Eazfuscator的帮助手册,可以将此类方法指定为受保护的,并可视化。例如

using UnityEngine;

// 原始的类
public class MyClass:MonoBehaviour{
    void Start(){}

    void Update(){}
}

要使Start()和Update()两个方法效,就可以做如下改写

using UnityEngine;
using System.Reflection;

// 支持混淆的类
public class MyClass:MonoBehaviour{

    [Obfuscation(Feature = "family and assembly visibility", Exclude = false)]
    protected void Start(){}

    [Obfuscation(Feature = "family and assembly visibility", Exclude = false)]
    protected void Update(){}
}

如果想混淆代码控制流程,可以加上相应属性,如下

using UnityEngine;
using System.Reflection;

// 支持混淆的类
[assembly: Obfuscation(Feature = "code control flow obfuscation", Exclude = false)]
public class MyClass:MonoBehaviour{

    [Obfuscation(Feature = "family and assembly visibility", Exclude = false)]
    protected void Start(){}

    [Obfuscation(Feature = "family and assembly visibility", Exclude = false)]
    protected void Update(){}
}

2.使用Eazfuscator.Net混淆。

Eazfuscator的混淆操作很简单,直接把编译好的库拖入,等待处理完成就会自动用混淆后的库替换原来的库。

至此,混淆后的库可以在Unity3D中使用了。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
淘宝花钱买的最新版!需要的拿去! This asset obfuscates your code to make it harder for bad guys to reverse engineer your projects. Specifically designed for Unity, it seamlessly links in with its build process. The top priority of this package is to work straight out of the box with no extra steps required. While other obfuscators can stop a game from working, Beebyte's obfuscator looks for specific Unity related code that must be protected. The contents of your source files are unchanged, the obfuscation targets the compiled assembly. Features: - Supports IL2CPP - Supports Assembly Definition Files (Unity 2017.3+) - Removes Namespaces without any conflicts - Recognises Unity related code that must not be changed - Renames Classes (including MonoBehaviours) - Renames Methods - Renames Parameters - Renames Fields - Renames Properties - Renames Events - String literal obfuscation - Adds fake methods - Easy and extensive customisation using the Unity inspector window - Consistent name translations are possible across multiple builds and developers - Semantically secure cryptographic naming convention for renamed members The asset works for both Unity Free and Unity Pro version 4.2.0 onwards (including Unity 5 & 2017 & 2018). Build targets include Standalone, Android, iOS, WebGL, UWP. Other platforms are not guaranteed or supported but may become supported at a future date. IL2CPP builds are much harder to reverse engineer but strings and member information (class, method names etc) are visible in the global-metadata.dat file. Obfuscation will apply to this file adding further security. Why not complement your security with the Anti-Cheat Toolkit - a great third party asset. For more information about the Obfuscator, please see the FAQ

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值