├── .gitignore ├── CHANGES ├── README.md ├── brut.apktool.smali ├── .gitignore ├── NOTICE-SMALI ├── baksmali │ ├── .gitignore │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── jf │ │ │ │ └── baksmali │ │ │ │ ├── Adaptors │ │ │ │ ├── AnnotationFormatter.java │ │ │ │ ├── BlankMethodItem.java │ │ │ │ ├── CatchMethodItem.java │ │ │ │ ├── ClassDefinition.java │ │ │ │ ├── CommentMethodItem.java │ │ │ │ ├── CommentedOutMethodItem.java │ │ │ │ ├── DebugMethodItem.java │ │ │ │ ├── EncodedValue │ │ │ │ │ ├── AnnotationEncodedValueAdaptor.java │ │ │ │ │ ├── ArrayEncodedValueAdaptor.java │ │ │ │ │ ├── EncodedValueAdaptor.java │ │ │ │ │ └── EnumEncodedValueAdaptor.java │ │ │ │ ├── EndTryLabelMethodItem.java │ │ │ │ ├── FieldDefinition.java │ │ │ │ ├── Format │ │ │ │ │ ├── ArrayDataMethodItem.java │ │ │ │ │ ├── InstructionMethodItem.java │ │ │ │ │ ├── InstructionMethodItemFactory.java │ │ │ │ │ ├── OffsetInstructionFormatMethodItem.java │ │ │ │ │ ├── PackedSwitchMethodItem.java │ │ │ │ │ ├── SparseSwitchMethodItem.java │ │ │ │ │ └── UnresolvedOdexInstructionMethodItem.java │ │ │ │ ├── LabelMethodItem.java │ │ │ │ ├── MethodDefinition.java │ │ │ │ ├── MethodItem.java │ │ │ │ ├── PostInstructionRegisterInfoMethodItem.java │ │ │ │ ├── PreInstructionRegisterInfoMethodItem.java │ │ │ │ ├── ReferenceFormatter.java │ │ │ │ ├── RegisterFormatter.java │ │ │ │ └── SyntheticAccessCommentMethodItem.java │ │ │ │ ├── Renderers │ │ │ │ ├── BooleanRenderer.java │ │ │ │ ├── ByteRenderer.java │ │ │ │ ├── CharRenderer.java │ │ │ │ ├── DoubleRenderer.java │ │ │ │ ├── FloatRenderer.java │ │ │ │ ├── IntegerRenderer.java │ │ │ │ ├── LongRenderer.java │ │ │ │ └── ShortRenderer.java │ │ │ │ ├── baksmali.java │ │ │ │ ├── dump.java │ │ │ │ └── main.java │ │ └── resources │ │ │ ├── properties │ │ │ └── baksmali.properties │ │ │ └── templates │ │ │ └── templates │ │ │ └── baksmali.stg │ │ └── test │ │ └── smali │ │ ├── baksmali_test_class.smali │ │ ├── deodex_test1 │ │ ├── main.smali │ │ ├── randomclass.smali │ │ ├── subclass.smali │ │ └── superclass.smali │ │ └── deodex_test2 │ │ ├── app_classes │ │ └── main.smali │ │ └── bootclass_classes │ │ ├── randomclass.smali │ │ ├── subclass1.smali │ │ ├── subclass2.smali │ │ ├── superclass.smali │ │ └── supersuperclass.smali ├── dexlib │ ├── .gitignore │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── jf │ │ └── dexlib │ │ ├── AnnotationDirectoryItem.java │ │ ├── AnnotationItem.java │ │ ├── AnnotationSetItem.java │ │ ├── AnnotationSetRefList.java │ │ ├── AnnotationVisibility.java │ │ ├── ClassDataItem.java │ │ ├── ClassDefItem.java │ │ ├── Code │ │ ├── Analysis │ │ │ ├── AnalyzedInstruction.java │ │ │ ├── ClassPath.java │ │ │ ├── CustomInlineMethodResolver.java │ │ │ ├── DeodexUtil.java │ │ │ ├── DexFileClassMap.java │ │ │ ├── InlineMethodResolver.java │ │ │ ├── MethodAnalyzer.java │ │ │ ├── OdexedFieldInstructionMapper.java │ │ │ ├── RegisterType.java │ │ │ ├── SyntheticAccessorResolver.java │ │ │ └── ValidationException.java │ │ ├── EncodedLiteralInstruction.java │ │ ├── FiveRegisterInstruction.java │ │ ├── Format │ │ │ ├── ArrayDataPseudoInstruction.java │ │ │ ├── Format.java │ │ │ ├── Instruction10t.java │ │ │ ├── Instruction10x.java │ │ │ ├── Instruction11n.java │ │ │ ├── Instruction11x.java │ │ │ ├── Instruction12x.java │ │ │ ├── Instruction20bc.java │ │ │ ├── Instruction20t.java │ │ │ ├── Instruction21c.java │ │ │ ├── Instruction21h.java │ │ │ ├── Instruction21s.java │ │ │ ├── Instruction21t.java │ │ │ ├── Instruction22b.java │ │ │ ├── Instruction22c.java │ │ │ ├── Instruction22cs.java │ │ │ ├── Instruction22s.java │ │ │ ├── Instruction22t.java │ │ │ ├── Instruction22x.java │ │ │ ├── Instruction23x.java │ │ │ ├── Instruction30t.java │ │ │ ├── Instruction31c.java │ │ │ ├── Instruction31i.java │ │ │ ├── Instruction31t.java │ │ │ ├── Instruction32x.java │ │ │ ├── Instruction35c.java │ │ │ ├── Instruction35mi.java │ │ │ ├── Instruction35ms.java │ │ │ ├── Instruction3rc.java │ │ │ ├── Instruction3rmi.java │ │ │ ├── Instruction3rms.java │ │ │ ├── Instruction41c.java │ │ │ ├── Instruction51l.java │ │ │ ├── Instruction52c.java │ │ │ ├── Instruction5rc.java │ │ │ ├── InstructionWithJumboReference.java │ │ │ ├── InstructionWithJumboVariant.java │ │ │ ├── PackedSwitchDataPseudoInstruction.java │ │ │ ├── SparseSwitchDataPseudoInstruction.java │ │ │ ├── UnknownInstruction.java │ │ │ └── UnresolvedOdexInstruction.java │ │ ├── Instruction.java │ │ ├── InstructionIterator.java │ │ ├── InstructionWithReference.java │ │ ├── InvokeInstruction.java │ │ ├── LiteralInstruction.java │ │ ├── MultiOffsetInstruction.java │ │ ├── OdexedFieldAccess.java │ │ ├── OdexedInvokeInline.java │ │ ├── OdexedInvokeVirtual.java │ │ ├── OffsetInstruction.java │ │ ├── Opcode.java │ │ ├── ReferenceType.java │ │ ├── RegisterRangeInstruction.java │ │ ├── SingleRegisterInstruction.java │ │ ├── ThreeRegisterInstruction.java │ │ ├── TwoRegisterInstruction.java │ │ └── VerificationErrorType.java │ │ ├── CodeItem.java │ │ ├── Convertible.java │ │ ├── Debug │ │ ├── DebugInstructionIterator.java │ │ └── DebugOpcode.java │ │ ├── DebugInfoItem.java │ │ ├── DexFile.java │ │ ├── EncodedArrayItem.java │ │ ├── EncodedValue │ │ ├── AnnotationEncodedSubValue.java │ │ ├── AnnotationEncodedValue.java │ │ ├── ArrayEncodedSubValue.java │ │ ├── ArrayEncodedValue.java │ │ ├── BooleanEncodedValue.java │ │ ├── ByteEncodedValue.java │ │ ├── CharEncodedValue.java │ │ ├── DoubleEncodedValue.java │ │ ├── EncodedValue.java │ │ ├── EnumEncodedValue.java │ │ ├── FieldEncodedValue.java │ │ ├── FloatEncodedValue.java │ │ ├── IntEncodedValue.java │ │ ├── LongEncodedValue.java │ │ ├── MethodEncodedValue.java │ │ ├── NullEncodedValue.java │ │ ├── ShortEncodedValue.java │ │ ├── StringEncodedValue.java │ │ ├── TypeEncodedValue.java │ │ └── ValueType.java │ │ ├── FieldIdItem.java │ │ ├── HeaderItem.java │ │ ├── IndexedSection.java │ │ ├── Item.java │ │ ├── ItemFactory.java │ │ ├── ItemType.java │ │ ├── MapItem.java │ │ ├── MethodIdItem.java │ │ ├── OdexDependencies.java │ │ ├── OdexHeader.java │ │ ├── OffsettedSection.java │ │ ├── ProtoIdItem.java │ │ ├── ReadContext.java │ │ ├── Section.java │ │ ├── StringDataItem.java │ │ ├── StringIdItem.java │ │ ├── TypeIdItem.java │ │ ├── TypeListItem.java │ │ └── Util │ │ ├── AccessFlags.java │ │ ├── AlignmentUtils.java │ │ ├── AnnotatedOutput.java │ │ ├── ArrayUtils.java │ │ ├── ByteArray.java │ │ ├── ByteArrayAnnotatedOutput.java │ │ ├── ByteArrayInput.java │ │ ├── ByteArrayOutput.java │ │ ├── DebugInfoBuilder.java │ │ ├── EncodedValueUtils.java │ │ ├── ExceptionWithContext.java │ │ ├── FileUtils.java │ │ ├── Hex.java │ │ ├── IndentingWriter.java │ │ ├── Input.java │ │ ├── Leb128Utils.java │ │ ├── NumberUtils.java │ │ ├── Output.java │ │ ├── Pair.java │ │ ├── ReadOnlyArrayList.java │ │ ├── SparseArray.java │ │ ├── SparseIntArray.java │ │ ├── TryListBuilder.java │ │ ├── TwoColumnOutput.java │ │ ├── TypeUtils.java │ │ └── Utf8Utils.java ├── smali │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── antlr3 │ │ │ ├── smaliParser.g │ │ │ └── smaliTreeWalker.g │ │ ├── java │ │ │ └── org │ │ │ │ └── jf │ │ │ │ └── smali │ │ │ │ ├── InvalidToken.java │ │ │ │ ├── LexerErrorInterface.java │ │ │ │ ├── LiteralTools.java │ │ │ │ ├── OdexedInstructionException.java │ │ │ │ ├── SemanticException.java │ │ │ │ └── main.java │ │ ├── jflex │ │ │ └── smaliLexer.flex │ │ └── resources │ │ │ └── properties │ │ │ └── smali.properties │ │ └── test │ │ ├── antlr3 │ │ └── org │ │ │ └── jf │ │ │ └── smali │ │ │ └── expectedTokensTestGrammar.g │ │ ├── java │ │ ├── ByteLiteralTest.java │ │ ├── IntLiteralTest.java │ │ ├── LexerTest.java │ │ ├── LongLiteralTest.java │ │ └── ShortLiteralTest.java │ │ └── resources │ │ └── LexerTest │ │ ├── .gitattributes │ │ ├── ByteLiteralTest.smali │ │ ├── ByteLiteralTest.tokens │ │ ├── CharLiteralTest.smali │ │ ├── CharLiteralTest.tokens │ │ ├── CommentTest.smali │ │ ├── CommentTest.tokens │ │ ├── DirectiveTest.smali │ │ ├── DirectiveTest.tokens │ │ ├── FloatLiteralTest.smali │ │ ├── FloatLiteralTest.tokens │ │ ├── InstructionTest.smali │ │ ├── InstructionTest.tokens │ │ ├── IntegerLiteralTest.smali │ │ ├── IntegerLiteralTest.tokens │ │ ├── LongLiteralTest.smali │ │ ├── LongLiteralTest.tokens │ │ ├── MiscTest.smali │ │ ├── MiscTest.tokens │ │ ├── RealSmaliFileTest.smali │ │ ├── RealSmaliFileTest.tokens │ │ ├── ShortLiteralTest.smali │ │ ├── ShortLiteralTest.tokens │ │ ├── StringLiteralTest.smali │ │ ├── StringLiteralTest.tokens │ │ ├── SymbolTest.smali │ │ ├── SymbolTest.tokens │ │ ├── TypeAndIdentifierTest.smali │ │ └── TypeAndIdentifierTest.tokens └── util │ ├── .gitignore │ ├── build.gradle │ └── src │ ├── main │ └── java │ │ ├── ds │ │ └── tree │ │ │ ├── DuplicateKeyException.java │ │ │ ├── RadixTree.java │ │ │ ├── RadixTreeImpl.java │ │ │ ├── RadixTreeNode.java │ │ │ ├── Visitor.java │ │ │ └── VisitorImpl.java │ │ └── org │ │ └── jf │ │ └── util │ │ ├── ClassFileNameHandler.java │ │ ├── CommentingIndentingWriter.java │ │ ├── ConsoleUtil.java │ │ ├── IndentingWriter.java │ │ ├── PathUtil.java │ │ └── SmaliHelpFormatter.java │ └── test │ └── java │ └── org │ └── jf │ └── util │ └── PathUtilTest.java ├── brut.apktool ├── LICENSE ├── NOTICE ├── NOTICE-smali ├── apktool-cli │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── brut │ │ └── apktool │ │ └── Main.java ├── apktool-lib │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ ├── android │ │ │ │ ├── content │ │ │ │ │ └── res │ │ │ │ │ │ └── XmlResourceParser.java │ │ │ │ └── util │ │ │ │ │ ├── AttributeSet.java │ │ │ │ │ └── TypedValue.java │ │ │ ├── brut │ │ │ │ └── androlib │ │ │ │ │ ├── Androlib.java │ │ │ │ │ ├── AndrolibException.java │ │ │ │ │ ├── ApkDecoder.java │ │ │ │ │ ├── ApktoolProperties.java │ │ │ │ │ ├── err │ │ │ │ │ ├── CantFind9PatchChunk.java │ │ │ │ │ ├── CantFindFrameworkResException.java │ │ │ │ │ ├── InFileNotFoundException.java │ │ │ │ │ ├── OutDirExistsException.java │ │ │ │ │ └── UndefinedResObject.java │ │ │ │ │ ├── java │ │ │ │ │ └── AndrolibJava.java │ │ │ │ │ ├── mod │ │ │ │ │ ├── IndentingWriter.java │ │ │ │ │ └── SmaliMod.java │ │ │ │ │ ├── res │ │ │ │ │ ├── AndrolibResources.java │ │ │ │ │ ├── ResSmaliUpdater.java │ │ │ │ │ ├── data │ │ │ │ │ │ ├── ResConfig.java │ │ │ │ │ │ ├── ResConfigFlags.java │ │ │ │ │ │ ├── ResID.java │ │ │ │ │ │ ├── ResPackage.java │ │ │ │ │ │ ├── ResResSpec.java │ │ │ │ │ │ ├── ResResource.java │ │ │ │ │ │ ├── ResTable.java │ │ │ │ │ │ ├── ResType.java │ │ │ │ │ │ ├── ResValuesFile.java │ │ │ │ │ │ └── value │ │ │ │ │ │ │ ├── ResArrayValue.java │ │ │ │ │ │ │ ├── ResAttr.java │ │ │ │ │ │ │ ├── ResBagValue.java │ │ │ │ │ │ │ ├── ResBoolValue.java │ │ │ │ │ │ │ ├── ResColorValue.java │ │ │ │ │ │ │ ├── ResDimenValue.java │ │ │ │ │ │ │ ├── ResEnumAttr.java │ │ │ │ │ │ │ ├── ResFileValue.java │ │ │ │ │ │ │ ├── ResFlagsAttr.java │ │ │ │ │ │ │ ├── ResFloatValue.java │ │ │ │ │ │ │ ├── ResFractionValue.java │ │ │ │ │ │ │ ├── ResIdValue.java │ │ │ │ │ │ │ ├── ResIntValue.java │ │ │ │ │ │ │ ├── ResPluralsValue.java │ │ │ │ │ │ │ ├── ResReferenceValue.java │ │ │ │ │ │ │ ├── ResScalarValue.java │ │ │ │ │ │ │ ├── ResStringValue.java │ │ │ │ │ │ │ ├── ResStyleValue.java │ │ │ │ │ │ │ ├── ResValue.java │ │ │ │ │ │ │ └── ResValueFactory.java │ │ │ │ │ ├── decoder │ │ │ │ │ │ ├── ARSCDecoder.java │ │ │ │ │ │ ├── AXmlResourceParser.java │ │ │ │ │ │ ├── Res9patchStreamDecoder.java │ │ │ │ │ │ ├── ResAttrDecoder.java │ │ │ │ │ │ ├── ResFileDecoder.java │ │ │ │ │ │ ├── ResRawStreamDecoder.java │ │ │ │ │ │ ├── ResStreamDecoder.java │ │ │ │ │ │ ├── ResStreamDecoderContainer.java │ │ │ │ │ │ ├── StringBlock.java │ │ │ │ │ │ └── XmlPullStreamDecoder.java │ │ │ │ │ ├── util │ │ │ │ │ │ ├── ExtFile.java │ │ │ │ │ │ ├── ExtMXSerializer.java │ │ │ │ │ │ └── ExtXmlSerializer.java │ │ │ │ │ └── xml │ │ │ │ │ │ ├── ResValuesXmlSerializable.java │ │ │ │ │ │ ├── ResXmlEncodable.java │ │ │ │ │ │ └── ResXmlEncoders.java │ │ │ │ │ └── src │ │ │ │ │ ├── DebugInjector.java │ │ │ │ │ ├── DexFileBuilder.java │ │ │ │ │ ├── SmaliBuilder.java │ │ │ │ │ ├── SmaliDecoder.java │ │ │ │ │ └── TypeName.java │ │ │ ├── com │ │ │ │ └── mindprod │ │ │ │ │ └── ledatastream │ │ │ │ │ └── LEDataInputStream.java │ │ │ └── org │ │ │ │ └── xmlpull │ │ │ │ └── mxp1_serializer │ │ │ │ └── MXSerializer.java │ │ └── resources │ │ │ ├── brut │ │ │ └── androlib │ │ │ │ └── android-framework.jar │ │ │ └── properties │ │ │ └── apktool.properties │ │ └── test │ │ ├── java │ │ └── brut │ │ │ └── androlib │ │ │ ├── BuildAndDecodeTest.java │ │ │ └── TestUtils.java │ │ └── resources │ │ └── brut │ │ └── apktool │ │ └── testapp │ │ ├── AndroidManifest.xml │ │ ├── apktool.yml │ │ └── res │ │ ├── values-mcc001 │ │ ├── arrays.xml │ │ ├── bools.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ids.xml │ │ ├── integers.xml │ │ └── strings.xml │ │ ├── values-mcc002 │ │ ├── arrays.xml │ │ └── strings.xml │ │ ├── values-mcc003 │ │ ├── bools.xml │ │ ├── integers.xml │ │ └── strings.xml │ │ ├── values-mcc004-mnc4-en-rUS-ldrtl-sw100dp-w200dp-h300dp-xlarge-long-land-desk-night-xhdpi-finger-keyssoft-12key-navhidden-dpad │ │ └── strings.xml │ │ ├── values │ │ └── strings.xml │ │ └── xml │ │ ├── literals.xml │ │ └── references.xml └── src │ └── templates │ └── apache2.0-header.txt ├── brut.j.common ├── .gitignore ├── LICENSE ├── NOTICE ├── build.gradle └── src │ ├── main │ └── java │ │ └── brut │ │ └── common │ │ └── BrutException.java │ └── templates │ └── apache2.0-header.txt ├── brut.j.dir ├── .gitignore ├── LICENSE ├── NOTICE ├── build.gradle └── src │ ├── main │ └── java │ │ └── brut │ │ └── directory │ │ ├── AbstractDirectory.java │ │ ├── ChangesWrapperDirectory.java │ │ ├── DirUtil.java │ │ ├── Directory.java │ │ ├── DirectoryException.java │ │ ├── FileDirectory.java │ │ ├── PathAlreadyExists.java │ │ ├── PathNotExist.java │ │ └── ZipRODirectory.java │ └── templates │ └── apache2.0-header.txt ├── brut.j.util ├── .gitignore ├── LICENSE ├── NOTICE ├── build.gradle └── src │ ├── main │ └── java │ │ └── brut │ │ └── util │ │ ├── BrutIO.java │ │ ├── DataInputDelegate.java │ │ ├── Duo.java │ │ ├── ExtDataInput.java │ │ ├── Jar.java │ │ └── OS.java │ └── templates │ └── apache2.0-header.txt ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── scripts ├── linux │ └── apktool ├── osx │ └── apktool └── windows │ └── apktool.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | brut.apktool.smali/baksmali/build/ 3 | brut.apktool.smali/build/ 4 | brut.apktool.smali/dexlib/build/ 5 | brut.apktool.smali/smali/build/ 6 | brut.apktool.smali/util/build/ 7 | brut.apktool/apktool-cli/build/ 8 | brut.apktool/apktool-lib/build/ 9 | brut.apktool/build/ 10 | build/ 11 | /brut.apktool/nbproject/private/ 12 | /brut.apktool.smali/baksmali/nbproject/private/ 13 | /brut.apktool.smali/dexlib/nbproject/private/ 14 | /brut.apktool.smali/nbproject/private/ 15 | /nbproject/private/ 16 | /brut.apktool.smali/smali/nbproject/private/ 17 | /brut.apktool.smali/util/nbproject/private/ 18 | /brut.apktool/apktool-lib/nbproject/private/ 19 | /brut.apktool/apktool-cli/nbproject/private/ 20 | *.kate-swp 21 | *~ 22 | *.project 23 | *.classpath 24 | *.settings 25 | *.setting 26 | bin/ 27 | *.iml 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Apktool # 2 | http://code.google.com/p/android-apktool/ 3 | 4 | Links 5 | - Wiki http://code.google.com/p/android-apktool/w/list 6 | - Bug Reports http://code.google.com/p/android-apktool/issues/list 7 | - Changelog/Information http://code.google.com/p/android-apktool/wiki/Changelog 8 | - XDA Post http://forum.xda-developers.com/showthread.php?p=28366939 9 | - Source (Github) https://github.com/iBotPeaches/Apktool 10 | - Source (GoogleCode) http://code.google.com/p/android-apktool/source/list 11 | 12 | -------------------------------------------------------------------------------- /brut.apktool.smali/.gitignore: -------------------------------------------------------------------------------- 1 | /baksmali/target/ 2 | /dexlib/target/ 3 | /maven-smali-plugin/target/ 4 | /smali/target/ 5 | /util/target/ 6 | *~ 7 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Google Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Google Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | dependencies { 33 | compile project(':brut.apktool.smali:util') 34 | compile project(':brut.apktool.smali:dexlib') 35 | compile 'commons-cli:commons-cli:1.2' 36 | compile 'com.google.code.findbugs:jsr305:1.3.9' 37 | } 38 | 39 | processResources.inputs.property('version', version) 40 | processResources.expand('version': version) 41 | 42 | // build a jar containing all dependencies 43 | jar { 44 | from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } 45 | 46 | manifest { 47 | attributes("Main-Class": "org.jf.baksmali.main") 48 | } 49 | } -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Adaptors/BlankMethodItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Adaptors; 30 | 31 | import org.jf.util.IndentingWriter; 32 | 33 | //a "spacer" between instructions 34 | public class BlankMethodItem extends MethodItem { 35 | public BlankMethodItem(int codeAddress) { 36 | super(codeAddress); 37 | } 38 | 39 | public double getSortOrder() { 40 | return Integer.MAX_VALUE; 41 | } 42 | 43 | public boolean writeTo(IndentingWriter writer) { 44 | //we didn't technically print something, but returning true indicates that a newline should be printed 45 | //after this method item, which is the intended functionality 46 | return true; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Adaptors/CommentMethodItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Adaptors; 30 | 31 | import org.jf.util.IndentingWriter; 32 | 33 | import java.io.IOException; 34 | 35 | public class CommentMethodItem extends MethodItem { 36 | //private final StringTemplate template; 37 | private final String comment; 38 | private final double sortOrder; 39 | 40 | public CommentMethodItem(String comment, int codeAddress, double sortOrder) { 41 | super(codeAddress); 42 | this.comment = comment; 43 | this.sortOrder = sortOrder; 44 | } 45 | 46 | public double getSortOrder() { 47 | return sortOrder; 48 | } 49 | 50 | public boolean writeTo(IndentingWriter writer) throws IOException { 51 | writer.write('#'); 52 | writer.write(comment); 53 | return true; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Adaptors/CommentedOutMethodItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Adaptors; 30 | 31 | import org.jf.util.IndentingWriter; 32 | 33 | import java.io.IOException; 34 | 35 | public class CommentedOutMethodItem extends MethodItem { 36 | private final MethodItem commentedOutMethodItem; 37 | 38 | public CommentedOutMethodItem(MethodItem commentedOutMethodItem) { 39 | super(commentedOutMethodItem.getCodeAddress()); 40 | this.commentedOutMethodItem = commentedOutMethodItem; 41 | } 42 | 43 | public double getSortOrder() { 44 | return commentedOutMethodItem.getSortOrder() + .001; 45 | } 46 | 47 | public boolean writeTo(IndentingWriter writer) throws IOException { 48 | writer.write('#'); 49 | commentedOutMethodItem.writeTo(writer); 50 | return true; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Adaptors/EncodedValue/EnumEncodedValueAdaptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Adaptors.EncodedValue; 30 | 31 | import org.jf.baksmali.Adaptors.ReferenceFormatter; 32 | import org.jf.util.IndentingWriter; 33 | import org.jf.dexlib.FieldIdItem; 34 | 35 | import java.io.IOException; 36 | 37 | public class EnumEncodedValueAdaptor { 38 | public static void writeTo(IndentingWriter writer, FieldIdItem item) throws IOException { 39 | writer.write(".enum "); 40 | ReferenceFormatter.writeFieldReference(writer, item); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Adaptors/EndTryLabelMethodItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Adaptors; 30 | 31 | public class EndTryLabelMethodItem extends LabelMethodItem { 32 | private int endTryAddress; 33 | 34 | public EndTryLabelMethodItem(int codeAddress, int endTryAddress) { 35 | super(codeAddress, "try_end_"); 36 | this.endTryAddress = endTryAddress; 37 | } 38 | 39 | public double getSortOrder() { 40 | //sort after instruction, but before catch directive 41 | return 101; 42 | } 43 | 44 | public int getLabelAddress() { 45 | return endTryAddress; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Renderers/BooleanRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Renderers; 30 | 31 | import org.jf.util.IndentingWriter; 32 | 33 | import java.io.IOException; 34 | 35 | public class BooleanRenderer { 36 | public static void writeTo(IndentingWriter writer, boolean val) throws IOException { 37 | if (val) { 38 | writer.write("true"); 39 | } else { 40 | writer.write("false"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Renderers/ByteRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Renderers; 30 | 31 | import org.jf.util.IndentingWriter; 32 | 33 | import java.io.IOException; 34 | 35 | public class ByteRenderer { 36 | public static void writeTo(IndentingWriter writer, byte val) throws IOException { 37 | if (val<0) { 38 | writer.write("-0x"); 39 | writer.printUnsignedLongAsHex(-val); 40 | writer.write('t'); 41 | } else { 42 | writer.write("0x"); 43 | writer.printUnsignedLongAsHex(val); 44 | writer.write('t'); 45 | } 46 | } 47 | 48 | public static void writeUnsignedTo(IndentingWriter writer, byte val) throws IOException { 49 | writer.write("0x"); 50 | writer.printUnsignedLongAsHex(val & 0xFF); 51 | writer.write('t'); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Renderers/CharRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Renderers; 30 | 31 | import org.jf.util.IndentingWriter; 32 | import org.jf.dexlib.Util.Utf8Utils; 33 | 34 | import java.io.IOException; 35 | 36 | public class CharRenderer { 37 | public static void writeTo(IndentingWriter writer, char val) throws IOException { 38 | writer.write('\''); 39 | Utf8Utils.writeEscapedChar(writer, val); 40 | writer.write('\''); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Renderers/DoubleRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Renderers; 30 | 31 | import org.jf.util.IndentingWriter; 32 | 33 | import java.io.IOException; 34 | 35 | public class DoubleRenderer { 36 | public static void writeTo(IndentingWriter writer, double val) throws IOException { 37 | writer.write(Double.toString(val)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Renderers/FloatRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Renderers; 30 | 31 | import org.jf.util.IndentingWriter; 32 | 33 | import java.io.IOException; 34 | 35 | public class FloatRenderer { 36 | public static void writeTo(IndentingWriter writer, float val) throws IOException { 37 | writer.write(Float.toString(val)); 38 | writer.write('f'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Renderers/IntegerRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Renderers; 30 | 31 | import org.jf.util.IndentingWriter; 32 | 33 | import java.io.IOException; 34 | 35 | public class IntegerRenderer { 36 | public static void writeTo(IndentingWriter writer, int val) throws IOException { 37 | if (val<0) { 38 | writer.write("-0x"); 39 | writer.printUnsignedLongAsHex(-((long) val)); 40 | } else { 41 | writer.write("0x"); 42 | writer.printUnsignedLongAsHex(val); 43 | } 44 | } 45 | 46 | public static void writeUnsignedTo(IndentingWriter writer, int val) throws IOException { 47 | writer.write("0x"); 48 | writer.printUnsignedLongAsHex(val & 0xFFFFFFFFL); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/java/org/jf/baksmali/Renderers/ShortRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.baksmali.Renderers; 30 | 31 | import org.jf.util.IndentingWriter; 32 | 33 | import java.io.IOException; 34 | 35 | public class ShortRenderer { 36 | public static void writeTo(IndentingWriter writer, short val) throws IOException { 37 | if (val < 0) { 38 | writer.write("-0x"); 39 | writer.printUnsignedLongAsHex(-val); 40 | writer.write('s'); 41 | } else { 42 | writer.write("0x"); 43 | writer.printUnsignedLongAsHex(val); 44 | writer.write('s'); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/main/resources/properties/baksmali.properties: -------------------------------------------------------------------------------- 1 | application.version=1.4.1 -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/test/smali/deodex_test1/randomclass.smali: -------------------------------------------------------------------------------- 1 | .class public Lrandomclass; 2 | 3 | .super Ljava/lang/Object; 4 | 5 | .method public constructor ()V 6 | .registers 1 7 | invoke-direct {p0}, Ljava/lang/Object;->()V 8 | return-void 9 | .end method 10 | 11 | .method public getSuperclass()Lsuperclass; 12 | .registers 2 13 | 14 | new-instance v0, Lsuperclass; 15 | invoke-direct {v0}, Lsuperclass;->()V 16 | 17 | return-object v0 18 | .end method -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/test/smali/deodex_test1/subclass.smali: -------------------------------------------------------------------------------- 1 | .class public Lsubclass; 2 | 3 | .super Lsuperclass; 4 | 5 | .method public constructor ()V 6 | .registers 1 7 | invoke-direct {p0}, Lsuperclass;->()V 8 | return-void 9 | .end method 10 | 11 | .method public somemethod()V 12 | .registers 2 13 | 14 | sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 15 | 16 | const-string v1, "subclass.somemethod" 17 | 18 | invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V 19 | 20 | return-void 21 | .end method -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/test/smali/deodex_test1/superclass.smali: -------------------------------------------------------------------------------- 1 | .class public Lsuperclass; 2 | 3 | .super Ljava/lang/Object; 4 | 5 | .method public constructor ()V 6 | .registers 1 7 | invoke-direct {p0}, Ljava/lang/Object;->()V 8 | return-void 9 | .end method 10 | 11 | .method public somemethod()V 12 | .registers 2 13 | 14 | sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 15 | 16 | const-string v1, "superclass.somemethod" 17 | 18 | invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V 19 | 20 | return-void 21 | .end method -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/test/smali/deodex_test2/app_classes/main.smali: -------------------------------------------------------------------------------- 1 | .class public Lmain; 2 | 3 | .super Ljava/lang/Object; 4 | 5 | .method public static main([Ljava/lang/String;)V 6 | .registers 6 7 | 8 | const v2, 0 9 | 10 | 11 | const v3, 1 12 | const v4, 0 13 | new-array v1, v3, [Lsubclass1; 14 | new-instance v0, Lsubclass1; 15 | invoke-direct {v0}, Lsubclass1;->()V 16 | aput-object v0, v1, v4 17 | 18 | goto :here2 19 | 20 | :here 21 | const v2, 1 22 | 23 | :here2 24 | 25 | #this is tricky, because it has to merge two array types, [Lsubclass1; and [Lsubclass2 26 | #which should result in [Lsuperclass;. However, this dex file won't have a reference 27 | #to [Lsuperclass; 28 | aget-object v5, v1, v4 29 | 30 | invoke-virtual {v5}, Lsupersuperclass;->somemethod()V 31 | 32 | 33 | new-array v1, v3, [Lsubclass2; 34 | new-instance v0, Lsubclass2; 35 | invoke-direct {v0}, Lsubclass2;->()V 36 | aput-object v0, v1, v4 37 | 38 | if-eqz v2, :here 39 | 40 | return-void 41 | .end method -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/test/smali/deodex_test2/bootclass_classes/randomclass.smali: -------------------------------------------------------------------------------- 1 | .class public Lrandomclass; 2 | 3 | .super Ljava/lang/Object; 4 | 5 | .method public constructor ()V 6 | .registers 1 7 | invoke-direct {p0}, Ljava/lang/Object;->()V 8 | return-void 9 | .end method 10 | 11 | .method public getSuperclass()Lsuperclass; 12 | .registers 2 13 | 14 | new-instance v0, Lsuperclass; 15 | invoke-direct {v0}, Lsuperclass;->()V 16 | 17 | return-object v0 18 | .end method -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/test/smali/deodex_test2/bootclass_classes/subclass1.smali: -------------------------------------------------------------------------------- 1 | .class public Lsubclass1; 2 | 3 | .super Lsuperclass; 4 | 5 | .method public constructor ()V 6 | .registers 1 7 | invoke-direct {p0}, Lsuperclass;->()V 8 | return-void 9 | .end method 10 | 11 | .method public somemethod()V 12 | .registers 2 13 | 14 | sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 15 | 16 | const-string v1, "subclass1.somemethod" 17 | 18 | invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V 19 | 20 | return-void 21 | .end method -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/test/smali/deodex_test2/bootclass_classes/subclass2.smali: -------------------------------------------------------------------------------- 1 | .class public Lsubclass2; 2 | 3 | .super Lsuperclass; 4 | 5 | .method public constructor ()V 6 | .registers 1 7 | invoke-direct {p0}, Lsuperclass;->()V 8 | return-void 9 | .end method 10 | 11 | .method public somemethod()V 12 | .registers 2 13 | 14 | sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 15 | 16 | const-string v1, "subclass2.somemethod" 17 | 18 | invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V 19 | 20 | return-void 21 | .end method -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/test/smali/deodex_test2/bootclass_classes/superclass.smali: -------------------------------------------------------------------------------- 1 | .class public Lsuperclass; 2 | 3 | .super Lsupersuperclass; 4 | 5 | .method public constructor ()V 6 | .registers 1 7 | invoke-direct {p0}, Lsupersuperclass;->()V 8 | return-void 9 | .end method 10 | 11 | .method public somemethod()V 12 | .registers 2 13 | 14 | sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 15 | 16 | const-string v1, "superclass.somemethod" 17 | 18 | invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V 19 | 20 | return-void 21 | .end method -------------------------------------------------------------------------------- /brut.apktool.smali/baksmali/src/test/smali/deodex_test2/bootclass_classes/supersuperclass.smali: -------------------------------------------------------------------------------- 1 | .class public Lsupersuperclass; 2 | 3 | .super Ljava/lang/Object; 4 | 5 | .method public constructor ()V 6 | .registers 1 7 | invoke-direct {p0}, Ljava/lang/Object;->()V 8 | return-void 9 | .end method 10 | 11 | .method public somemethod()V 12 | .registers 2 13 | 14 | sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 15 | 16 | const-string v1, "supersuperclass.somemethod" 17 | 18 | invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V 19 | 20 | return-void 21 | .end method -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Google Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Google Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | dependencies { 33 | compile 'com.google.code.findbugs:jsr305:1.3.9' 34 | compile 'com.google.collections:google-collections:1.0' 35 | } -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/AnnotationVisibility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib; 30 | 31 | public enum AnnotationVisibility { 32 | BUILD((byte)0, "build"), 33 | RUNTIME((byte)1, "runtime"), 34 | SYSTEM((byte)2, "system"); 35 | 36 | public final byte value; 37 | public final String visibility; 38 | private AnnotationVisibility(byte value, String visibility) { 39 | this.value = value; 40 | this.visibility = visibility; 41 | } 42 | 43 | public static AnnotationVisibility fromByte(byte value) { 44 | switch (value) { 45 | case (byte)0: 46 | return BUILD; 47 | case (byte)1: 48 | return RUNTIME; 49 | case (byte)2: 50 | return SYSTEM; 51 | default: 52 | throw new RuntimeException("Invalid annotation visibility value: " + value); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/ValidationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code.Analysis; 30 | 31 | import org.jf.dexlib.Util.ExceptionWithContext; 32 | 33 | public class ValidationException extends ExceptionWithContext { 34 | private int codeAddress; 35 | 36 | public ValidationException(int codeAddress, String errorMessage) { 37 | super(errorMessage); 38 | this.codeAddress = codeAddress; 39 | } 40 | 41 | public ValidationException(String errorMessage) { 42 | super(errorMessage); 43 | } 44 | 45 | public void setCodeAddress(int codeAddress) { 46 | this.codeAddress = codeAddress; 47 | } 48 | 49 | public int getCodeAddress() { 50 | return codeAddress; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/EncodedLiteralInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Google Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Google Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package org.jf.dexlib.Code; 33 | 34 | public interface EncodedLiteralInstruction extends LiteralInstruction { 35 | long getDecodedLiteral(); 36 | } 37 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/FiveRegisterInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface FiveRegisterInstruction extends InvokeInstruction { 32 | byte getRegisterA(); 33 | byte getRegisterD(); 34 | byte getRegisterE(); 35 | byte getRegisterF(); 36 | byte getRegisterG(); 37 | } 38 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/Format/InstructionWithJumboVariant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, Google Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Google Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package org.jf.dexlib.Code.Format; 33 | 34 | import org.jf.dexlib.Code.Instruction; 35 | 36 | public interface InstructionWithJumboVariant { 37 | Instruction makeJumbo(); 38 | } 39 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/Format/UnknownInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Google Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Google Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package org.jf.dexlib.Code.Format; 33 | 34 | import org.jf.dexlib.Code.Opcode; 35 | 36 | public class UnknownInstruction extends Instruction10x { 37 | private short originalOpcode; 38 | 39 | public UnknownInstruction(short originalOpcode) { 40 | super(Opcode.NOP); 41 | this.originalOpcode = originalOpcode; 42 | } 43 | 44 | public short getOriginalOpcode() { 45 | return originalOpcode; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/InvokeInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2011 Ben Gruver 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface InvokeInstruction { 32 | int getRegCount(); 33 | } 34 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/LiteralInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface LiteralInstruction { 32 | long getLiteral(); 33 | } 34 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/MultiOffsetInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface MultiOffsetInstruction { 32 | public int[] getTargets(); 33 | public void updateTarget(int targetIndex, int targetAddressOffset); 34 | } 35 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/OdexedFieldAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface OdexedFieldAccess { 32 | int getFieldOffset(); 33 | } 34 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/OdexedInvokeInline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, Google Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Google Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package org.jf.dexlib.Code; 33 | 34 | public interface OdexedInvokeInline extends InvokeInstruction { 35 | int getInlineIndex(); 36 | } 37 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/OdexedInvokeVirtual.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface OdexedInvokeVirtual { 32 | int getVtableIndex(); 33 | } 34 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/OffsetInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public abstract class OffsetInstruction extends Instruction { 32 | protected OffsetInstruction(Opcode opcode) { 33 | super(opcode); 34 | } 35 | 36 | public abstract int getTargetAddressOffset(); 37 | public abstract void updateTargetAddressOffset(int targetAddressOffset); 38 | } 39 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/RegisterRangeInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface RegisterRangeInstruction extends InvokeInstruction { 32 | int getStartRegister(); 33 | } 34 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/SingleRegisterInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface SingleRegisterInstruction { 32 | int getRegisterA(); 33 | } 34 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/ThreeRegisterInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface ThreeRegisterInstruction extends TwoRegisterInstruction { 32 | int getRegisterC(); 33 | } 34 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Code/TwoRegisterInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Code; 30 | 31 | public interface TwoRegisterInstruction extends SingleRegisterInstruction { 32 | int getRegisterA(); 33 | int getRegisterB(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Convertible.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Google Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Google Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package org.jf.dexlib; 33 | 34 | /** 35 | * Describes an object that can be converted to a different type 36 | */ 37 | public interface Convertible { 38 | T convert(); 39 | } 40 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/OffsettedSection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib; 30 | 31 | import org.jf.dexlib.Util.Input; 32 | 33 | public class OffsettedSection extends Section { 34 | public OffsettedSection(DexFile dexFile, ItemType itemType) { 35 | super(dexFile, itemType); 36 | } 37 | 38 | public void readItems(Input in, ReadContext readContext) { 39 | 40 | for (int i = 0; i < items.size(); i++) { 41 | assert items.get(i) == null; 42 | 43 | in.alignTo(ItemType.ItemAlignment); 44 | 45 | T item = (T)ItemFactory.makeItem(ItemType, DexFile); 46 | 47 | items.set(i, item); 48 | item.readFrom(in, i, readContext); 49 | } 50 | 51 | readContext.setItemsForSection(ItemType, items); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Util/AlignmentUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Util; 30 | 31 | public abstract class AlignmentUtils { 32 | public static int alignOffset(int offset, int alignment) { 33 | int mask = alignment - 1; 34 | assert (alignment >= 0) && ((mask & alignment) == 0); 35 | return (offset + mask) & ~mask; 36 | } 37 | 38 | public static boolean isAligned(int offset, int alignment) { 39 | return (offset % alignment) == 0; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Util/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Util; 30 | 31 | public class Pair { 32 | public final A first; 33 | public final B second; 34 | 35 | public Pair(A first, B second) { 36 | this.first = first; 37 | this.second = second; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /brut.apktool.smali/dexlib/src/main/java/org/jf/dexlib/Util/ReadOnlyArrayList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.dexlib.Util; 30 | 31 | import java.util.AbstractList; 32 | import java.util.RandomAccess; 33 | 34 | public class ReadOnlyArrayList extends AbstractList implements RandomAccess { 35 | private final T[] arr; 36 | 37 | public ReadOnlyArrayList(T[] arr) { 38 | this.arr = arr; 39 | } 40 | 41 | public int size() { 42 | return arr.length; 43 | } 44 | 45 | public T get(int i) { 46 | return arr[i]; 47 | } 48 | 49 | public static ReadOnlyArrayList of(T... items) { 50 | return new ReadOnlyArrayList(items); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/main/java/org/jf/smali/InvalidToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.smali; 30 | 31 | import org.antlr.runtime.CommonToken; 32 | 33 | public class InvalidToken extends CommonToken { 34 | private final String message; 35 | 36 | public InvalidToken(String message) { 37 | super(smaliParser.INVALID_TOKEN); 38 | this.message = message; 39 | this.channel = smaliParser.ERROR_CHANNEL; 40 | } 41 | 42 | public InvalidToken(String message, String text) { 43 | super(smaliParser.INVALID_TOKEN, text); 44 | this.message = message; 45 | this.channel = smaliParser.ERROR_CHANNEL; 46 | } 47 | 48 | public String getMessage() { 49 | return message; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/main/java/org/jf/smali/LexerErrorInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.smali; 30 | 31 | import org.antlr.runtime.CharStream; 32 | import org.antlr.runtime.Lexer; 33 | import org.antlr.runtime.RecognizerSharedState; 34 | 35 | public interface LexerErrorInterface { 36 | public int getNumberOfSyntaxErrors(); 37 | 38 | //ANTLR doesn't provide any way to add interfaces to the lexer class directly, so this is an intermediate 39 | //class that implements LexerErrorInterface that we can have the ANTLR parser extend 40 | public abstract static class ANTLRLexerWithErrorInterface extends Lexer implements LexerErrorInterface { 41 | public ANTLRLexerWithErrorInterface() { 42 | } 43 | 44 | public ANTLRLexerWithErrorInterface(CharStream input, RecognizerSharedState state) { 45 | super(input, state); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/main/java/org/jf/smali/OdexedInstructionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.smali; 30 | 31 | import org.antlr.runtime.IntStream; 32 | import org.antlr.runtime.RecognitionException; 33 | 34 | public class OdexedInstructionException extends RecognitionException { 35 | private String odexedInstruction; 36 | 37 | OdexedInstructionException(IntStream input, String odexedInstruction) { 38 | super(input); 39 | this.odexedInstruction = odexedInstruction; 40 | } 41 | 42 | public String getMessage() { 43 | return odexedInstruction + " is an odexed instruction. You cannot reassemble a disassembled odex file " + 44 | "unless it has been deodexed."; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/main/resources/properties/smali.properties: -------------------------------------------------------------------------------- 1 | application.version=1.4.1 2 | -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/.gitattributes: -------------------------------------------------------------------------------- 1 | # Prevent newlines from being normalized on windows 2 | *.smali -text -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/ByteLiteralTest.smali: -------------------------------------------------------------------------------- 1 | 0x0T 2 | 0x00 3 | 0x1T 4 | 0x12 5 | 0x7fT 6 | 0x80t 7 | 0xFFt 8 | -0x00 9 | -0x01 10 | -0x12 11 | -0x80 12 | -0x1f 13 | -0x1fT 14 | -0x81 15 | -0xFF 16 | -0x100 17 | 0 18 | 1t 19 | 123 20 | 127T 21 | 128 22 | 255 23 | -0 24 | -1 25 | -123 26 | -123T 27 | -127 28 | -128 29 | -129 30 | -255 31 | 256 32 | 260 33 | 00 34 | 01 35 | 0123t 36 | 0177 37 | 0200T 38 | 0377 39 | -00 40 | -01 41 | -0123 42 | -0123t 43 | -177 44 | -0200 45 | -0201 46 | -0377 47 | -0400 -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/ByteLiteralTest.tokens: -------------------------------------------------------------------------------- 1 | BYTE_LITERAL("0x0T") 2 | POSITIVE_INTEGER_LITERAL("0x00") 3 | BYTE_LITERAL("0x1T") 4 | POSITIVE_INTEGER_LITERAL("0x12") 5 | BYTE_LITERAL("0x7fT") 6 | BYTE_LITERAL("0x80t") 7 | BYTE_LITERAL("0xFFt") 8 | NEGATIVE_INTEGER_LITERAL("-0x00") 9 | NEGATIVE_INTEGER_LITERAL("-0x01") 10 | NEGATIVE_INTEGER_LITERAL("-0x12") 11 | NEGATIVE_INTEGER_LITERAL("-0x80") 12 | NEGATIVE_INTEGER_LITERAL("-0x1f") 13 | BYTE_LITERAL("-0x1fT") 14 | NEGATIVE_INTEGER_LITERAL("-0x81") 15 | NEGATIVE_INTEGER_LITERAL("-0xFF") 16 | NEGATIVE_INTEGER_LITERAL("-0x100") 17 | POSITIVE_INTEGER_LITERAL("0") 18 | BYTE_LITERAL("1t") 19 | POSITIVE_INTEGER_LITERAL("123") 20 | BYTE_LITERAL("127T") 21 | POSITIVE_INTEGER_LITERAL("128") 22 | POSITIVE_INTEGER_LITERAL("255") 23 | NEGATIVE_INTEGER_LITERAL("-0") 24 | NEGATIVE_INTEGER_LITERAL("-1") 25 | NEGATIVE_INTEGER_LITERAL("-123") 26 | BYTE_LITERAL("-123T") 27 | NEGATIVE_INTEGER_LITERAL("-127") 28 | NEGATIVE_INTEGER_LITERAL("-128") 29 | NEGATIVE_INTEGER_LITERAL("-129") 30 | NEGATIVE_INTEGER_LITERAL("-255") 31 | POSITIVE_INTEGER_LITERAL("256") 32 | POSITIVE_INTEGER_LITERAL("260") 33 | POSITIVE_INTEGER_LITERAL("00") 34 | POSITIVE_INTEGER_LITERAL("01") 35 | BYTE_LITERAL("0123t") 36 | POSITIVE_INTEGER_LITERAL("0177") 37 | BYTE_LITERAL("0200T") 38 | POSITIVE_INTEGER_LITERAL("0377") 39 | NEGATIVE_INTEGER_LITERAL("-00") 40 | NEGATIVE_INTEGER_LITERAL("-01") 41 | NEGATIVE_INTEGER_LITERAL("-0123") 42 | BYTE_LITERAL("-0123t") 43 | NEGATIVE_INTEGER_LITERAL("-177") 44 | NEGATIVE_INTEGER_LITERAL("-0200") 45 | NEGATIVE_INTEGER_LITERAL("-0201") 46 | NEGATIVE_INTEGER_LITERAL("-0377") 47 | NEGATIVE_INTEGER_LITERAL("-0400") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/CharLiteralTest.smali: -------------------------------------------------------------------------------- 1 | ' ' 2 | ' ' 3 | 'a' 4 | 'A' 5 | 'z' 6 | 'Z' 7 | 'a''a' 8 | '1' 9 | '2' 10 | '\n' 11 | '\r' 12 | '\t' 13 | '\b' 14 | '\f' 15 | '\u0030' 16 | '\uABCD' 17 | '\uabcd' 18 | '\\' 19 | '\'' 20 | '\"' 21 | '"' 22 | 23 | 24 | 'a'a' 25 | 'ab' 26 | '\a' 27 | '' 28 | ' 29 | ' 30 | ' 31 | '\u' 32 | '\u0' 33 | '\ua' 34 | '\uab' 35 | '\u01a' 36 | '\uz' 37 | '\u012z' 38 | 39 | 'a' 40 | ' -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/CharLiteralTest.tokens: -------------------------------------------------------------------------------- 1 | CHAR_LITERAL("' '") 2 | CHAR_LITERAL("'\t'") 3 | CHAR_LITERAL("'a'") 4 | CHAR_LITERAL("'A'") 5 | CHAR_LITERAL("'z'") 6 | CHAR_LITERAL("'Z'") 7 | CHAR_LITERAL("'a'")CHAR_LITERAL("'a'") 8 | CHAR_LITERAL("'1'") 9 | CHAR_LITERAL("'2'") 10 | CHAR_LITERAL("'\n'") 11 | CHAR_LITERAL("'\r'") 12 | CHAR_LITERAL("'\t'") 13 | CHAR_LITERAL("'\b'") 14 | CHAR_LITERAL("'\f'") 15 | CHAR_LITERAL("'\u0030'") 16 | CHAR_LITERAL("'\uABCD'") 17 | CHAR_LITERAL("'\uabcd'") 18 | CHAR_LITERAL("'\\'") 19 | CHAR_LITERAL("'''") 20 | CHAR_LITERAL("'\"'") 21 | CHAR_LITERAL("'\"'") 22 | 23 | 24 | CHAR_LITERAL("'a'") SIMPLE_NAME("a") INVALID_TOKEN("'") 25 | INVALID_TOKEN("'ab'") 26 | INVALID_TOKEN("'\\a'") 27 | INVALID_TOKEN("''") 28 | INVALID_TOKEN("'") 29 | INVALID_TOKEN("'") 30 | INVALID_TOKEN("'") 31 | INVALID_TOKEN("'\\u'") 32 | INVALID_TOKEN("'\\u0'") 33 | INVALID_TOKEN("'\\ua'") 34 | INVALID_TOKEN("'\\uab'") 35 | INVALID_TOKEN("'\\u01a'") 36 | INVALID_TOKEN("'\\uz'") 37 | INVALID_TOKEN("'\\u012z'") 38 | 39 | CHAR_LITERAL("'a'") 40 | INVALID_TOKEN("'") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/CommentTest.smali: -------------------------------------------------------------------------------- 1 | # 2 | #abcd 3 | # abcd 4 | #0x1234 5 | 0x1234 #0x1234 6 | invoke-virtual #invoke-virtual -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/CommentTest.tokens: -------------------------------------------------------------------------------- 1 | LINE_COMMENT("#") WHITE_SPACE("\n") 2 | LINE_COMMENT("#abcd") WHITE_SPACE("\n") 3 | LINE_COMMENT("# abcd") WHITE_SPACE("\n") 4 | LINE_COMMENT("#0x1234") WHITE_SPACE("\n") 5 | POSITIVE_INTEGER_LITERAL("0x1234") WHITE_SPACE(" ") LINE_COMMENT("#0x1234") WHITE_SPACE("\n") 6 | INSTRUCTION_FORMAT35c_METHOD("invoke-virtual") WHITE_SPACE(" ") LINE_COMMENT("#invoke-virtual") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/DirectiveTest.smali: -------------------------------------------------------------------------------- 1 | 2 | .class 3 | .super 4 | .implements 5 | .source 6 | .field 7 | .end field 8 | .subannotation 9 | .end subannotation 10 | .annotation 11 | .end annotation 12 | .enum 13 | .method 14 | .end method 15 | .registers 16 | .locals 17 | .array-data 18 | .end array-data 19 | .packed-switch 20 | .end packed-switch 21 | .sparse-switch 22 | .end sparse-switch 23 | .catch 24 | .catchall 25 | .line 26 | .parameter 27 | .end parameter 28 | .local 29 | .end local 30 | .restart local 31 | .prologue 32 | .epilogue 33 | 34 | 35 | .class.super.implements 36 | .class .super .implements 37 | .class .super .implements 38 | .class .super .implements 39 | .class 40 | .super 41 | .implements 42 | 43 | 44 | .blah1234 45 | .end blah 46 | .local1234 47 | .super1234 48 | .super@ 49 | .super.super 50 | .supeer 51 | .end 52 | . 53 | .1234.1234 54 | . 55 | 56 | 57 | -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/DirectiveTest.tokens: -------------------------------------------------------------------------------- 1 | CLASS_DIRECTIVE(".class") 2 | SUPER_DIRECTIVE(".super") 3 | IMPLEMENTS_DIRECTIVE(".implements") 4 | SOURCE_DIRECTIVE(".source") 5 | FIELD_DIRECTIVE(".field") 6 | END_FIELD_DIRECTIVE(".end field") 7 | SUBANNOTATION_DIRECTIVE(".subannotation") 8 | END_SUBANNOTATION_DIRECTIVE(".end subannotation") 9 | ANNOTATION_DIRECTIVE(".annotation") 10 | END_ANNOTATION_DIRECTIVE(".end annotation") 11 | ENUM_DIRECTIVE(".enum") 12 | METHOD_DIRECTIVE(".method") 13 | END_METHOD_DIRECTIVE(".end method") 14 | REGISTERS_DIRECTIVE(".registers") 15 | LOCALS_DIRECTIVE(".locals") 16 | ARRAY_DATA_DIRECTIVE(".array-data") 17 | END_ARRAY_DATA_DIRECTIVE(".end array-data") 18 | PACKED_SWITCH_DIRECTIVE(".packed-switch") 19 | END_PACKED_SWITCH_DIRECTIVE(".end packed-switch") 20 | SPARSE_SWITCH_DIRECTIVE(".sparse-switch") 21 | END_SPARSE_SWITCH_DIRECTIVE(".end sparse-switch") 22 | CATCH_DIRECTIVE(".catch") 23 | CATCHALL_DIRECTIVE(".catchall") 24 | LINE_DIRECTIVE(".line") 25 | PARAMETER_DIRECTIVE(".parameter") 26 | END_PARAMETER_DIRECTIVE(".end parameter") 27 | LOCAL_DIRECTIVE(".local") 28 | END_LOCAL_DIRECTIVE(".end local") 29 | RESTART_LOCAL_DIRECTIVE(".restart local") 30 | PROLOGUE_DIRECTIVE(".prologue") 31 | EPILOGUE_DIRECTIVE(".epilogue") 32 | 33 | 34 | CLASS_DIRECTIVE(".class") 35 | SUPER_DIRECTIVE(".super") 36 | IMPLEMENTS_DIRECTIVE(".implements") 37 | CLASS_DIRECTIVE(".class") 38 | SUPER_DIRECTIVE(".super") 39 | IMPLEMENTS_DIRECTIVE(".implements") 40 | CLASS_DIRECTIVE(".class") 41 | SUPER_DIRECTIVE(".super") 42 | IMPLEMENTS_DIRECTIVE(".implements") 43 | CLASS_DIRECTIVE(".class") 44 | SUPER_DIRECTIVE(".super") 45 | IMPLEMENTS_DIRECTIVE(".implements") 46 | CLASS_DIRECTIVE(".class") 47 | SUPER_DIRECTIVE(".super") 48 | IMPLEMENTS_DIRECTIVE(".implements") 49 | 50 | 51 | INVALID_TOKEN(".blah1234") 52 | INVALID_TOKEN(".end blah") 53 | INVALID_TOKEN(".local1234") 54 | INVALID_TOKEN(".super1234") 55 | SUPER_DIRECTIVE(".super") 56 | INVALID_TOKEN("@") 57 | SUPER_DIRECTIVE(".super") 58 | SUPER_DIRECTIVE(".super") 59 | INVALID_TOKEN(".supeer") 60 | INVALID_TOKEN(".end") 61 | INVALID_TOKEN(".") 62 | DOUBLE_LITERAL(".1234") 63 | DOUBLE_LITERAL(".1234") 64 | INVALID_TOKEN(".") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/IntegerLiteralTest.smali: -------------------------------------------------------------------------------- 1 | 0x0 2 | 0x00 3 | 0x1 4 | 0x12345678 5 | 0x7fffffff 6 | 0x80000000 7 | 0xFFFFFFFF 8 | -0x00 9 | -0x01 10 | -0x12345678 11 | -0x80000000 12 | -0x1FFFFFFF 13 | -0x80000001 14 | -0xFFFFFFFF 15 | -0x100000000 16 | 0 17 | 1 18 | 1234567890 19 | 2147483647 20 | 2147483648 21 | 4294967295 22 | -0 23 | -1 24 | -1234567890 25 | -2147483647 26 | -2147483648 27 | -2147483649 28 | -4294967295 29 | 4294967295 30 | 4294967300 31 | 8589934592 32 | 00 33 | 01 34 | 012345670123 35 | 017777777777 36 | 020000000000 37 | 037777777777 38 | -00 39 | -01 40 | -012345670123 41 | -017777777777 42 | -020000000000 43 | -020000000001 44 | -037777777777 45 | 0400000000000 -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/IntegerLiteralTest.tokens: -------------------------------------------------------------------------------- 1 | POSITIVE_INTEGER_LITERAL("0x0") 2 | POSITIVE_INTEGER_LITERAL("0x00") 3 | POSITIVE_INTEGER_LITERAL("0x1") 4 | POSITIVE_INTEGER_LITERAL("0x12345678") 5 | POSITIVE_INTEGER_LITERAL("0x7fffffff") 6 | POSITIVE_INTEGER_LITERAL("0x80000000") 7 | POSITIVE_INTEGER_LITERAL("0xFFFFFFFF") 8 | NEGATIVE_INTEGER_LITERAL("-0x00") 9 | NEGATIVE_INTEGER_LITERAL("-0x01") 10 | NEGATIVE_INTEGER_LITERAL("-0x12345678") 11 | NEGATIVE_INTEGER_LITERAL("-0x80000000") 12 | NEGATIVE_INTEGER_LITERAL("-0x1FFFFFFF") 13 | NEGATIVE_INTEGER_LITERAL("-0x80000001") 14 | NEGATIVE_INTEGER_LITERAL("-0xFFFFFFFF") 15 | NEGATIVE_INTEGER_LITERAL("-0x100000000") 16 | POSITIVE_INTEGER_LITERAL("0") 17 | POSITIVE_INTEGER_LITERAL("1") 18 | POSITIVE_INTEGER_LITERAL("1234567890") 19 | POSITIVE_INTEGER_LITERAL("2147483647") 20 | POSITIVE_INTEGER_LITERAL("2147483648") 21 | POSITIVE_INTEGER_LITERAL("4294967295") 22 | NEGATIVE_INTEGER_LITERAL("-0") 23 | NEGATIVE_INTEGER_LITERAL("-1") 24 | NEGATIVE_INTEGER_LITERAL("-1234567890") 25 | NEGATIVE_INTEGER_LITERAL("-2147483647") 26 | NEGATIVE_INTEGER_LITERAL("-2147483648") 27 | NEGATIVE_INTEGER_LITERAL("-2147483649") 28 | NEGATIVE_INTEGER_LITERAL("-4294967295") 29 | POSITIVE_INTEGER_LITERAL("4294967295") 30 | POSITIVE_INTEGER_LITERAL("4294967300") 31 | POSITIVE_INTEGER_LITERAL("8589934592") 32 | POSITIVE_INTEGER_LITERAL("00") 33 | POSITIVE_INTEGER_LITERAL("01") 34 | POSITIVE_INTEGER_LITERAL("012345670123") 35 | POSITIVE_INTEGER_LITERAL("017777777777") 36 | POSITIVE_INTEGER_LITERAL("020000000000") 37 | POSITIVE_INTEGER_LITERAL("037777777777") 38 | NEGATIVE_INTEGER_LITERAL("-00") 39 | NEGATIVE_INTEGER_LITERAL("-01") 40 | NEGATIVE_INTEGER_LITERAL("-012345670123") 41 | NEGATIVE_INTEGER_LITERAL("-017777777777") 42 | NEGATIVE_INTEGER_LITERAL("-020000000000") 43 | NEGATIVE_INTEGER_LITERAL("-020000000001") 44 | NEGATIVE_INTEGER_LITERAL("-037777777777") 45 | POSITIVE_INTEGER_LITERAL("0400000000000") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/LongLiteralTest.smali: -------------------------------------------------------------------------------- 1 | 0x0L 2 | 0x00L 3 | 0x1L 4 | 0x1234567890123456L 5 | 0x7fffffffffffffffL 6 | 0x8000000000000000L 7 | 0xFFFFFFFFFFFFFFFFL 8 | -0x00L 9 | -0x01L 10 | -0x1234567890123456L 11 | -0x8000000000000000L 12 | -0x1fffffffffffffffL 13 | -0x8000000000000001 14 | -0xFFFFFFFFFFFFFFFF 15 | 0x10000000000000000 16 | 0L 17 | 1 18 | 1234567890123456789 19 | 1234567890123456789L 20 | 9223372036854775807 21 | 9223372036854775808 22 | 18446744073709551615L 23 | -0 24 | -1 25 | -1234567890123456789 26 | -1234567890123456789L 27 | -9223372036854775807 28 | -9223372036854775808 29 | -9223372036854775809 30 | -18446744073709551616 31 | 18446744073709551617 32 | 18446744073709551700 33 | 00 34 | 01 35 | 0123456701234567012345 36 | 0123456701234567012345L 37 | 0777777777777777777777 38 | 0100000000000000000000 39 | 0177777777777777777777 40 | -00 41 | -01 42 | -0123456701234567012345 43 | -0123456701234567012345L 44 | -0777777777777777777777 45 | -0100000000000000000000 46 | -0100000000000000000001 47 | -0177777777777777777777 48 | -02000000000000000000000 -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/LongLiteralTest.tokens: -------------------------------------------------------------------------------- 1 | LONG_LITERAL("0x0L") 2 | LONG_LITERAL("0x00L") 3 | LONG_LITERAL("0x1L") 4 | LONG_LITERAL("0x1234567890123456L") 5 | LONG_LITERAL("0x7fffffffffffffffL") 6 | LONG_LITERAL("0x8000000000000000L") 7 | LONG_LITERAL("0xFFFFFFFFFFFFFFFFL") 8 | LONG_LITERAL("-0x00L") 9 | LONG_LITERAL("-0x01L") 10 | LONG_LITERAL("-0x1234567890123456L") 11 | LONG_LITERAL("-0x8000000000000000L") 12 | LONG_LITERAL("-0x1fffffffffffffffL") 13 | NEGATIVE_INTEGER_LITERAL("-0x8000000000000001") 14 | NEGATIVE_INTEGER_LITERAL("-0xFFFFFFFFFFFFFFFF") 15 | POSITIVE_INTEGER_LITERAL("0x10000000000000000") 16 | LONG_LITERAL("0L") 17 | POSITIVE_INTEGER_LITERAL("1") 18 | POSITIVE_INTEGER_LITERAL("1234567890123456789") 19 | LONG_LITERAL("1234567890123456789L") 20 | POSITIVE_INTEGER_LITERAL("9223372036854775807") 21 | POSITIVE_INTEGER_LITERAL("9223372036854775808") 22 | LONG_LITERAL("18446744073709551615L") 23 | NEGATIVE_INTEGER_LITERAL("-0") 24 | NEGATIVE_INTEGER_LITERAL("-1") 25 | NEGATIVE_INTEGER_LITERAL("-1234567890123456789") 26 | LONG_LITERAL("-1234567890123456789L") 27 | NEGATIVE_INTEGER_LITERAL("-9223372036854775807") 28 | NEGATIVE_INTEGER_LITERAL("-9223372036854775808") 29 | NEGATIVE_INTEGER_LITERAL("-9223372036854775809") 30 | NEGATIVE_INTEGER_LITERAL("-18446744073709551616") 31 | POSITIVE_INTEGER_LITERAL("18446744073709551617") 32 | POSITIVE_INTEGER_LITERAL("18446744073709551700") 33 | POSITIVE_INTEGER_LITERAL("00") 34 | POSITIVE_INTEGER_LITERAL("01") 35 | POSITIVE_INTEGER_LITERAL("0123456701234567012345") 36 | LONG_LITERAL("0123456701234567012345L") 37 | POSITIVE_INTEGER_LITERAL("0777777777777777777777") 38 | POSITIVE_INTEGER_LITERAL("0100000000000000000000") 39 | POSITIVE_INTEGER_LITERAL("0177777777777777777777") 40 | NEGATIVE_INTEGER_LITERAL("-00") 41 | NEGATIVE_INTEGER_LITERAL("-01") 42 | NEGATIVE_INTEGER_LITERAL("-0123456701234567012345") 43 | LONG_LITERAL("-0123456701234567012345L") 44 | NEGATIVE_INTEGER_LITERAL("-0777777777777777777777") 45 | NEGATIVE_INTEGER_LITERAL("-0100000000000000000000") 46 | NEGATIVE_INTEGER_LITERAL("-0100000000000000000001") 47 | NEGATIVE_INTEGER_LITERAL("-0177777777777777777777") 48 | NEGATIVE_INTEGER_LITERAL("-02000000000000000000000") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/MiscTest.smali: -------------------------------------------------------------------------------- 1 | true 2 | false 3 | null 4 | p0 5 | p90 6 | pab 7 | v0 8 | v90 9 | vab 10 | 11 | truefalse 12 | 13 | build 14 | runtime 15 | system 16 | 17 | public 18 | private 19 | protected 20 | static 21 | final 22 | synchronized 23 | bridge 24 | varargs 25 | native 26 | abstract 27 | strictfp 28 | synthetic 29 | constructor 30 | declared-synchronized 31 | interface 32 | enum 33 | annotation 34 | volatile 35 | transient 36 | 37 | no-error 38 | generic-error 39 | no-such-class 40 | no-such-field 41 | no-such-method 42 | illegal-class-access 43 | illegal-field-access 44 | illegal-method-access 45 | class-change-error 46 | instantiation-error 47 | 48 | inline@0xABCD 49 | inline@0x0123 50 | inline@0x0123ABCD 51 | 52 | vtable@0xABCD 53 | vtable@0x0123 54 | vtable@0x0123ABCD 55 | 56 | field@0xABCD 57 | field@0x0123 58 | field@0x0123ABCD 59 | 60 | inline@ 61 | inline@zzz 62 | inline@abcd 63 | vtable@ 64 | vtable@zzz 65 | vtable@abcd 66 | field@ 67 | field@zzz 68 | field@abcd 69 | 70 | +0 71 | +10 72 | +01 73 | +0777 74 | +0x1234ABC 75 | +1234 76 | 77 | +08 78 | + -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/MiscTest.tokens: -------------------------------------------------------------------------------- 1 | BOOL_LITERAL("true") 2 | BOOL_LITERAL("false") 3 | NULL_LITERAL("null") 4 | REGISTER("p0") 5 | REGISTER("p90") 6 | SIMPLE_NAME("pab") 7 | REGISTER("v0") 8 | REGISTER("v90") 9 | SIMPLE_NAME("vab") 10 | 11 | SIMPLE_NAME("truefalse") 12 | 13 | ANNOTATION_VISIBILITY("build") 14 | ANNOTATION_VISIBILITY("runtime") 15 | ANNOTATION_VISIBILITY("system") 16 | 17 | ACCESS_SPEC("public") 18 | ACCESS_SPEC("private") 19 | ACCESS_SPEC("protected") 20 | ACCESS_SPEC("static") 21 | ACCESS_SPEC("final") 22 | ACCESS_SPEC("synchronized") 23 | ACCESS_SPEC("bridge") 24 | ACCESS_SPEC("varargs") 25 | ACCESS_SPEC("native") 26 | ACCESS_SPEC("abstract") 27 | ACCESS_SPEC("strictfp") 28 | ACCESS_SPEC("synthetic") 29 | ACCESS_SPEC("constructor") 30 | ACCESS_SPEC("declared-synchronized") 31 | ACCESS_SPEC("interface") 32 | ACCESS_SPEC("enum") 33 | ACCESS_SPEC("annotation") 34 | ACCESS_SPEC("volatile") 35 | ACCESS_SPEC("transient") 36 | 37 | VERIFICATION_ERROR_TYPE("no-error") 38 | VERIFICATION_ERROR_TYPE("generic-error") 39 | VERIFICATION_ERROR_TYPE("no-such-class") 40 | VERIFICATION_ERROR_TYPE("no-such-field") 41 | VERIFICATION_ERROR_TYPE("no-such-method") 42 | VERIFICATION_ERROR_TYPE("illegal-class-access") 43 | VERIFICATION_ERROR_TYPE("illegal-field-access") 44 | VERIFICATION_ERROR_TYPE("illegal-method-access") 45 | VERIFICATION_ERROR_TYPE("class-change-error") 46 | VERIFICATION_ERROR_TYPE("instantiation-error") 47 | 48 | INLINE_INDEX("inline@0xABCD") 49 | INLINE_INDEX("inline@0x0123") 50 | INLINE_INDEX("inline@0x0123ABCD") 51 | 52 | VTABLE_INDEX("vtable@0xABCD") 53 | VTABLE_INDEX("vtable@0x0123") 54 | VTABLE_INDEX("vtable@0x0123ABCD") 55 | 56 | FIELD_OFFSET("field@0xABCD") 57 | FIELD_OFFSET("field@0x0123") 58 | FIELD_OFFSET("field@0x0123ABCD") 59 | 60 | SIMPLE_NAME("inline") INVALID_TOKEN("@") 61 | SIMPLE_NAME("inline") INVALID_TOKEN("@") SIMPLE_NAME("zzz") 62 | SIMPLE_NAME("inline") INVALID_TOKEN("@") SIMPLE_NAME("abcd") 63 | SIMPLE_NAME("vtable") INVALID_TOKEN("@") 64 | SIMPLE_NAME("vtable") INVALID_TOKEN("@") SIMPLE_NAME("zzz") 65 | SIMPLE_NAME("vtable") INVALID_TOKEN("@") SIMPLE_NAME("abcd") 66 | SIMPLE_NAME("field") INVALID_TOKEN("@") 67 | SIMPLE_NAME("field") INVALID_TOKEN("@") SIMPLE_NAME("zzz") 68 | SIMPLE_NAME("field") INVALID_TOKEN("@") SIMPLE_NAME("abcd") 69 | 70 | OFFSET("+0") 71 | OFFSET("+10") 72 | OFFSET("+01") 73 | OFFSET("+0777") 74 | OFFSET("+0x1234ABC") 75 | OFFSET("+1234") 76 | 77 | OFFSET("+0") POSITIVE_INTEGER_LITERAL("8") 78 | INVALID_TOKEN("+") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/ShortLiteralTest.smali: -------------------------------------------------------------------------------- 1 | 0x0S 2 | 0x00 3 | 0x1s 4 | 0x1234 5 | 0x7fffS 6 | 0x8000s 7 | 0xFFFF 8 | -0x00 9 | -0x01 10 | -01234 11 | -01234s 12 | -0x8000 13 | -0x1fff 14 | -0x1fffS 15 | -0x8001 16 | -0xFFFF 17 | -0x100000 18 | 0 19 | 1 20 | 12345 21 | 12345s 22 | 32767 23 | 32678 24 | 65535S 25 | -0 26 | -1 27 | -12345S 28 | -32767 29 | -32768s 30 | -32679s 31 | -65535s 32 | 65536 33 | 65600 34 | 00 35 | 01 36 | 012345 37 | 012345s 38 | 077777 39 | 0100000 40 | 0177777 41 | -00 42 | -01 43 | -012345 44 | -012345S 45 | -077777 46 | -0100000 47 | -0100001 48 | -0177777 49 | 0200000 -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/ShortLiteralTest.tokens: -------------------------------------------------------------------------------- 1 | SHORT_LITERAL("0x0S") 2 | POSITIVE_INTEGER_LITERAL("0x00") 3 | SHORT_LITERAL("0x1s") 4 | POSITIVE_INTEGER_LITERAL("0x1234") 5 | SHORT_LITERAL("0x7fffS") 6 | SHORT_LITERAL("0x8000s") 7 | POSITIVE_INTEGER_LITERAL("0xFFFF") 8 | NEGATIVE_INTEGER_LITERAL("-0x00") 9 | NEGATIVE_INTEGER_LITERAL("-0x01") 10 | NEGATIVE_INTEGER_LITERAL("-01234") 11 | SHORT_LITERAL("-01234s") 12 | NEGATIVE_INTEGER_LITERAL("-0x8000") 13 | NEGATIVE_INTEGER_LITERAL("-0x1fff") 14 | SHORT_LITERAL("-0x1fffS") 15 | NEGATIVE_INTEGER_LITERAL("-0x8001") 16 | NEGATIVE_INTEGER_LITERAL("-0xFFFF") 17 | NEGATIVE_INTEGER_LITERAL("-0x100000") 18 | POSITIVE_INTEGER_LITERAL("0") 19 | POSITIVE_INTEGER_LITERAL("1") 20 | POSITIVE_INTEGER_LITERAL("12345") 21 | SHORT_LITERAL("12345s") 22 | POSITIVE_INTEGER_LITERAL("32767") 23 | POSITIVE_INTEGER_LITERAL("32678") 24 | SHORT_LITERAL("65535S") 25 | NEGATIVE_INTEGER_LITERAL("-0") 26 | NEGATIVE_INTEGER_LITERAL("-1") 27 | SHORT_LITERAL("-12345S") 28 | NEGATIVE_INTEGER_LITERAL("-32767") 29 | SHORT_LITERAL("-32768s") 30 | SHORT_LITERAL("-32679s") 31 | SHORT_LITERAL("-65535s") 32 | POSITIVE_INTEGER_LITERAL("65536") 33 | POSITIVE_INTEGER_LITERAL("65600") 34 | POSITIVE_INTEGER_LITERAL("00") 35 | POSITIVE_INTEGER_LITERAL("01") 36 | POSITIVE_INTEGER_LITERAL("012345") 37 | SHORT_LITERAL("012345s") 38 | POSITIVE_INTEGER_LITERAL("077777") 39 | POSITIVE_INTEGER_LITERAL("0100000") 40 | POSITIVE_INTEGER_LITERAL("0177777") 41 | NEGATIVE_INTEGER_LITERAL("-00") 42 | NEGATIVE_INTEGER_LITERAL("-01") 43 | NEGATIVE_INTEGER_LITERAL("-012345") 44 | SHORT_LITERAL("-012345S") 45 | NEGATIVE_INTEGER_LITERAL("-077777") 46 | NEGATIVE_INTEGER_LITERAL("-0100000") 47 | NEGATIVE_INTEGER_LITERAL("-0100001") 48 | NEGATIVE_INTEGER_LITERAL("-0177777") 49 | POSITIVE_INTEGER_LITERAL("0200000") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/StringLiteralTest.smali: -------------------------------------------------------------------------------- 1 | "" 2 | " " 3 | " " 4 | " " 5 | "aaaaaaaaaaaaaaaaaaaaaaaaaa" 6 | "\"\"\"\\" 7 | "abcd1234" 8 | "abcd 1234" 9 | "ABCD""ABCD" 10 | "1234" 11 | "\n" 12 | "\r" 13 | "\t" 14 | "\b" 15 | "\f" 16 | "\u0030" 17 | "\uABCD" 18 | "\uabcd" 19 | "\\" 20 | "\'" 21 | "'" 22 | "\"" 23 | "\n\r\t\b\f\u0030\uABCD\"\\\''\"" 24 | "\uABCD01234" 25 | "\uABCDEFGHIJK" 26 | "\u12341234" 27 | "\\\\\\\\\\\\\\\"" 28 | 29 | "a"a" 30 | "\a" 31 | " 32 | " 33 | " 34 | "\u" 35 | "\u0" 36 | "\ua" 37 | "\uab" 38 | "\u01a" 39 | "\uz" 40 | "\u012z\u\u\u\uz\"" 41 | 42 | "abcd" 43 | " -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/StringLiteralTest.tokens: -------------------------------------------------------------------------------- 1 | STRING_LITERAL("\"\"") 2 | STRING_LITERAL("\" \"") 3 | STRING_LITERAL("\" \"") 4 | STRING_LITERAL("\" \"") 5 | STRING_LITERAL("\"aaaaaaaaaaaaaaaaaaaaaaaaaa\"") 6 | STRING_LITERAL("\"\"\"\"\\\"") 7 | STRING_LITERAL("\"abcd1234\"") 8 | STRING_LITERAL("\"abcd 1234\"") 9 | STRING_LITERAL("\"ABCD\"") STRING_LITERAL("\"ABCD\"") 10 | STRING_LITERAL("\"1234\"") 11 | STRING_LITERAL("\"\n\"") 12 | STRING_LITERAL("\"\r\"") 13 | STRING_LITERAL("\"\t\"") 14 | STRING_LITERAL("\"\b\"") 15 | STRING_LITERAL("\"\f\"") 16 | STRING_LITERAL("\"\u0030\"") 17 | STRING_LITERAL("\"\uABCD\"") 18 | STRING_LITERAL("\"\uabcd\"") 19 | STRING_LITERAL("\"\\\"") 20 | STRING_LITERAL("\"\'\"") 21 | STRING_LITERAL("\"'\"") 22 | STRING_LITERAL("\"\"\"") 23 | STRING_LITERAL("\"\n\r\t\b\f\u0030\uABCD\"\\\''\"\"") 24 | STRING_LITERAL("\"\uABCD01234\"") 25 | STRING_LITERAL("\"\uABCDEFGHIJK\"") 26 | STRING_LITERAL("\"\u12341234\"") 27 | STRING_LITERAL("\"\\\\\\\\\\\\\\\"\"") 28 | 29 | STRING_LITERAL("\"a\"") SIMPLE_NAME("a") INVALID_TOKEN("\"") 30 | INVALID_TOKEN("\"\\a\"") 31 | INVALID_TOKEN("\"") 32 | INVALID_TOKEN("\"") 33 | INVALID_TOKEN("\"") 34 | INVALID_TOKEN("\"\\u\"") 35 | INVALID_TOKEN("\"\\u0\"") 36 | INVALID_TOKEN("\"\\ua\"") 37 | INVALID_TOKEN("\"\\uab\"") 38 | INVALID_TOKEN("\"\\u01a\"") 39 | INVALID_TOKEN("\"\\uz\"") 40 | INVALID_TOKEN("\"\\u012z\\u\\u\\u\\uz\"\"") 41 | 42 | STRING_LITERAL("\"abcd\"") 43 | INVALID_TOKEN("\"") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/SymbolTest.smali: -------------------------------------------------------------------------------- 1 | .. 2 | -> 3 | = 4 | : 5 | , 6 | {}() 7 | { } ( ) 8 | { 9 | } 10 | ( 11 | ) 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/SymbolTest.tokens: -------------------------------------------------------------------------------- 1 | DOTDOT("..") WHITE_SPACE("\n") 2 | ARROW("->") WHITE_SPACE("\n") 3 | EQUAL("=") WHITE_SPACE("\n") 4 | COLON(":") WHITE_SPACE("\n") 5 | COMMA(",") WHITE_SPACE("\n") 6 | OPEN_BRACE("{") CLOSE_BRACE("}") OPEN_PAREN("(") CLOSE_PAREN(")") WHITE_SPACE("\n") 7 | OPEN_BRACE("{") WHITE_SPACE(" ") CLOSE_BRACE("}") WHITE_SPACE(" ") OPEN_PAREN("(") WHITE_SPACE(" ") CLOSE_PAREN(")") WHITE_SPACE("\n") 8 | OPEN_BRACE("{") WHITE_SPACE("\n") 9 | CLOSE_BRACE("}") WHITE_SPACE("\n") 10 | OPEN_PAREN("(") WHITE_SPACE("\n") 11 | CLOSE_PAREN(")") 12 | WHITE_SPACE("\n \n\t\n\t \n\t \n\t \t\n \t\n \t\n\r\r") -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.smali: -------------------------------------------------------------------------------- 1 | Z 2 | B 3 | S 4 | C 5 | I 6 | J 7 | F 8 | D 9 | V 10 | 11 | Ljava/lang/String; 12 | LI; 13 | LV; 14 | LI/I/I; 15 | 16 | [Z 17 | [B 18 | [S 19 | [C 20 | [I 21 | [J 22 | [F 23 | [D 24 | [Ljava/lang/String; 25 | [LI/I/I; 26 | 27 | IIIII 28 | ZBSCIJFD 29 | ILa;[La;[I 30 | Ljava/lang/String;Ljava/lang/String; 31 | [I[I[I 32 | [I[Z 33 | [I[Ljava/lang/String; 34 | 35 | 36 | 37 | 38 | Ljava/lang/String 39 | L; 40 | LI 41 | L[Ljava/lang/String; 42 | 43 | [ 44 | [V 45 | [java/lang/String; 46 | [; 47 | 48 | -------------------------------------------------------------------------------- /brut.apktool.smali/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.tokens: -------------------------------------------------------------------------------- 1 | PRIMITIVE_TYPE("Z") 2 | PRIMITIVE_TYPE("B") 3 | PRIMITIVE_TYPE("S") 4 | PRIMITIVE_TYPE("C") 5 | PRIMITIVE_TYPE("I") 6 | PRIMITIVE_TYPE("J") 7 | PRIMITIVE_TYPE("F") 8 | PRIMITIVE_TYPE("D") 9 | VOID_TYPE("V") 10 | 11 | CLASS_DESCRIPTOR("Ljava/lang/String;") 12 | CLASS_DESCRIPTOR("LI;") 13 | CLASS_DESCRIPTOR("LV;") 14 | CLASS_DESCRIPTOR("LI/I/I;") 15 | 16 | ARRAY_DESCRIPTOR("[Z") 17 | ARRAY_DESCRIPTOR("[B") 18 | ARRAY_DESCRIPTOR("[S") 19 | ARRAY_DESCRIPTOR("[C") 20 | ARRAY_DESCRIPTOR("[I") 21 | ARRAY_DESCRIPTOR("[J") 22 | ARRAY_DESCRIPTOR("[F") 23 | ARRAY_DESCRIPTOR("[D") 24 | ARRAY_DESCRIPTOR("[Ljava/lang/String;") 25 | ARRAY_DESCRIPTOR("[LI/I/I;") 26 | 27 | PARAM_LIST_OR_ID("IIIII") 28 | PARAM_LIST_OR_ID("ZBSCIJFD") 29 | PARAM_LIST("ILa;[La;[I") 30 | PARAM_LIST("Ljava/lang/String;Ljava/lang/String;") 31 | PARAM_LIST("[I[I[I") 32 | PARAM_LIST("[I[Z") 33 | PARAM_LIST("[I[Ljava/lang/String;") 34 | 35 | METHOD_NAME("") 36 | METHOD_NAME("") 37 | 38 | SIMPLE_NAME("Ljava") INVALID_TOKEN("/") SIMPLE_NAME("lang") INVALID_TOKEN("/") SIMPLE_NAME("String") 39 | SIMPLE_NAME("L") INVALID_TOKEN(";") 40 | SIMPLE_NAME("LI") 41 | SIMPLE_NAME("L") ARRAY_DESCRIPTOR("[Ljava/lang/String;") 42 | 43 | INVALID_TOKEN("[") 44 | INVALID_TOKEN("[") VOID_TYPE("V") 45 | INVALID_TOKEN("[") SIMPLE_NAME("java") INVALID_TOKEN("/") SIMPLE_NAME("lang") INVALID_TOKEN("/") SIMPLE_NAME("String") INVALID_TOKEN(";") 46 | INVALID_TOKEN("[") INVALID_TOKEN(";") 47 | 48 | INVALID_TOKEN("<") SIMPLE_NAME("linit") INVALID_TOKEN(">") -------------------------------------------------------------------------------- /brut.apktool.smali/util/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /brut.apktool.smali/util/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Google Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Google Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | dependencies { 33 | compile 'commons-cli:commons-cli:1.2' 34 | testCompile 'junit:junit:4.6' 35 | } 36 | -------------------------------------------------------------------------------- /brut.apktool.smali/util/src/main/java/ds/tree/DuplicateKeyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2008 Tahseen Ur Rehman 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | package ds.tree; 26 | 27 | /** 28 | * excepion thrown if a duplicate key is inserted in a {@link RadixTree} 29 | * 30 | * @author Tahseen Ur Rehman 31 | * email: tahseen.ur.rehman {at.spam.me.not} gmail.com 32 | */ 33 | public class DuplicateKeyException extends RuntimeException 34 | { 35 | private static final long serialVersionUID = 3141795907493885706L; 36 | 37 | public DuplicateKeyException(String msg) 38 | { 39 | super(msg); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /brut.apktool.smali/util/src/main/java/ds/tree/Visitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2008 Tahseen Ur Rehman, Javid Jamae 5 | 6 | http://code.google.com/p/radixtree/ 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | */ 26 | 27 | package ds.tree; 28 | 29 | /** 30 | * The visitor interface that is used by {@link RadixTreeImpl} for perfroming 31 | * task on a searched node. 32 | * 33 | * @author Tahseen Ur Rehman (tahseen.ur.rehman {at.spam.me.not} gmail.com) 34 | * @author Javid Jamae 35 | * @author Dennis Heidsiek 36 | * @param 37 | */ 38 | public interface Visitor { 39 | /** 40 | * This method gets called by {@link RadixTreeImpl#visit(String, Visitor) visit} 41 | * when it finds a node matching the key given to it. 42 | * 43 | * @param key The key that matched the node 44 | * @param parent The parent of the node being visited 45 | * @param node The node that is being visited 46 | */ 47 | public void visit(String key, RadixTreeNode parent, RadixTreeNode node); 48 | 49 | /** 50 | * The visitor can store any type of result object, depending on the context of 51 | * what it is being used for. 52 | * 53 | * @return The result captured by the visitor. 54 | */ 55 | public R getResult(); 56 | } 57 | -------------------------------------------------------------------------------- /brut.apktool.smali/util/src/main/java/ds/tree/VisitorImpl.java: -------------------------------------------------------------------------------- 1 | package ds.tree; 2 | 3 | 4 | /** 5 | * A simple standard implementation for a {@link visitor}. 6 | * 7 | * @author Dennis Heidsiek 8 | * @param 9 | */ 10 | public abstract class VisitorImpl implements Visitor { 11 | 12 | protected R result; 13 | 14 | public VisitorImpl() { 15 | this.result = null; 16 | } 17 | 18 | public VisitorImpl(R initialValue) { 19 | this.result = initialValue; 20 | } 21 | 22 | public R getResult() { 23 | return result; 24 | } 25 | 26 | abstract public void visit(String key, RadixTreeNode parent, RadixTreeNode node); 27 | } -------------------------------------------------------------------------------- /brut.apktool.smali/util/src/main/java/org/jf/util/CommentingIndentingWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Google Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Google Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package org.jf.util; 33 | 34 | import java.io.IOException; 35 | import java.io.Writer; 36 | 37 | public class CommentingIndentingWriter extends IndentingWriter { 38 | private final String commentStr; 39 | 40 | public CommentingIndentingWriter(Writer writer, String commentStr) { 41 | super(writer); 42 | this.commentStr = commentStr; 43 | } 44 | 45 | protected void writeLineStart() throws IOException { 46 | writer.write(commentStr); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /brut.apktool.smali/util/src/main/java/org/jf/util/SmaliHelpFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * [The "BSD licence"] 3 | * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package org.jf.util; 30 | 31 | import org.apache.commons.cli.HelpFormatter; 32 | import org.apache.commons.cli.Options; 33 | 34 | import java.io.PrintWriter; 35 | 36 | public class SmaliHelpFormatter extends HelpFormatter { 37 | public void printHelp(String cmdLineSyntax, String header, Options options, Options debugOptions) { 38 | super.printHelp(cmdLineSyntax, header, options, ""); 39 | if (debugOptions != null) { 40 | System.out.println(); 41 | System.out.println("Debug Options:"); 42 | PrintWriter pw = new PrintWriter(System.out); 43 | super.printOptions(pw, getWidth(), debugOptions, getLeftPadding(), getDescPadding()); 44 | pw.flush(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /brut.apktool/NOTICE: -------------------------------------------------------------------------------- 1 | apktool 2 | Copyright 2011 Ryszard Wiśniewski 3 | 4 | This product includes software developed by: 5 | 6 | * Ryszard Wiśniewski (brut.alll@gmail.com) 7 | * JesusFreke (http://code.google.com/p/smali/) 8 | * Dmitry Skiba (http://code.google.com/p/android4me/) 9 | * Tahseen Ur Rehman (http://code.google.com/p/radixtree/) 10 | * Android Open Source Project (http://source.android.com/) 11 | * The Apache Software Foundation (http://www.apache.org/) 12 | -------------------------------------------------------------------------------- /brut.apktool/apktool-cli/build.gradle: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | version = apktoolversion 18 | apply plugin: 'fatjar' 19 | 20 | configurations { 21 | proguard 22 | } 23 | 24 | dependencies { 25 | compile project(':brut.apktool:apktool-lib') 26 | proguard 'net.sf.proguard:proguard-base:4.8' 27 | } 28 | 29 | gradle.taskGraph.whenReady { 30 | fatJar { 31 | manifest { 32 | attributes("Main-Class": "brut.apktool.Main") 33 | } 34 | } 35 | } 36 | 37 | task proguard(type: JavaExec, dependsOn: fatJar) { 38 | def outFile = jar.destinationDir.getPath() + '/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension 39 | inputs.file jar.archivePath 40 | outputs.file outFile 41 | 42 | classpath = configurations.proguard 43 | main = 'proguard.ProGuard' 44 | args '-injars ' + "${jar.archivePath}" + ' (!META-INF/LICENSE.txt,!META-INF/NOTICE.txt,!README)' 45 | args "-outjars ${outFile}" 46 | args "-libraryjars ${System.properties['java.home']}/lib/rt.jar" 47 | args '-dontobfuscate' 48 | args '-dontoptimize' 49 | args '-keep public class brut.apktool.Main { public static void main(java.lang.String[]); }' 50 | args '-keep class org.yaml.snakeyaml.** { public protected private *; }' 51 | args '-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }' 52 | args '-dontwarn com.google.common.base.**' 53 | args '-dontwarn com.google.common.collect.**' 54 | args '-dontwarn javax.xml.xpath.**' 55 | args '-dontnote **' 56 | } 57 | 58 | tasks.getByPath(':release').dependsOn(proguard) -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/build.gradle: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.apache.tools.ant.filters.* 18 | 19 | // kudos #smali - JesusFreke, for how to build release task 20 | if (!('release' in gradle.startParameter.taskNames)) { 21 | ant.loadfile(srcFile: "../../.git/refs/heads/master", property: fullrev, failonerror: false); 22 | if (ant.properties[fullrev] == null) { 23 | gitrev_version = "SNAPSHOT_DEV"; 24 | println "Building SNAPSHOT (no .git folder found)"; 25 | } else { 26 | gitrev_version = ant.properties[fullrev].substring(0,10); 27 | println "Building SNAPSHOT: " + gitrev_version; 28 | } 29 | } else { 30 | gitrev_version = ''; 31 | println "Building RELEASE: " + apktoolversion; 32 | } 33 | 34 | processResources { 35 | from('src/main/resources/properties') { 36 | include '**/*.properties' 37 | into 'properties' 38 | filter(ReplaceTokens, tokens: [version: apktoolversion, gitrev: gitrev_version] ) 39 | } 40 | from('src/main/resources/') { 41 | include '**/*.jar' 42 | } 43 | 44 | includeEmptyDirs = false 45 | } 46 | dependencies { 47 | compile ("junit:junit:4.10") { 48 | exclude(module: 'hamcrest-core') 49 | } 50 | compile project(':brut.j.dir'), 51 | project(':brut.j.util'), 52 | project(':brut.j.common'), 53 | project(':brut.apktool.smali:util'), 54 | project(':brut.apktool.smali:dexlib'), 55 | project(':brut.apktool.smali:baksmali'), 56 | project(':brut.apktool.smali:smali'), 57 | "org.yaml:snakeyaml:1.11", 58 | "net.sf.kxml:kxml2:2.3.0", 59 | "xpp3:xpp3:1.1.4c", 60 | "xmlunit:xmlunit:1.3", 61 | "com.google.guava:guava:12.0", 62 | "org.apache.commons:commons-lang3:3.1" 63 | } 64 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/android/content/res/XmlResourceParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.content.res; 18 | 19 | import org.xmlpull.v1.XmlPullParser; 20 | 21 | import android.util.AttributeSet; 22 | 23 | /** 24 | * The XML parsing interface returned for an XML resource. This is a standard 25 | * XmlPullParser interface, as well as an extended AttributeSet interface and an 26 | * additional close() method on this interface for the client to indicate when 27 | * it is done reading the resource. 28 | */ 29 | public interface XmlResourceParser extends XmlPullParser, AttributeSet { 30 | /** 31 | * Close this interface to the resource. Calls on the interface are no 32 | * longer value after this call. 33 | */ 34 | public void close(); 35 | } 36 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/AndrolibException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib; 18 | 19 | import brut.common.BrutException; 20 | 21 | /** 22 | * @author Ryszard Wiśniewski 23 | */ 24 | public class AndrolibException extends BrutException { 25 | public AndrolibException() { 26 | } 27 | 28 | public AndrolibException(String message) { 29 | super(message); 30 | } 31 | 32 | public AndrolibException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | 36 | public AndrolibException(Throwable cause) { 37 | super(cause); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFind9PatchChunk.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.err; 18 | 19 | import brut.androlib.AndrolibException; 20 | 21 | /** 22 | * @author Ryszard Wiśniewski 23 | */ 24 | public class CantFind9PatchChunk extends AndrolibException { 25 | 26 | public CantFind9PatchChunk(Throwable cause) { 27 | super(cause); 28 | } 29 | 30 | public CantFind9PatchChunk(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | public CantFind9PatchChunk(String message) { 35 | super(message); 36 | } 37 | 38 | public CantFind9PatchChunk() { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFindFrameworkResException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.err; 18 | 19 | import brut.androlib.AndrolibException; 20 | 21 | /** 22 | * @author Ryszard Wiśniewski 23 | */ 24 | public class CantFindFrameworkResException extends AndrolibException { 25 | 26 | public CantFindFrameworkResException(Throwable cause, int id) { 27 | super(cause); 28 | mPkgId = id; 29 | } 30 | 31 | public CantFindFrameworkResException(int id) { 32 | mPkgId = id; 33 | } 34 | 35 | public int getPkgId() { 36 | return mPkgId; 37 | } 38 | 39 | private final int mPkgId; 40 | } 41 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/err/InFileNotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.err; 18 | 19 | import brut.androlib.AndrolibException; 20 | 21 | /** 22 | * @author Ryszard Wiśniewski 23 | */ 24 | public class InFileNotFoundException extends AndrolibException { 25 | 26 | public InFileNotFoundException(Throwable cause) { 27 | super(cause); 28 | } 29 | 30 | public InFileNotFoundException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | public InFileNotFoundException(String message) { 35 | super(message); 36 | } 37 | 38 | public InFileNotFoundException() { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/err/OutDirExistsException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.err; 18 | 19 | import brut.androlib.AndrolibException; 20 | 21 | /** 22 | * @author Ryszard Wiśniewski 23 | */ 24 | public class OutDirExistsException extends AndrolibException { 25 | 26 | public OutDirExistsException(Throwable cause) { 27 | super(cause); 28 | } 29 | 30 | public OutDirExistsException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | public OutDirExistsException(String message) { 35 | super(message); 36 | } 37 | 38 | public OutDirExistsException() { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/err/UndefinedResObject.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.err; 18 | 19 | import brut.androlib.AndrolibException; 20 | 21 | /** 22 | * @author Ryszard Wiśniewski 23 | */ 24 | public class UndefinedResObject extends AndrolibException { 25 | public UndefinedResObject(Throwable cause) { 26 | super(cause); 27 | } 28 | 29 | public UndefinedResObject(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | 33 | public UndefinedResObject(String message) { 34 | super(message); 35 | } 36 | 37 | public UndefinedResObject() { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/java/AndrolibJava.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.java; 18 | 19 | import brut.androlib.res.util.ExtFile; 20 | import java.io.File; 21 | 22 | /** 23 | * @author Ryszard Wiśniewski 24 | */ 25 | public class AndrolibJava { 26 | 27 | public void decode(ExtFile apkFile, File outDir) { 28 | throw new UnsupportedOperationException("Not yet implemented"); 29 | } 30 | 31 | public void build(File javaDir, File dex) { 32 | throw new UnsupportedOperationException("Not yet implemented"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/mod/IndentingWriter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.mod; 18 | 19 | import java.io.Writer; 20 | 21 | /** 22 | * @author Ryszard Wiśniewski 23 | */ 24 | public class IndentingWriter extends org.jf.util.IndentingWriter { 25 | 26 | public IndentingWriter(Writer writer) { 27 | super(writer); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data; 18 | 19 | import brut.androlib.AndrolibException; 20 | import brut.androlib.err.UndefinedResObject; 21 | import java.util.*; 22 | 23 | /** 24 | * @author Ryszard Wiśniewski 25 | */ 26 | public class ResConfig { 27 | private final ResConfigFlags mFlags; 28 | private final Map mResources = new LinkedHashMap(); 29 | 30 | public ResConfig(ResConfigFlags flags) { 31 | this.mFlags = flags; 32 | } 33 | 34 | public Set listResources() { 35 | return new LinkedHashSet(mResources.values()); 36 | } 37 | 38 | public ResResource getResource(ResResSpec spec) throws AndrolibException { 39 | ResResource res = mResources.get(spec); 40 | if (res == null) { 41 | throw new UndefinedResObject(String.format( 42 | "resource: spec=%s, config=%s", spec, this)); 43 | } 44 | return res; 45 | } 46 | 47 | public Set listResSpecs() { 48 | return mResources.keySet(); 49 | } 50 | 51 | public ResConfigFlags getFlags() { 52 | return mFlags; 53 | } 54 | 55 | public void addResource(ResResource res) throws AndrolibException { 56 | addResource(res, false); 57 | } 58 | 59 | public void addResource(ResResource res, boolean overwrite) 60 | throws AndrolibException { 61 | ResResSpec spec = res.getResSpec(); 62 | if (mResources.put(spec, res) != null && !overwrite) { 63 | throw new AndrolibException(String.format( 64 | "Multiple resources: spec=%s, config=%s", spec, this)); 65 | } 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return mFlags.toString(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResID.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data; 18 | 19 | /** 20 | * @author Ryszard Wiśniewski 21 | */ 22 | public class ResID { 23 | public final int package_; 24 | public final int type; 25 | public final int entry; 26 | 27 | public final int id; 28 | 29 | public ResID(int package_, int type, int entry) { 30 | this(package_, type, entry, (package_ << 24) + (type << 16) + entry); 31 | } 32 | 33 | public ResID(int id) { 34 | this(id >> 24, (id >> 16) & 0x000000ff, id & 0x0000ffff, id); 35 | } 36 | 37 | public ResID(int package_, int type, int entry, int id) { 38 | this.package_ = package_; 39 | this.type = type; 40 | this.entry = entry; 41 | this.id = id; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return String.format("0x%08x", id); 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | int hash = 17; 52 | hash = 31 * hash + this.id; 53 | return hash; 54 | } 55 | 56 | @Override 57 | public boolean equals(Object obj) { 58 | if (obj == null) { 59 | return false; 60 | } 61 | if (getClass() != obj.getClass()) { 62 | return false; 63 | } 64 | final ResID other = (ResID) obj; 65 | if (this.id != other.id) { 66 | return false; 67 | } 68 | return true; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data; 18 | 19 | import brut.androlib.AndrolibException; 20 | import brut.androlib.res.data.value.ResValue; 21 | 22 | /** 23 | * @author Ryszard Wiśniewski 24 | */ 25 | public class ResResource { 26 | private final ResConfig mConfig; 27 | private final ResResSpec mResSpec; 28 | private final ResValue mValue; 29 | 30 | public ResResource(ResConfig config, ResResSpec spec, ResValue value) { 31 | this.mConfig = config; 32 | this.mResSpec = spec; 33 | this.mValue = value; 34 | } 35 | 36 | public String getFilePath() { 37 | return mResSpec.getType().getName() 38 | + mConfig.getFlags().getQualifiers() + "/" + mResSpec.getName(); 39 | } 40 | 41 | public ResConfig getConfig() { 42 | return mConfig; 43 | } 44 | 45 | public ResResSpec getResSpec() { 46 | return mResSpec; 47 | } 48 | 49 | public ResValue getValue() { 50 | return mValue; 51 | } 52 | 53 | public void replace(ResValue value) throws AndrolibException { 54 | ResResource res = new ResResource(mConfig, mResSpec, value); 55 | mConfig.addResource(res, true); 56 | mResSpec.addResource(res, true); 57 | } 58 | 59 | @Override 60 | public String toString() { 61 | return getFilePath(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data; 18 | 19 | import brut.androlib.AndrolibException; 20 | import brut.androlib.err.UndefinedResObject; 21 | import java.util.*; 22 | 23 | /** 24 | * @author Ryszard Wiśniewski 25 | */ 26 | public final class ResType { 27 | private final String mName; 28 | private final Map mResSpecs = new LinkedHashMap(); 29 | 30 | private final ResTable mResTable; 31 | private final ResPackage mPackage; 32 | 33 | public ResType(String name, ResTable resTable, ResPackage package_) { 34 | this.mName = name; 35 | this.mResTable = resTable; 36 | this.mPackage = package_; 37 | } 38 | 39 | public String getName() { 40 | return mName; 41 | } 42 | 43 | public Set listResSpecs() { 44 | return new LinkedHashSet(mResSpecs.values()); 45 | } 46 | 47 | public ResResSpec getResSpec(String name) throws AndrolibException { 48 | ResResSpec spec = mResSpecs.get(name); 49 | if (spec == null) { 50 | throw new UndefinedResObject(String.format("resource spec: %s/%s", 51 | getName(), name)); 52 | } 53 | return spec; 54 | } 55 | 56 | public void addResSpec(ResResSpec spec) throws AndrolibException { 57 | if (mResSpecs.put(spec.getName(), spec) != null) { 58 | throw new AndrolibException(String.format( 59 | "Multiple res specs: %s/%s", getName(), spec.getName())); 60 | } 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return mName; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBagValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | import brut.androlib.AndrolibException; 20 | import brut.androlib.res.data.ResResource; 21 | import brut.androlib.res.xml.ResValuesXmlSerializable; 22 | import brut.util.Duo; 23 | import java.io.IOException; 24 | import org.xmlpull.v1.XmlSerializer; 25 | 26 | /** 27 | * @author Ryszard Wiśniewski 28 | */ 29 | public class ResBagValue extends ResValue implements ResValuesXmlSerializable { 30 | protected final ResReferenceValue mParent; 31 | 32 | public ResBagValue(ResReferenceValue parent) { 33 | this.mParent = parent; 34 | } 35 | 36 | @Override 37 | public void serializeToResValuesXml(XmlSerializer serializer, 38 | ResResource res) throws IOException, AndrolibException { 39 | String type = res.getResSpec().getType().getName(); 40 | if ("style".equals(type)) { 41 | new ResStyleValue(mParent, new Duo[0], null) 42 | .serializeToResValuesXml(serializer, res); 43 | return; 44 | } 45 | if ("array".equals(type)) { 46 | new ResArrayValue(mParent, new Duo[0]).serializeToResValuesXml( 47 | serializer, res); 48 | return; 49 | } 50 | if ("plurals".equals(type)) { 51 | new ResPluralsValue(mParent, new Duo[0]).serializeToResValuesXml( 52 | serializer, res); 53 | return; 54 | } 55 | 56 | serializer.startTag(null, "item"); 57 | serializer.attribute(null, "type", type); 58 | serializer.attribute(null, "name", res.getResSpec().getName()); 59 | serializer.endTag(null, "item"); 60 | } 61 | 62 | public ResReferenceValue getParent() { 63 | return mParent; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBoolValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | /** 20 | * @author Ryszard Wiśniewski 21 | */ 22 | public class ResBoolValue extends ResScalarValue { 23 | private final boolean mValue; 24 | 25 | public ResBoolValue(boolean value, String rawValue) { 26 | super("bool", rawValue); 27 | this.mValue = value; 28 | } 29 | 30 | public boolean getValue() { 31 | return mValue; 32 | } 33 | 34 | @Override 35 | protected String encodeAsResXml() { 36 | return mValue ? "true" : "false"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResColorValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | /** 20 | * @author Ryszard Wiśniewski 21 | */ 22 | public class ResColorValue extends ResIntValue { 23 | public ResColorValue(int value, String rawValue) { 24 | super(value, rawValue, "color"); 25 | } 26 | 27 | @Override 28 | protected String encodeAsResXml() { 29 | return String.format("#%08x", mValue); 30 | } 31 | } -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResDimenValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | import android.util.TypedValue; 20 | import brut.androlib.AndrolibException; 21 | 22 | /** 23 | * @author Ryszard Wiśniewski 24 | */ 25 | public class ResDimenValue extends ResIntValue { 26 | public ResDimenValue(int value, String rawValue) { 27 | super(value, rawValue, "dimen"); 28 | } 29 | 30 | @Override 31 | protected String encodeAsResXml() throws AndrolibException { 32 | return TypedValue.coerceToString(TypedValue.TYPE_DIMENSION, mValue); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFileValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | import brut.androlib.AndrolibException; 20 | 21 | /** 22 | * @author Ryszard Wiśniewski 23 | */ 24 | public class ResFileValue extends ResValue { 25 | private final String mPath; 26 | 27 | public ResFileValue(String path) { 28 | this.mPath = path; 29 | } 30 | 31 | public String getPath() { 32 | return mPath; 33 | } 34 | 35 | public String getStrippedPath() throws AndrolibException { 36 | if (!mPath.startsWith("res/")) { 37 | throw new AndrolibException( 38 | "File path does not start with \"res/\": " + mPath); 39 | } 40 | return mPath.substring(4); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFloatValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | /** 20 | * @author Ryszard Wiśniewski 21 | */ 22 | public class ResFloatValue extends ResScalarValue { 23 | private final float mValue; 24 | 25 | public ResFloatValue(float value, String rawValue) { 26 | super("float", rawValue); 27 | this.mValue = value; 28 | } 29 | 30 | public float getValue() { 31 | return mValue; 32 | } 33 | 34 | @Override 35 | protected String encodeAsResXml() { 36 | return String.valueOf(mValue); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFractionValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | import android.util.TypedValue; 20 | import brut.androlib.AndrolibException; 21 | 22 | /** 23 | * @author Ryszard Wiśniewski 24 | */ 25 | public class ResFractionValue extends ResIntValue { 26 | public ResFractionValue(int value, String rawValue) { 27 | super(value, rawValue, "fraction"); 28 | } 29 | 30 | @Override 31 | protected String encodeAsResXml() throws AndrolibException { 32 | return TypedValue.coerceToString(TypedValue.TYPE_FRACTION, mValue); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIdValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | import brut.androlib.AndrolibException; 20 | import brut.androlib.res.data.ResResource; 21 | import brut.androlib.res.xml.ResValuesXmlSerializable; 22 | import java.io.IOException; 23 | import org.xmlpull.v1.XmlSerializer; 24 | 25 | /** 26 | * @author Ryszard Wiśniewski 27 | */ 28 | public class ResIdValue extends ResValue implements ResValuesXmlSerializable { 29 | @Override 30 | public void serializeToResValuesXml(XmlSerializer serializer, 31 | ResResource res) throws IOException, AndrolibException { 32 | serializer.startTag(null, "item"); 33 | serializer 34 | .attribute(null, "type", res.getResSpec().getType().getName()); 35 | serializer.attribute(null, "name", res.getResSpec().getName()); 36 | serializer.endTag(null, "item"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIntValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | import android.util.TypedValue; 20 | import brut.androlib.AndrolibException; 21 | 22 | /** 23 | * @author Ryszard Wiśniewski 24 | */ 25 | public class ResIntValue extends ResScalarValue { 26 | protected final int mValue; 27 | private int type; 28 | 29 | public ResIntValue(int value, String rawValue, int type) { 30 | this(value, rawValue, "integer"); 31 | this.type = type; 32 | } 33 | 34 | public ResIntValue(int value, String rawValue, String type) { 35 | super(type, rawValue); 36 | this.mValue = value; 37 | } 38 | 39 | public int getValue() { 40 | return mValue; 41 | } 42 | 43 | @Override 44 | protected String encodeAsResXml() throws AndrolibException { 45 | return TypedValue.coerceToString(type, mValue); 46 | } 47 | } -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResReferenceValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | import brut.androlib.AndrolibException; 20 | import brut.androlib.res.data.ResPackage; 21 | import brut.androlib.res.data.ResResSpec; 22 | 23 | /** 24 | * @author Ryszard Wiśniewski 25 | */ 26 | public class ResReferenceValue extends ResIntValue { 27 | private final ResPackage mPackage; 28 | private final boolean mTheme; 29 | 30 | public ResReferenceValue(ResPackage package_, int value, String rawValue) { 31 | this(package_, value, rawValue, false); 32 | } 33 | 34 | public ResReferenceValue(ResPackage package_, int value, String rawValue, 35 | boolean theme) { 36 | super(value, rawValue, "reference"); 37 | mPackage = package_; 38 | mTheme = theme; 39 | } 40 | 41 | @Override 42 | protected String encodeAsResXml() throws AndrolibException { 43 | if (isNull()) { 44 | return "@null"; 45 | } 46 | 47 | ResResSpec spec = getReferent(); 48 | boolean newId = spec.hasDefaultResource() 49 | && spec.getDefaultResource().getValue() instanceof ResIdValue; 50 | 51 | // generate the beginning to fix @android 52 | String mStart = (mTheme ? '?' : '@') + (newId ? "+" : ""); 53 | // mStart = mStart.replace("@android", "@*android"); 54 | 55 | return mStart 56 | + spec.getFullName(mPackage, mTheme 57 | && spec.getType().getName().equals("attr")); 58 | } 59 | 60 | public ResResSpec getReferent() throws AndrolibException { 61 | return mPackage.getResTable().getResSpec(getValue()); 62 | } 63 | 64 | public boolean isNull() { 65 | return mValue == 0; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStringValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | import brut.androlib.AndrolibException; 20 | import brut.androlib.res.data.ResResource; 21 | import brut.androlib.res.xml.ResXmlEncoders; 22 | import java.io.IOException; 23 | import org.xmlpull.v1.XmlSerializer; 24 | 25 | /** 26 | * @author Ryszard Wiśniewski 27 | */ 28 | public class ResStringValue extends ResScalarValue { 29 | 30 | public ResStringValue(String value) { 31 | this(value, "string"); 32 | } 33 | 34 | public ResStringValue(String value, String type) { 35 | super(type, value); 36 | } 37 | 38 | @Override 39 | public String encodeAsResXmlAttr() { 40 | return ResXmlEncoders.encodeAsResXmlAttr(mRawValue); 41 | } 42 | 43 | @Override 44 | public String encodeAsResXmlItemValue() { 45 | return ResXmlEncoders 46 | .enumerateNonPositionalSubstitutions(ResXmlEncoders 47 | .encodeAsXmlValue(mRawValue)); 48 | } 49 | 50 | @Override 51 | public String encodeAsResXmlValue() { 52 | return ResXmlEncoders.encodeAsXmlValue(mRawValue); 53 | } 54 | 55 | @Override 56 | protected String encodeAsResXml() throws AndrolibException { 57 | throw new UnsupportedOperationException(); 58 | } 59 | 60 | @Override 61 | protected void serializeExtraXmlAttrs(XmlSerializer serializer, 62 | ResResource res) throws IOException { 63 | if (ResXmlEncoders.hasMultipleNonPositionalSubstitutions(mRawValue)) { 64 | serializer.attribute(null, "formatted", "false"); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.data.value; 18 | 19 | /** 20 | * @author Ryszard Wiśniewski 21 | */ 22 | public class ResValue { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResAttrDecoder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.decoder; 18 | 19 | import brut.androlib.AndrolibException; 20 | import brut.androlib.res.data.ResPackage; 21 | import brut.androlib.res.data.value.ResAttr; 22 | import brut.androlib.res.data.value.ResScalarValue; 23 | 24 | /** 25 | * @author Ryszard Wiśniewski 26 | */ 27 | public class ResAttrDecoder { 28 | public String decode(int type, int value, String rawValue, int attrResId) 29 | throws AndrolibException { 30 | ResScalarValue resValue = mCurrentPackage.getValueFactory().factory( 31 | type, value, rawValue); 32 | 33 | String decoded = null; 34 | if (attrResId != 0) { 35 | ResAttr attr = (ResAttr) getCurrentPackage().getResTable() 36 | .getResSpec(attrResId).getDefaultResource().getValue(); 37 | decoded = attr.convertToResXmlFormat(resValue); 38 | } 39 | 40 | return decoded != null ? decoded : resValue.encodeAsResXmlAttr(); 41 | } 42 | 43 | public ResPackage getCurrentPackage() throws AndrolibException { 44 | if (mCurrentPackage == null) { 45 | throw new AndrolibException("Current package not set"); 46 | } 47 | return mCurrentPackage; 48 | } 49 | 50 | public void setCurrentPackage(ResPackage currentPackage) { 51 | mCurrentPackage = currentPackage; 52 | } 53 | 54 | private ResPackage mCurrentPackage; 55 | } 56 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResRawStreamDecoder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.decoder; 18 | 19 | import brut.androlib.AndrolibException; 20 | import java.io.IOException; 21 | import java.io.InputStream; 22 | import java.io.OutputStream; 23 | import org.apache.commons.io.IOUtils; 24 | 25 | /** 26 | * @author Ryszard Wiśniewski 27 | */ 28 | public class ResRawStreamDecoder implements ResStreamDecoder { 29 | @Override 30 | public void decode(InputStream in, OutputStream out) 31 | throws AndrolibException { 32 | try { 33 | IOUtils.copy(in, out); 34 | } catch (IOException ex) { 35 | throw new AndrolibException("Could not decode raw stream", ex); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.decoder; 18 | 19 | import brut.androlib.AndrolibException; 20 | import java.io.InputStream; 21 | import java.io.OutputStream; 22 | 23 | /** 24 | * @author Ryszard Wiśniewski 25 | */ 26 | public interface ResStreamDecoder { 27 | public void decode(InputStream in, OutputStream out) 28 | throws AndrolibException; 29 | } 30 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoderContainer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.decoder; 18 | 19 | import brut.androlib.AndrolibException; 20 | import java.io.InputStream; 21 | import java.io.OutputStream; 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | /** 26 | * @author Ryszard Wiśniewski 27 | */ 28 | public class ResStreamDecoderContainer { 29 | private final Map mDecoders = new HashMap(); 30 | 31 | public void decode(InputStream in, OutputStream out, String decoderName) 32 | throws AndrolibException { 33 | getDecoder(decoderName).decode(in, out); 34 | } 35 | 36 | public ResStreamDecoder getDecoder(String name) throws AndrolibException { 37 | ResStreamDecoder decoder = mDecoders.get(name); 38 | if (decoder == null) { 39 | throw new AndrolibException("Undefined decoder: " + name); 40 | } 41 | return decoder; 42 | } 43 | 44 | public void setDecoder(String name, ResStreamDecoder decoder) { 45 | mDecoders.put(name, decoder); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtFile.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.util; 18 | 19 | import brut.directory.Directory; 20 | import brut.directory.DirectoryException; 21 | import brut.directory.FileDirectory; 22 | import brut.directory.ZipRODirectory; 23 | import java.io.File; 24 | import java.net.URI; 25 | 26 | /** 27 | * @author Ryszard Wiśniewski 28 | */ 29 | public class ExtFile extends File { 30 | public ExtFile(File file) { 31 | super(file.getPath()); 32 | } 33 | 34 | public ExtFile(URI uri) { 35 | super(uri); 36 | } 37 | 38 | public ExtFile(File parent, String child) { 39 | super(parent, child); 40 | } 41 | 42 | public ExtFile(String parent, String child) { 43 | super(parent, child); 44 | } 45 | 46 | public ExtFile(String pathname) { 47 | super(pathname); 48 | } 49 | 50 | public Directory getDirectory() throws DirectoryException { 51 | if (mDirectory == null) { 52 | if (isDirectory()) { 53 | mDirectory = new FileDirectory(this); 54 | } else { 55 | mDirectory = new ZipRODirectory(this); 56 | } 57 | } 58 | return mDirectory; 59 | } 60 | 61 | private Directory mDirectory; 62 | } 63 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtXmlSerializer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.util; 18 | 19 | import java.io.IOException; 20 | import org.xmlpull.v1.XmlSerializer; 21 | 22 | /** 23 | * @author Ryszard Wiśniewski 24 | */ 25 | public interface ExtXmlSerializer extends XmlSerializer { 26 | 27 | public ExtXmlSerializer newLine() throws IOException; 28 | 29 | public void setDisabledAttrEscape(boolean disabled); 30 | 31 | public static final String PROPERTY_SERIALIZER_INDENTATION = "http://xmlpull.org/v1/doc/properties.html#serializer-indentation"; 32 | public static final String PROPERTY_SERIALIZER_LINE_SEPARATOR = "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator"; 33 | public static final String PROPERTY_DEFAULT_ENCODING = "DEFAULT_ENCODING"; 34 | } 35 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResValuesXmlSerializable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.xml; 18 | 19 | import brut.androlib.AndrolibException; 20 | import brut.androlib.res.data.ResResource; 21 | import java.io.IOException; 22 | import org.xmlpull.v1.XmlSerializer; 23 | 24 | /** 25 | * @author Ryszard Wiśniewski 26 | */ 27 | public interface ResValuesXmlSerializable { 28 | public void serializeToResValuesXml(XmlSerializer serializer, 29 | ResResource res) throws IOException, AndrolibException; 30 | } 31 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncodable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.res.xml; 18 | 19 | import brut.androlib.AndrolibException; 20 | 21 | /** 22 | * @author Ryszard Wiśniewski 23 | */ 24 | public interface ResXmlEncodable { 25 | public String encodeAsResXmlAttr() throws AndrolibException; 26 | 27 | public String encodeAsResXmlValue() throws AndrolibException; 28 | } 29 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/java/brut/androlib/src/SmaliDecoder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.androlib.src; 18 | 19 | import brut.androlib.AndrolibException; 20 | import java.io.File; 21 | import java.io.IOException; 22 | import org.jf.baksmali.baksmali; 23 | import org.jf.dexlib.DexFile; 24 | 25 | /** 26 | * @author Ryszard Wiśniewski 27 | */ 28 | public class SmaliDecoder { 29 | 30 | public static void decode(File apkFile, File outDir, boolean debug, 31 | boolean bakdeb) throws AndrolibException { 32 | new SmaliDecoder(apkFile, outDir, debug, bakdeb).decode(); 33 | } 34 | 35 | private SmaliDecoder(File apkFile, File outDir, boolean debug, 36 | boolean bakdeb) { 37 | mApkFile = apkFile; 38 | mOutDir = outDir; 39 | mDebug = debug; 40 | mBakDeb = bakdeb; 41 | } 42 | 43 | private void decode() throws AndrolibException { 44 | try { 45 | baksmali.disassembleDexFile(mApkFile.getAbsolutePath(), 46 | new DexFile(mApkFile), false, mOutDir.getAbsolutePath(), 47 | null, null, null, false, true, true, mBakDeb, false, false, 48 | 0, false, false, null, false); 49 | } catch (IOException ex) { 50 | throw new AndrolibException(ex); 51 | } 52 | } 53 | 54 | private final File mApkFile; 55 | private final File mOutDir; 56 | private final boolean mDebug; 57 | private final boolean mBakDeb; 58 | } 59 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/resources/brut/androlib/android-framework.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/broo2s/brut.apktool/2c5f176a94c17b459d8f04ed07435dc7812ce3ee/brut.apktool/apktool-lib/src/main/resources/brut/androlib/android-framework.jar -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/main/resources/properties/apktool.properties: -------------------------------------------------------------------------------- 1 | application.version=@version@ 2 | git.commit.id.abbrev=@gitrev@ 3 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/apktool.yml: -------------------------------------------------------------------------------- 1 | version: 1.5.0 2 | apkFileName: testapp.apk 3 | isFrameworkApk: false 4 | usesFramework: 5 | ids: 6 | - 1 7 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TEST1 5 | TEST2 6 | TEST3 7 | %2$s foo %1$d 8 | 9 | 10 | -1 11 | 0 12 | 1 13 | 14 | 15 | 16 | true 17 | TEST 18 | 5 19 | 5.5 20 | 10.0sp 21 | #ff123456 22 | 23 | 24 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | true 5 | 6 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ff123456 4 | 5 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10.0dip 4 | 10.0sp 5 | 10.0pt 6 | 10.0px 7 | 10.0mm 8 | 10.0in 9 | 10 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -1 4 | 0 5 | 1 6 | 7 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lorem ipsum... 5 | \@ 6 | \? 7 | \#ff123456 8 | & 9 | "'" 10 | \" 11 | \u0005 12 | " foo bar " 13 | "foo 14 | bar" 15 | " foo"bar baz foo 16 | foobarbaz 17 | foobar"b 18 | az"foo 19 | %d of %d 20 | foo %d bar % 21 | %2$s foo %1$d 22 | %-e foo %,d 23 | %2$-e foo %1$,d 24 | %02d foo %01d 25 | %d foo %1 26 | %1% foo %2% 27 | 28 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc002/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @string/test_string1 5 | @string/test_string2 6 | 7 | 8 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc002/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @string/test1 4 | @*android:string/ok 5 | ?android:textStyle 6 | 7 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc003/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | TEST 4 | 5 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc003/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | TEST 4 | 5 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc003/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | 5 5 | 6 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc004-mnc4-en-rUS-ldrtl-sw100dp-w200dp-h300dp-xlarge-long-land-desk-night-xhdpi-finger-keyssoft-12key-navhidden-dpad/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/literals.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/references.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /brut.apktool/src/templates/apache2.0-header.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011 Ryszard Wiśniewski 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /brut.j.common/.gitignore: -------------------------------------------------------------------------------- 1 | /nbproject 2 | /build 3 | /dist 4 | /build.xml 5 | /target 6 | 7 | -------------------------------------------------------------------------------- /brut.j.common/NOTICE: -------------------------------------------------------------------------------- 1 | Brut Java commons 2 | Copyright 2010 Ryszard Wiśniewski 3 | 4 | This product includes software developed by: 5 | 6 | * Ryszard Wiśniewski (brut.alll@gmail.com) 7 | -------------------------------------------------------------------------------- /brut.j.common/build.gradle: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | dependencies { 18 | testCompile 'junit:junit:4.8.2' 19 | } 20 | 21 | -------------------------------------------------------------------------------- /brut.j.common/src/main/java/brut/common/BrutException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.common; 18 | 19 | /** 20 | * @author Ryszard Wiśniewski 21 | */ 22 | public class BrutException extends Exception { 23 | public BrutException(Throwable cause) { 24 | super(cause); 25 | } 26 | 27 | public BrutException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public BrutException(String message) { 32 | super(message); 33 | } 34 | 35 | public BrutException() { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /brut.j.common/src/templates/apache2.0-header.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010 Ryszard Wiśniewski 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /brut.j.dir/.gitignore: -------------------------------------------------------------------------------- 1 | /nbproject 2 | /build 3 | /dist 4 | /build.xml 5 | /target 6 | 7 | -------------------------------------------------------------------------------- /brut.j.dir/NOTICE: -------------------------------------------------------------------------------- 1 | Brut Directories 2 | Copyright 2010 Ryszard Wiśniewski 3 | 4 | This product includes software developed by: 5 | 6 | * Ryszard Wiśniewski (brut.alll@gmail.com) 7 | * The Apache Software Foundation (http://www.apache.org/) 8 | -------------------------------------------------------------------------------- /brut.j.dir/build.gradle: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | dependencies { 18 | compile project(':brut.j.common'), 19 | project(':brut.j.util') 20 | testCompile "junit:junit:3.8.1" 21 | } 22 | -------------------------------------------------------------------------------- /brut.j.dir/src/main/java/brut/directory/Directory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.directory; 18 | 19 | import java.io.*; 20 | import java.util.Map; 21 | import java.util.Set; 22 | 23 | public interface Directory { 24 | public Set getFiles(); 25 | public Set getFiles(boolean recursive); 26 | public Map getDirs(); 27 | public Map getDirs(boolean recursive); 28 | 29 | public boolean containsFile(String path); 30 | public boolean containsDir(String path); 31 | 32 | public InputStream getFileInput(String path) throws DirectoryException; 33 | public OutputStream getFileOutput(String path) throws DirectoryException; 34 | public Directory getDir(String path) throws PathNotExist; 35 | public Directory createDir(String path) throws DirectoryException; 36 | 37 | public boolean removeFile(String path); 38 | 39 | public void copyToDir(Directory out) throws DirectoryException; 40 | public void copyToDir(Directory out, String[] fileNames) 41 | throws DirectoryException; 42 | public void copyToDir(Directory out, String fileName) 43 | throws DirectoryException; 44 | public void copyToDir(File out) throws DirectoryException; 45 | public void copyToDir(File out, String[] fileNames) 46 | throws DirectoryException; 47 | public void copyToDir(File out, String fileName) 48 | throws DirectoryException; 49 | 50 | public final char separator = '/'; 51 | } 52 | -------------------------------------------------------------------------------- /brut.j.dir/src/main/java/brut/directory/DirectoryException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.directory; 18 | 19 | import brut.common.BrutException; 20 | 21 | public class DirectoryException extends BrutException { 22 | private static final long serialVersionUID = -8871963042836625387L; 23 | 24 | public DirectoryException(String detailMessage, Throwable throwable) { 25 | super(detailMessage, throwable); 26 | } 27 | 28 | public DirectoryException(String detailMessage) { 29 | super(detailMessage); 30 | } 31 | 32 | public DirectoryException(Throwable throwable) { 33 | super(throwable); 34 | } 35 | 36 | public DirectoryException() { 37 | super(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /brut.j.dir/src/main/java/brut/directory/PathAlreadyExists.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.directory; 18 | 19 | public class PathAlreadyExists extends DirectoryException { 20 | public PathAlreadyExists() { 21 | } 22 | 23 | public PathAlreadyExists(Throwable throwable) { 24 | super(throwable); 25 | } 26 | 27 | public PathAlreadyExists(String detailMessage) { 28 | super(detailMessage); 29 | } 30 | 31 | public PathAlreadyExists(String detailMessage, Throwable throwable) { 32 | super(detailMessage, throwable); 33 | } 34 | 35 | private static final long serialVersionUID = 3776428251424428904L; 36 | } 37 | -------------------------------------------------------------------------------- /brut.j.dir/src/main/java/brut/directory/PathNotExist.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.directory; 18 | 19 | public class PathNotExist extends DirectoryException { 20 | public PathNotExist() { 21 | super(); 22 | } 23 | 24 | public PathNotExist(String detailMessage, Throwable throwable) { 25 | super(detailMessage, throwable); 26 | } 27 | 28 | public PathNotExist(String detailMessage) { 29 | super(detailMessage); 30 | } 31 | 32 | public PathNotExist(Throwable throwable) { 33 | super(throwable); 34 | } 35 | 36 | private static final long serialVersionUID = -6949242015506342032L; 37 | } 38 | -------------------------------------------------------------------------------- /brut.j.dir/src/templates/apache2.0-header.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010 Ryszard Wiśniewski 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /brut.j.util/.gitignore: -------------------------------------------------------------------------------- 1 | /nbproject 2 | /build 3 | /dist 4 | /build.xml 5 | /target 6 | 7 | -------------------------------------------------------------------------------- /brut.j.util/NOTICE: -------------------------------------------------------------------------------- 1 | Brut Java utils 2 | Copyright 2010 Ryszard Wiśniewski 3 | 4 | This product includes software developed by: 5 | 6 | * Ryszard Wiśniewski (brut.alll@gmail.com) 7 | * The Apache Software Foundation (http://www.apache.org/) 8 | -------------------------------------------------------------------------------- /brut.j.util/build.gradle: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | dependencies { 18 | compile project(':brut.j.common'), "commons-io:commons-io:2.4" 19 | testCompile "junit:junit:3.8.1" 20 | } 21 | -------------------------------------------------------------------------------- /brut.j.util/src/main/java/brut/util/BrutIO.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.util; 18 | 19 | import java.io.*; 20 | import org.apache.commons.io.IOUtils; 21 | 22 | /** 23 | * @author Ryszard Wiśniewski 24 | */ 25 | public class BrutIO { 26 | public static void copyAndClose(InputStream in, OutputStream out) 27 | throws IOException { 28 | try { 29 | IOUtils.copy(in, out); 30 | } finally { 31 | try { 32 | in.close(); 33 | out.close(); 34 | } catch (IOException ex) {} 35 | } 36 | } 37 | 38 | public static long recursiveModifiedTime(File[] files) { 39 | long modified = 0; 40 | for (int i = 0; i < files.length; i++) { 41 | long submodified = recursiveModifiedTime(files[i]); 42 | if (submodified > modified) { 43 | modified = submodified; 44 | } 45 | } 46 | return modified; 47 | } 48 | 49 | public static long recursiveModifiedTime(File file) { 50 | long modified = file.lastModified(); 51 | if (file.isDirectory()) { 52 | File[] subfiles = file.listFiles(); 53 | for (int i = 0; i < subfiles.length; i++) { 54 | long submodified = recursiveModifiedTime(subfiles[i]); 55 | if (submodified > modified) { 56 | modified = submodified; 57 | } 58 | } 59 | } 60 | return modified; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /brut.j.util/src/main/java/brut/util/Duo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package brut.util; 18 | 19 | /** 20 | * @author Ryszard Wiśniewski 21 | */ 22 | public class Duo { 23 | public final T1 m1; 24 | public final T2 m2; 25 | 26 | public Duo(T1 t1, T2 t2) { 27 | this.m1 = t1; 28 | this.m2 = t2; 29 | } 30 | 31 | @Override 32 | public boolean equals(Object obj) { 33 | if (obj == null) { 34 | return false; 35 | } 36 | if (getClass() != obj.getClass()) { 37 | return false; 38 | } 39 | final Duo other = (Duo) obj; 40 | if (this.m1 != other.m1 && (this.m1 == null || !this.m1.equals(other.m1))) { 41 | return false; 42 | } 43 | if (this.m2 != other.m2 && (this.m2 == null || !this.m2.equals(other.m2))) { 44 | return false; 45 | } 46 | return true; 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | int hash = 3; 52 | hash = 71 * hash + (this.m1 != null ? this.m1.hashCode() : 0); 53 | hash = 71 * hash + (this.m2 != null ? this.m2.hashCode() : 0); 54 | return hash; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /brut.j.util/src/templates/apache2.0-header.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010 Ryszard Wiśniewski 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2011 Ryszard Wiśniewski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'java' 18 | apply plugin: 'maven' 19 | apply plugin: 'license' 20 | ext.apktoolversion = '1.5.3-SNAPSHOT' 21 | ext.fullrev = ''; 22 | ext.gitrev_version = ''; 23 | 24 | repositories { 25 | mavenCentral() 26 | } 27 | 28 | sourceCompatibility = 1.6 29 | targetCompatibility = 1.6 30 | 31 | class Compatibility { 32 | String version 33 | Compatibility(String versionValue) { 34 | def matcher = (versionValue =~ /Java (\d)/) 35 | version = matcher[0][1] 36 | } 37 | String toString() { version } 38 | } 39 | 40 | task wrapper(type: Wrapper) { 41 | gradleVersion = '1.4' 42 | } 43 | 44 | // If anyone uses this outside of GoogleCode (Apktool) developers. I will hunt you down and hurt you. 45 | // This is for official releases only. 46 | task release { 47 | } 48 | 49 | buildscript { 50 | repositories { 51 | mavenCentral() 52 | } 53 | dependencies { 54 | classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.5.0' 55 | classpath 'eu.appsatori:gradle-fatjar-plugin:0.2-rc1' 56 | } 57 | } 58 | 59 | subprojects { 60 | apply plugin: 'java' 61 | apply plugin: 'maven' 62 | apply plugin: 'idea' 63 | 64 | repositories { 65 | mavenCentral() 66 | } 67 | dependencies { 68 | testCompile 'junit:junit:4.8.2' 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/broo2s/brut.apktool/2c5f176a94c17b459d8f04ed07435dc7812ce3ee/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Feb 17 08:56:38 CST 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://downloads.gradle.org/distributions/gradle-1.4-bin.zip 7 | -------------------------------------------------------------------------------- /scripts/windows/apktool.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set PATH=%CD%;%PATH%; 3 | java -jar "%~dp0\apktool.jar" %1 %2 %3 %4 %5 %6 %7 %8 %9 4 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include 'brut.j.common', 2 | 'brut.j.util', 3 | 'brut.j.dir', 4 | 'brut.apktool.smali:util', 5 | 'brut.apktool.smali:dexlib', 6 | 'brut.apktool.smali:baksmali', 7 | 'brut.apktool.smali:smali', 8 | 'brut.apktool:apktool-lib', 9 | 'brut.apktool:apktool-cli' --------------------------------------------------------------------------------