<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      java 代碼加密混淆之Allatori

      全是干貨,僅供參考,不喜勿噴,有問題歡迎交流!若能幫助您之萬一,節(jié)省您工作中一點點時間,吾心甚慰。
      關鍵字:java、springboot、idea、maven、allatori。
      一、下載混淆組件
      1、 下載最新版,官網https://allatori.com/
      2、 本實例,使用包Allatori-9.5-Demo.zip解壓后目錄:
      lib下混淆使用的jar組件,tutorial下是一些例子。
      image
      二、集成到idea maven環(huán)境
      1、將lib文件夾拷貝到idea項目目錄(或者公共目錄)下,確保項目(模塊)找到。
      2、在項目(模塊)根目錄(src平級)添加allatori.xml文件,可在tutorial例子中找到一個allatori.xml添加到項目中。
      3、配置allatori.xml文件,此文件對哪些類混淆,怎么混淆做配置;本文章一個樣例allatori.xml文件(見代碼實例)。
      官網幫助文檔:https://allatori.com/doc.html
      關鍵配置說明:
      Input 節(jié)點配置要混淆的jar文件,in為輸入jar文件,out為加密混淆后輸出jar文件(支持pom.xml中變量寫法)。
      節(jié)點配置要保留的類、方法、屬性。
      配置說明:對于protected 及以上的訪問級別的類、方法、屬性保持名稱不變。
      !com.xxx.xxx.* 非項目包下的類不混淆。
      其中節(jié)點,表示忽略混淆的類,其下所有代碼均不混淆;對于啟動項目報錯的類,配置到此處即可。
      對于一個springboot項目此配置基本夠用,其他配置,保持默認即可。

      image

      4、maven配置pom.xml
      其他不變,在build>plugins節(jié)點內maven打包節(jié)點plugin后添加兩個plugin節(jié)點
      注意:若項目使用了${project.build.finalName}參數,在pom.xml中要配置。
      若不是springboot項目,maven打包build節(jié)點可不配置,但${project.artifactId}節(jié)點要配置。
      image
      上圖說明:將allatori.xml文件從根目錄拷貝到target目錄。
      image
      上圖說明:${basedir}/../../lib/allatori.jar指定混淆組件allatori.jar地址。
      ${basedir}/target/allatori.xml指定使用的混淆配置文件,已從根目錄下拷貝到target目錄。
      5、執(zhí)行打包混淆,mvn clean package。輸出文件為混淆后的jar包,在target目錄下。例子中混淆后的包為project-xxx-xxx-obfuscated.jar,原始包project-xxx-xxx.jar
      6、若有更多要求,如特殊打包環(huán)境啟用混淆,可使用profiles方式,如添加一種prod環(huán)境,在打包時使用參數 prod,執(zhí)行命令maven clean package -Pprod;不帶有prod默認打包模式,不混淆。
      若項目引用了其他加密混淆的項目,使用dependencies重新引用。
      image

      三、其他
      1、擴展,上述打包如果子項目過多,可將加密混淆后的jar包,統一輸出到一個指定目錄。
      2、不使用maven加密混淆,可參考下載包中的例子,直接執(zhí)行命令打包混淆。
      四、代碼實例
      以下為完整版代碼,若要求比較簡單請參考上面圖片中代碼。
      1、allatori.xml 代碼實例

       <config>
          <!-- Maven properties could be used in Allatori configuration file. -->
          <input>
              <jar in="${obf.in.name}" out="${obf.out.name}"/>
          </input>
          <keep-names>
              <class access="protected+">
                  <field access="protected+"/>
                  <method access="protected+"/>
              </class>
              <class template="class !com.xxx.xxx.*"/>
              <class template="class com.xxx.xxx.controller.*">
                  <method access="protected+" parameters="keep"/>
              </class>
          </keep-names>
          <ignore-classes>
              <class template="class com.xxx.xxx.datascope.*.**"/>
          </ignore-classes>
      
          <!-- 水印 -->
          <watermark key="secure-key-to-extract-watermark" value="@Copyright (c) by 2025-2099 Co.All Rights Reserved"/>
          <!-- 隨機字符加密 -->
          <property name="random-seed" value="任意字符串"/>
          <!-- 字符串加密 -->
          <property name="string-encryption" value="maximum"/>
          <!--    fast,strong-->
          <property name="string-encryption-type" value="fast"/>
          <property name="string-encryption-version" value="v4"/>
          <!-- 成員重新排序 -->
          <property name="member-reorder" value="random"/>
          <!--    <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"/>
          <expiry date="2099/01/01" string="EXPIRED!"/>
          <property name="log-file" value="log.xml"/>
      </config>
      
      

      2、pom.xml 代碼實例。

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <parent>
              <groupId>com.xxx</groupId>
              <artifactId>xxx-modules</artifactId>
              <version>0.0.0</version>
          </parent>
          <modelVersion>4.0.0</modelVersion>
          <artifactId>xxx-modules-topic</artifactId>
          <properties>
              <maven.compiler.source>8</maven.compiler.source>
              <maven.compiler.target>8</maven.compiler.target>
              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          </properties>
          <dependencies>
              <!-- 各種引用 -->
          </dependencies>
      
          <build>
              <finalName>${project.artifactId}</finalName>
          </build>
          <profiles>
              <profile>
                  <id>default</id>
                  <activation>
                      <activeByDefault>true</activeByDefault>
                  </activation>
                  <build>
                      <plugins>
                          <plugin>
                              <groupId>org.springframework.boot</groupId>
                              <artifactId>spring-boot-maven-plugin</artifactId>
                              <version>${spring-boot.version}</version>
                              <configuration>
                                  <includeSystemScope>true</includeSystemScope>
                              </configuration>
                              <executions>
                                  <execution>
                                      <goals>
                                          <goal>repackage</goal>
                                      </goals>
                                  </execution>
                              </executions>
                          </plugin>
                      </plugins>
                  </build>
              </profile>
              <!--若本項目引用了其他混淆的項目,使用此配置,加密打包 maven clean package -Pprod-->
              <profile>
      
                  <id>prod</id>
                  <activation>
                      <activeByDefault>false</activeByDefault>
                  </activation>
                  <properties>
                      <obf.dir>
                          obfuscated
                      </obf.dir>
                      <obf.in.name-pre>
                          ${project.artifactId}-temp
                      </obf.in.name-pre>
                      <obf.in.name>
                          ${obf.in.name-pre}.jar
                      </obf.in.name>
                      <obf.out.name>
                          ${obf.dir}/${project.artifactId}-${project.version}.jar
                      </obf.out.name>
                  </properties>
                  <!--重新加載混淆的依賴-->
                  <dependencies>
                      <dependency>
                          <groupId>com.xxx</groupId>
                          <artifactId>xxx-xxxxx-xxx</artifactId>
                          <version>${project.version}</version>
                          <scope>system</scope>
                          <systemPath>
                              ${basedir}/../xxx-common/xxx-common-module_1/target/${obf.dir}/xxx-common-module_1-${project.version}.jar
                          </systemPath>
                      </dependency>
      
                  </dependencies>
                  <build>
                      <finalName>${obf.in.name-pre}</finalName>
                      <plugins>
                          <plugin>
                              <groupId>org.springframework.boot</groupId>
                              <artifactId>spring-boot-maven-plugin</artifactId>
                              <version>${spring-boot.version}</version>
                              <configuration>
                                  <includeSystemScope>true</includeSystemScope>
                              </configuration>
                              <executions>
                                  <execution>
                                      <goals>
                                          <goal>repackage</goal>
                                      </goals>
                                  </execution>
                              </executions>
                          </plugin>
                          <!-- Copying Allatori configuration file to 'target' directory.
                                         The destination file will be filtered (Maven properties used in configuration file will be resolved). -->
                          <plugin>
                              <groupId>org.apache.maven.plugins</groupId>
                              <artifactId>maven-antrun-plugin</artifactId>
                              <version>1.3</version>
                              <executions>
                                  <execution>
                                      <id>run-create-obf-dir</id>
                                      <phase>package</phase>
                                      <configuration>
                                          <tasks>
                                              <delete dir="${basedir}/target/${obf.dir}"/>
                                              <mkdir dir="${basedir}/target/${obf.dir}"/>
                                          </tasks>
                                      </configuration>
                                      <goals>
                                          <goal>run</goal>
                                      </goals>
                                  </execution>
                              </executions>
                          </plugin>
                          <plugin>
                              <groupId>org.apache.maven.plugins</groupId>
                              <artifactId>maven-resources-plugin</artifactId>
                              <version>2.6</version>
                              <executions>
                                  <execution>
                                      <id>copy-and-filter-allatori-config</id>
                                      <phase>package</phase>
                                      <goals>
                                          <goal>copy-resources</goal>
                                      </goals>
                                      <configuration>
                                          <outputDirectory>${basedir}/target</outputDirectory>
                                          <resources>
                                              <resource>
                                                  <directory>${basedir}
                                                  </directory>
                                                  <includes>
                                                      <include>allatori.xml</include>
                                                  </includes>
                                                  <filtering>true</filtering>
                                              </resource>
                                          </resources>
                                      </configuration>
                                  </execution>
                              </executions>
                          </plugin>
                          <!-- Running Allatori -->
                          <plugin>
                              <groupId>org.codehaus.mojo</groupId>
                              <artifactId>exec-maven-plugin</artifactId>
                              <version>1.2.1</version>
                              <executions>
                                  <execution>
                                      <id>run-allatori</id>
                                      <phase>package</phase>
                                      <goals>
                                          <goal>exec</goal>
                                      </goals>
                                  </execution>
                              </executions>
                              <configuration>
                                  <executable>java</executable>
                                  <arguments>
                                      <argument>-Xms128m</argument>
                                      <argument>-Xmx512m</argument>
                                      <argument>-jar</argument>
                                      <argument>${basedir}/../../lib/allatori.jar</argument>
                                      <argument>${basedir}/target/allatori.xml</argument>
                                  </arguments>
                              </configuration>
                          </plugin>
                      </plugins>
                  </build>
              </profile>
          </profiles>
      
      </project>
      
      posted @ 2025-10-24 09:45  newbigapple  閱讀(51)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 亚洲日本va午夜中文字幕久久| 亚洲精品无码日韩国产不卡av| 精品无码一区在线观看| 台中市| 成人亚洲狠狠一二三四区| 欧美极品色午夜在线视频| 渝中区| 国产成人精品无缓存在线播放| 女人张开腿让男人桶爽| 最新亚洲人成网站在线观看| 搡老女人老妇女老熟妇| 欧美黑人巨大videos精品| 蜜臀视频在线观看一区二区| 国产精品色内内在线播放| 亚洲国产成人无码电影| 亚洲国产成人久久综合人| 韩国精品一区二区三区| 人妻伦理在线一二三区| 亚洲成亚洲成网| 成年站免费网站看v片在线| 久久精品国产清自在天天线| 夜夜爽日日澡人人添| 老湿机69福利区无码| 日本人一区二区在线观看| 亚洲AV无码破坏版在线观看| 91精品蜜臀国产综合久久| 国产av国片精品一区二区| 亚洲一区二区三区啪啪| 国产精品办公室沙发| 国产亚洲色视频在线| 野花社区视频www官网| www国产精品内射熟女| 亚洲日韩精品无码一区二区三区| 亚洲人成网站免费播放| 国产精品线在线精品| 污污网站18禁在线永久免费观看| 国产高清在线男人的天堂 | 中文字幕日韩国产精品| 亚洲人午夜射精精品日韩| 凹凸国产熟女精品视频| 在线永久看片免费的视频|