Code Monkey home page Code Monkey logo

axmlprinter's Introduction

axmlprinter

Build Status Coverage Status

This is a heavily (almost 100%?) refactor of the Android4ME axmlprinter library/code. Personally I had used the library for years without much issue and it was fast/useful just for printing out Android Manifest files. In the past few years due to people mucking with AXML files and my own boredom, I've refactored most of the code to be tested and more useful in non-command line situations.

Usage

The default use case would be to compile the library;

./gradlew jar

Then run the library;

java -jar build/libs/axmlprinter-*.jar <target>

Contributing

Contributions welcome! Please follow the simple steps;

  1. Fork repository
  2. Make changes
  3. Ensure tests pass (or hopefully adding tests!)
  4. Submit pull request/issue

If this is too much work, feel free to make an issue and upload a patch set for me to evaluate.

Revision History

v0.1.0 (Initial Release)

  • "Just as good" as original code
  • 0% -> ~40% test coverage

License

Copyright (c) 2015 Red Naga - Tim 'diff' Strazzere
Copyright (c) 2008 Android4ME

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

axmlprinter's People

Contributors

calebfenton avatar jakev-mandiant avatar packmad avatar strazzere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

axmlprinter's Issues

Last character of tag names is being left off

I just downloaded / built the source code, and there seem to be some major issues.

Built on macOS High Sierra using Java JDK v8u151
Extracting Instagram (com.instagram.android)

This is the behavior I'm seeing:

  • Last letter of tag names / properties are being left off
    • Could this be an OS issue or Java versioning issue with string termination? Don't know what would have changed here though...
  • Some tags are not properly formatted, and are missing a < or a > (happens at the first <TextView />)
  • Spacing is a bit whacky, though is relatively minor as that can easily be reformatted if the syntax can be fixed

Any thoughts how to fix this? (or if there's a newer alternative, that's fine too)

Here's the full output. The results were similar for several apps / layout files:

<?xml version="1.0" encoding="utf-8"?>
<
 LinearLayou
	xmlns:androi="*http://schemas.android.com/apk/res/androi"
	androi:
               orientatio="0"
	androi:i="@7F0B00D4"
	androi:
backgroun="@7F020033"
	androi:
               paddingLef="@7F0A0022"
	androi:
               paddingRigh="@7F0A0022"
	androi:
               layout_widt="-1"
layout_heigh="@7F0A001F"
	>
	<:com.instagram.common.ui.widget.imageview.CircularImageVie
		androi:layout_gravit=""
		androi:i="@7F0B00D5"
		styl="@7F0E0029"
		>
	</:com.instagram.common.ui.widget.imageview.CircularImageVie>
	<
         LinearLayou
		androi:gravit=""
		androi:
                       orientatio="1"
		androi:
                       layout_widt="-1"
layout_heigh="-1"ndroi:
		androi:layout_marginLef="@7F0A0023"
		androi:layout_marginRigh="@7F0A0023"
		>
		TextVie
			androi:	textStyl=""
			androi:	ellipsiz="3"
			androi:i="@7F0B00D6"
			androi:
                               layout_widt="-2"
layout_heigh="-2"       androi:
			androi:
singleLin="true"
			>
		<TextVie>
		TextVie
			androi:	textColo="@7F08005A"
			androi:	ellipsiz="3"
			androi:i="@7F0B00D7"
			androi:
                               layout_widt="-2"
layout_heigh="-2"       androi:
			androi:
singleLin="true"
			>
		<TextVie>
	</
          LinearLayou>
</
  LinearLayou>

EOF Exception on a "proper" (usable) AXML File

[53%]tstrazzere@mil0:[~/repo/unpackme/contents] $ axmlprinter AndroidManifest.xml 
java.io.EOFException
	at android.content.res.IntReader.readInt(IntReader.java:104)
	at android.content.res.IntReader.readShort(IntReader.java:69)
	at android.content.res.chunk.sections.StringSection.readPool(StringSection.java:108)
	at android.content.res.chunk.sections.StringSection.readSection(StringSection.java:71)
	at android.content.res.chunk.sections.GenericChunkSection.<init>(GenericChunkSection.java:37)
	at android.content.res.chunk.sections.StringSection.<init>(StringSection.java:48)
	at android.content.res.chunk.ChunkUtil.createChunk(ChunkUtil.java:52)
	at android.content.res.AXMLResource.read(AXMLResource.java:92)
	at diff.rednaga.AXMLPrinter.main(AXMLPrinter.java:69)
<?xml version="1.0" encoding="utf-8"?>

Likely related to qihoo360 / jiagu protector

Sample : e15f2b96e52d78f317de97295e22f0c3ace38961

Protection level is not properly being parsed

	<permission
		android:label="@7F04000F"
		android:name="com.sprint.permission.INSTALL_UPDATES"
		android:protectionLevel=""
		android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
		android:description="@7F04000E"
		>
	</permission>
	<permission
		android:label="@7F040010"
		android:name="com.sprint.permission.INSTALL_LOCAL_UPDATES"
		android:protectionLevel=""
		android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
		android:description="@7F04000E"
		>
	</permission>
	<permission
		android:label="@7F040022"
		android:name="com.sprint.permission.UNINSTALL_UPDATES"
		android:protectionLevel=""
		android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
		android:description="@7F040021"
		>
	</permission>
	<permission
		android:label="@7F040024"
		android:name="com.sprint.permission.UNINSTALL_SELF"
		android:protectionLevel=""
		android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
		android:description="@7F040023"
		>
	</permission>

In this specific example, they should be parsed as "signature"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.