Allatori系列教程:Java obfuscator配置文件结构

Allatori是第二代Java代码混淆器,具有大部分第二代混淆器的保护功能。Allatori除了保护功能之外,还附加了一系列的功能,几乎可以抵御一切的代码攻击。同时,Allatori可以让您的程序体积更小,速度更快。本文主要介绍Allatori Java obfuscator配置文件结构~

当然很多用过Allatori的朋友都反应配置文件结构是使用过程中最烧脑的过程了!

试用下载

Allatori配置文件是一个XML文件,具有以下结构:

<config>
    <input basedir="input-jars" single-jar="application.jar">
        <jar in="app.jar" out="app-obf.jar"/>
        <jar in="input/*.jar" out="output/*.jar"/>

        <dir in="in-dir" out="out-dir"/>
    </input>

    <classpath basedir="library-jars">
        <!-- Adding library.jar to the classpath -->
        <jar name="library.jar"/>
        <!-- Adding all jars in the lib directory to the classpath -->
        <jar name="lib/*.jar"/>
        <!-- Adding all jars in the lib2 directory and its subdirectories to the classpath -->
        <jar name="lib2/**/*.jar"/>
    </classpath>

    <keep-names>
        <class template="class SomeClass"/>
        <class template="class * instanceof java.io.Serializable"/>
        <class template="class com.package.*"/>
        <class access="protected+">
            <field access="protected+"/>
            <method access="protected+"/>
        </class>
        <class template="class com.company.abc.*">
            <field template="public int *"/>
            <method template="public get*(*)"/>
            <method template="public set*(*)"/>
        </class>
    </keep-names>

    <watermark key="secure-key-to-extract-watermark" value="Customer: John Smith"/>

    <expiry date="2017/01/01" string="EXPIRED!"/>

    <!-- Configuration properties, all properties are optional -->
    <!-- General properties, we recommend to use these two properties -->
    <property name="log-file" value="renaming-log.xml"/>
    <property name="random-seed" value="type anything here"/>

    <!-- String encryption -->
    <property name="string-encryption" value="enable"/>
    <property name="string-encryption-type" value="fast"/>
    <property name="string-encryption-version" value="v4"/>
    <property name="string-encryption-ignored-strings" value="patterns.txt"/>

    <!-- Control flow obfuscation -->
    <property name="control-flow-obfuscation" value="enable"/>
    <property name="extensive-flow-obfuscation" value="normal"/>

    <!-- Renaming -->
    <property name="default-package" value="com.package"/>
    <property name="force-default-package" value="enable"/>

    <property name="packages-naming" value="abc"/>
    <property name="classes-naming" value="compact"/>
    <property name="methods-naming" value="compact"/>
    <property name="fields-naming" value="compact"/>
    <property name="local-variables-naming" value="optimize"/>

    <property name="update-resource-names" value="enable"/>
    <property name="update-resource-contents" value="enable"/>

    <!-- Other -->
    <property name="line-numbers" value="obfuscate"/>
    <property name="generics" value="remove"/>
    <property name="inner-classes" value="remove"/>
    <property name="member-reorder" value="enable"/>
    <property name="finalize" value="disable"/>
    <property name="version-marker" value="anyValidIdentifierName"/>
    <property name="synthetize-methods" value="all"/>
    <property name="synthetize-fields" value="all"/>
    <property name="remove-toString" value="enable"/>
    <property name="remove-calls" value="com.package.Logger.debug"/>
    <property name="output-jar-compression-level" value="9"/>

    <!-- Incremental obfuscation -->
    <property name="incremental-obfuscation" value="input-renaming-log.xml"/>
</config>

注意1:所有相对路径都是根据配置文件位置解析的。

注意2:如果从Ant运行Allatori,则可以使用标准Ant语法引用Ant构建文件中定义的属性:$ {PropertyName}。

注意3:可以分别使用$ {System.getProperty(property.name)}和$ {System.getenv(VARIABLE_NAME)} 引用系统属性和环境变量。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值