import java.time.LocalDateTime;public class Demo { public static void main(String[] args) { LocalDateTime now = LocalDateTime.now(); System.out.println("date print" + now); } private Object timePrivate() { LocalDateTime now = LocalDateTime.now(); System.out.println("date print" + now); return now; } private Object timePublic() { System.out.println(timePrivate()); LocalDateTime now = LocalDateTime.now(); System.out.println("date print" + now); return now; }}从下图的对比来看, 混淆的效果相差非常大, 7.7版本无疑更加优秀
6.1混淆效果
7.7混淆效果
<build> <finalName>allatori_demo</finalName> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>run-allatori</id> <phase>package</phase> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <includePluginDependencies>true</includePluginDependencies> <executable>java</executable> <arguments> <argument>-jar</argument> <argument>${build.outputDirectory}/allatori.jar</argument> <argument>${build.outputDirectory}/allatori.xml</argument> </arguments> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>在任意目录放入allatori.jar和allatori.xml, jar包可以从
后解压出来, 文档的使用也有详细的说明
配置结构
<config> <input> <jar in="../allatori_demo.jar" out="../obf-allatori_demo.jar"/> </input> <keep-names> <class template="class * instanceof java.io.Serializable"/> <class access="protected+"> <field access="protected+"/> <method access="protected+"/> </class> </keep-names> <ignore-classes> <!-- 以com.code1开头的类不进行混淆 --> <class template="class regex:^(?!com.code1).*"/> </ignore-classes> <property name="line-numbers" value="keep"/></config>原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。