Skip to content

Instantly share code, notes, and snippets.

@dagrende
Created December 25, 2016 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagrende/2c7e8b65ad4b38fc2fff26d7d88d2469 to your computer and use it in GitHub Desktop.
Save dagrende/2c7e8b65ad4b38fc2fff26d7d88d2469 to your computer and use it in GitHub Desktop.
obfuscate anatomy file
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="fromchar" select="'abcdefghijklmnopqrstuvwABCDEFGHIJKLMNOPQRSTUVW0123456789'" />
<xsl:variable name="tochar" select="'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1111111111'" />
<xsl:output omit-xml-declaration="no"/>
<!-- copy unchanged by default -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Remove stuff -->
<xsl:template match="@supplier|@req|@user_1|@user_2|@user_3|@user_4|@user_5|@user_6|change-log|anatomy-document/@password|anatomy/@revisionHist|@projId|anatomyPlanner">
</xsl:template>
<!-- Change attribute all value letters to a and digits to 1 -->
<xsl:template match="@alias">
<xsl:attribute name="alias">
<xsl:value-of select="translate(., $fromchar, $tochar)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="@title">
<xsl:attribute name="title">
<xsl:value-of select="translate(., $fromchar, $tochar)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="@description">
<xsl:attribute name="description">
<xsl:value-of select="translate(., $fromchar, $tochar)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="@wpResp">
<xsl:attribute name="wpResp">
<xsl:value-of select="translate(., $fromchar, $tochar)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="note/@text">
<xsl:attribute name="text">
<xsl:value-of select="translate(., $fromchar, $tochar)"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
@dagrende
Copy link
Author

run with
java -jar apache-xalan.jar -XSL obf.xsl -IN file.ana -OUT file-obfuscated.ana

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment