allatori混淆工具_使用Allatori对Spring Boot项目进行代码混淆

Allatori混淆技术介绍

Allatori是一个Java 混淆器,它属于第二代混淆器,因此它能够全方位的保护你的知识产权。 Allatori具有以下几种保护方式:命名混淆,流混淆,调试信息混淆,字符串混淆,以及水印技术。对于教育和非商业项目来说这个混淆器是免费的。支持war和jar文件格式,并且允许对需要混淆代码的应用程序添加有效日期。 有项目需要对代码进行保护,比较初级的方案就是对代码进行混淆,打包之后的文件进行反编译后,就可以看到效果。此外,使用Allatori打的包大小也会小一点。

工程介绍

一个很普通的maven工程,不同的是在根目录下加入Allatori的jar包。

下面我们来看看pom.xml文件:

4.0.0

com.lovnx

confusion

0.0.1-SNAPSHOT

jar

org.springframework.boot

spring-boot-maven-plugin

org.apache.maven.plugins

maven-resources-plugin

2.6

copy-and-filter-allatori-config

package

copy-resources

${basedir}/target

${basedir}/allatori

allatori.xml

true

org.codehaus.mojo

exec-maven-plugin

1.2.1

run-allatori

package

exec

java

-Xms128m

-Xmx512m

-jar

${basedir}/lib/allatori.jar

${basedir}/target/allatori.xml

junit

junit

test

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-starter-parent

1.5.8.RELEASE

使用maven打包插件,Spring Boot构建的工程,Allatori的配置在上面也有说明,Allatori配置里面比较重要的是:

${basedir}/lib/allatori.jar

${basedir}/target/allatori.xml

指定Allatori的allatori.jar文件路径,如果你的工程是一个pom工程,可以在父工程中放lib目录,然后子工程只需要:

../lib/allatori.jar

即可。

allatori.xml这个文件也很重要,看看其中的内容:

即是对Allatori混淆器的具体配置,这里可以配置很多信息,很多种策略,也可以指定哪些类不被混淆,具体的各种方式可以在在文末附件里面的文档得到。

这里需要说明的是:

confusion-0.0.1-SNAPSHOT.jar这个是打包后的未被混淆的包,而confusion-0.0.1-SNAPSHOT-obfuscated.jar是混淆后的包,这个是我们需要的。

打包步骤

1、clean maven工程。

2、将resources下面的allatori.xml文件复制到target目录下面。

3、install maven工程,看到如下信息后表示成功:

################################################

# #

# ## # # ## ### ### ## ### #

# # # # # # # # # # # # # #

# ### # # ### # # # ## # #

# # # ### ### # # # ### # # ### #

# #

# DEMO VERSION! #

# NOT FOR COMMERCIAL USE! #

# #

# Demo version adds System.out's #

# and gives 'ALLATORI_DEMO' name #

# to some fields and methods. #

# #

# #

# Obfuscation by Allatori Obfuscator v6.4 DEMO #

# #

# http://www.allatori.com #

# #

################################################

4、成功后的工程:

箭头所指处即是我们需要的包,此包代码已被混淆。

效果查看

这里使用反编译工具对混淆后的包进行查看,我用的是jd-gui这个软件,小巧实用。

TestApplication.java混淆前:

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication

public class TestApplication {

public static void main(String[] args) {

SpringApplication.run(TestApplication.class, args);

}

}

TestApplication.java混淆后:

import java.io.PrintStream;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication

public class TestApplication {

public static String ALLATORIxDEMO(String a)

{

int tmp4_3 = 4;

int tmp7_6 = 1;

int tmp21_18 = a.length();

int tmp25_24 = 1;

tmp25_24;

int j;

int ? = tmp25_24;

int k = tmp21_18;

int tmp35_31 = (j = new char[tmp21_18] - 1);

tmp35_31;

int i = 5 << 4 ^ (0x2 ^ 0x5);

(tmp4_3 << tmp4_3 ^ tmp7_6 << tmp7_6);

if (tmp35_31 >= 0)

{

int tmp45_44 = j;

j--;

?[tmp45_44] = ((char)(a.charAt(tmp45_44) ^ i));

int tmp66_63 = (j--);

?[tmp66_63] = ((char)(a.charAt(tmp66_63) ^ k));

}

return new String(?);

}

public static void main(String[] a)

{

System.out.println("\n################################################\n# #\n# ## # # ## ### ### ## ### #\n# # # # # # # # # # # # # #\n# ### # # ### # # # ## # #\n# # # ### ### # # # ### # # ### #\n# #\n# Obfuscation by Allatori Obfuscator v6.4 DEMO #\n# #\n# http://www.allatori.com #\n# #\n################################################\n"); SpringApplication.run(TestApplication.class, a);

}

}

TestController.java混淆前:

import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RestController;

@RestController

public class TestController {

@GetMapping("/test")

public String test(){

return "88888888888888888";

}

}

TestController.java混淆后:

import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RestController;

@RestController

public class TestController {

@GetMapping({"/test"})

public String test()

{

return ALLATORIxDEMO("*]*]*]*]*]*]*]*]*");

}

public static String ALLATORIxDEMO(String a)

{

int tmp27_24 = a.length();

int tmp31_30 = 1;

tmp31_30;

int j;

int ? = tmp31_30;

int k = tmp27_24;

int tmp41_37 = (j = new char[tmp27_24] - 1);

tmp41_37;

int i = (0x3 ^ 0x5) << 4 ^ 0x5;

(2 << 3 ^ 0x2);

if (tmp41_37 >= 0)

{

int tmp51_50 = j;

j--;

?[tmp51_50] = ((char)(a.charAt(tmp51_50) ^ i));

int tmp72_69 = (j--);

?[tmp72_69] = ((char)(a.charAt(tmp72_69) ^ k));

}

return new String(?);

}

}

哈哈哈,怎么样,是不是看不懂?并且混淆包照常运行,没有任何问题。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值