Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an easier way to upload Java mapping file for unobfuscated code #1

Open
richarddbarnett opened this issue Oct 15, 2013 · 4 comments

Comments

@richarddbarnett
Copy link

An unobfuscated Java app acting as a Squash client still needs to generate a mapping file for deobfuscate. This either requires some otherwise unnecessary fiddling with yGuard, or manally generating a suitable file (and it's hard to work out when this is correct). Surely there's an easier way?

The simplest case is where all that non-3rd-party code comes from a single directory (eg the Maven convention src/main/java) of a single repo. Could Java logback enhanced stack traces help for more complex cases (eg non-3rd-party code comes from multiple repos, or multiple modules of a single repo)?

@jakeyr
Copy link

jakeyr commented May 20, 2014

Anyone want to weigh in on this one? I'd love an easy way to generate a source file mapping for non-obfuscated code on my primary source directory.

@richarddbarnett did you ever solve this? do you have a script that does it?

thanks!

@richarddbarnett
Copy link
Author

Sorry, I made no progress on this. Mapping each stack frame to a path within a repo (or a special "third-party" marker) could be done in the Squash client or server; on the server this doesn't scale so well for heterogenous clients (since the server needs to be configured with repo info for each client) but is more efficient from the point of view of the client (& the change itself requires Ruby skills I don't have).

@jakeyr
Copy link

jakeyr commented May 28, 2014

I'm not a Ruby expert, but if I get a second I might dive in. I'm trying to integrate squash into a Play! application, which means that there is a very simple and direct mapping from source locations to class names starting at one top level source directory, but there is also bytecode insertion and a few other weird things happening. Not sure how squash will react to this.

When I attempted to generate a mapping file with yguard, I got an empty XML file. Not sure what I'm doing wrong there, and the docs on how to do this are extremely limited. I might play around with it some more this weekend.

But without stack traces, squash is pretty limited in its usefulness.

@richarddbarnett
Copy link
Author

Here's the Ant build.xml I used to generate the mapping file with yguard:

<?xml version='1.0' encoding='UTF-8'?>
<project name='project' default='yguard' basedir='.'>
  <target name='init'>
    <property name='jar' value='target/xyzzy.jar'/>
    <property name='obfjar' value='target/xyzzy.obf.jar'/>
    <property name='renamelog' value='renamelog.xml'/>
  </target>
  <target name='yguard' depends='init'>
    <taskdef name='yguard' classname='com.yworks.yguard.YGuardTask'
             classpath='/Users/richard/Downloads/yguard-2.4/lib/yguard.jar'/>
    <yguard>
      <inoutpair in='${jar}' out='${obfjar}'/>
      <externalclasses>
        <fileset dir='target/lib'>
          <include name='*.jar'/>
        </fileset>
      </externalclasses>
      <rename mainclass='com.xyzzy.XyzzyMain' logfile='${renamelog}'>
        <property name='error-checking' value='pedantic'/>
        <keep>
          <class classes='private' methods='private' fields='private'>
            <patternset>
              <include name='**'/>
            </patternset>
          </class>
        </keep>
      </rename>
    </yguard>
  </target>
  <target name='clean' depends='init'>
    <delete file='${obfjar}'/>
  </target>
</project>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants