Skip to content

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

Open

Description

@richarddbarnett

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)?

Activity

  1. jakeyr commented on May 20, 2014

    @jakeyr

    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!

  2. richarddbarnett commented on May 28, 2014

    @richarddbarnett
    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).

  3. jakeyr commented on May 28, 2014

    @jakeyr

    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.

  4. richarddbarnett commented on Jul 2, 2014

    @richarddbarnett
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions