首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Yguard没有正确地修改我的类名(使用模糊的类名)

Yguard没有正确地修改我的类名(使用模糊的类名)
EN

Stack Overflow用户
提问于 2022-01-27 13:58:50
回答 1查看 201关注 0票数 0

我试图使用yguard 3.0.0 maven插件混淆JAR文件。模糊化的JAR和预期的差不多,它被缩小了,所有的私有方法和变量都被重命名了。我需要重新命名包名,这是执行的,但是启动我的Tomcat所需的spring XML文件没有被模糊化的包更新。

我的蚂蚁任务如下:

代码语言:javascript
复制
<configuration>
    <tasks>
        <property name="runtime-classpath" refid="maven.runtime.classpath"/>
        <taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="${runtime-classpath}"/>
            <yguard>
                <inoutpair in="C:/test/webapp.jar" out="C:/test/webapp_obfuscated.jar" />
                <shrink>
                    <property name="error-checking" value="pedantic"/>
                </shrink>
                <rename>
                    <adjust replaceContent="true" replaceName="true">
                         <include name="ApplicationContext.xml"/>
                    </adjust>
                </rename>                                                                   
            </yguard>
       </tasks>
</configuration>

请注意,在我的示例中,我只是尝试处理ApplicationContext.xml,但是这个文件仍然使用与没有混淆的版本相同的类名。我确信y卫士任务正在对我的ApplicationContext.xml做一些事情,因为我在文件中有一个标记,文件的路径被正确地混淆了,但是类名和其他东西没有:

代码语言:javascript
复制
    <!-- Properties ldap -->
    <bean id="ldapProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean" scope="singleton">
      <property name="ignoreResourceNotFound" value="true"/>
      <property name="locations">
            <list>              
              <value>classpath:A/A/B/E/ldap.properties</value>     <--Obfuscated!--> 
            </list>
      </property>
    </bean> 
    
    <bean id="authenticationBO" class="com.grifols.grb.authentication.bo.AuthenticationBO" scope="singleton">
        <property name="dbAccess" ref="dbAccessGRB"/>
        <property name="usersSecurityBO" ref="usersSecurityBO" />   
        <property name="settings" ref="settings" /> 
        <property name="ldapProperties" ref="ldapProperties" />
    </bean>

根据Yguard文档,我认为我只需要使用replaceContent="true“并详细说明哪个文件,但我不是

有什么想法吗?我真的很感激你能提供的任何帮助。

伊万

EN

回答 1

Stack Overflow用户

发布于 2022-03-24 13:43:47

yGuard可以在资源文件中替换文件/路径名称或类名,但不能同时替换两者。

也就是说。

代码语言:javascript
复制
<adjust replaceContent="true">

将调整

代码语言:javascript
复制
<example>
  <class>com.yworks.yguard.StringReplacer</class>
  <file>com/yworks/yguard/StringReplacer.properties</file>
</example>

代码语言:javascript
复制
<example>
  <class>com.yworks.yguard.StringReplacer</class>
  <file>A/A/A/SR.properties</file>
</example>

使用

代码语言:javascript
复制
<adjust replaceContent="true" replaceContentSeparator=".">

结果将是

代码语言:javascript
复制
<example>
  <class>A.A.A.SR</class>
  <file>com/yworks/yguard/StringReplacer.properties</file>
</example>

然而,期望的结果

代码语言:javascript
复制
<example>
  <class>A.A.A.SR</class>
  <file>A/A/A/SR.properties</file>
</example>

还没有得到支持。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70879811

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档