From bbee938b5caa4184794bdc09861ec6ebc753bf6c Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Wed, 16 Jan 2013 21:51:04 -0600 Subject: [PATCH] deleted not-needed smali stuff, renamed license for smali to prevent conflicts, worked on Proguard --- brut.apktool.smali/{NOTICE => NOTICE-SMALI} | 0 .../AnnotationTypes/ClassAnnotation.smali | 4 - .../AnnotationTypes/FieldAnnotation.smali | 4 - .../examples/AnnotationTypes/Main.smali | 138 ------------------ .../AnnotationTypes/MethodAnnotation.smali | 4 - .../AnnotationTypes/ParameterAnnotation.smali | 3 - .../examples/AnnotationValues/10.smali | 6 - .../AnnotationWithValues.smali | 67 --------- .../examples/AnnotationValues/Enum.smali | 52 ------- .../examples/AnnotationValues/Main.smali | 25 ---- .../AnnotationValues/SubAnnotation.smali | 6 - brut.apktool.smali/examples/Enums/Enum.smali | 73 --------- brut.apktool.smali/examples/Enums/Main.smali | 15 -- .../examples/HelloWorld/HelloWorld.smali | 27 ---- .../examples/Interface/Interface.smali | 5 - .../examples/Interface/Main.smali | 35 ----- .../examples/MethodOverloading/Main.smali | 50 ------- .../examples/RecursiveAnnotation/Main.smali | 24 --- .../RecursiveAnnotation.smali | 18 --- .../RecursiveExceptionHandler/Main.smali | 21 --- brut.apktool.smali/scripts/baksmali | 83 ----------- brut.apktool.smali/scripts/smali | 83 ----------- brut.apktool/apktool-cli/build.gradle | 30 +++- 23 files changed, 29 insertions(+), 744 deletions(-) rename brut.apktool.smali/{NOTICE => NOTICE-SMALI} (100%) delete mode 100644 brut.apktool.smali/examples/AnnotationTypes/ClassAnnotation.smali delete mode 100644 brut.apktool.smali/examples/AnnotationTypes/FieldAnnotation.smali delete mode 100644 brut.apktool.smali/examples/AnnotationTypes/Main.smali delete mode 100644 brut.apktool.smali/examples/AnnotationTypes/MethodAnnotation.smali delete mode 100644 brut.apktool.smali/examples/AnnotationTypes/ParameterAnnotation.smali delete mode 100644 brut.apktool.smali/examples/AnnotationValues/10.smali delete mode 100644 brut.apktool.smali/examples/AnnotationValues/AnnotationWithValues.smali delete mode 100644 brut.apktool.smali/examples/AnnotationValues/Enum.smali delete mode 100644 brut.apktool.smali/examples/AnnotationValues/Main.smali delete mode 100644 brut.apktool.smali/examples/AnnotationValues/SubAnnotation.smali delete mode 100644 brut.apktool.smali/examples/Enums/Enum.smali delete mode 100644 brut.apktool.smali/examples/Enums/Main.smali delete mode 100644 brut.apktool.smali/examples/HelloWorld/HelloWorld.smali delete mode 100644 brut.apktool.smali/examples/Interface/Interface.smali delete mode 100644 brut.apktool.smali/examples/Interface/Main.smali delete mode 100644 brut.apktool.smali/examples/MethodOverloading/Main.smali delete mode 100644 brut.apktool.smali/examples/RecursiveAnnotation/Main.smali delete mode 100644 brut.apktool.smali/examples/RecursiveAnnotation/RecursiveAnnotation.smali delete mode 100644 brut.apktool.smali/examples/RecursiveExceptionHandler/Main.smali delete mode 100755 brut.apktool.smali/scripts/baksmali delete mode 100755 brut.apktool.smali/scripts/smali diff --git a/brut.apktool.smali/NOTICE b/brut.apktool.smali/NOTICE-SMALI similarity index 100% rename from brut.apktool.smali/NOTICE rename to brut.apktool.smali/NOTICE-SMALI diff --git a/brut.apktool.smali/examples/AnnotationTypes/ClassAnnotation.smali b/brut.apktool.smali/examples/AnnotationTypes/ClassAnnotation.smali deleted file mode 100644 index 941e7829..00000000 --- a/brut.apktool.smali/examples/AnnotationTypes/ClassAnnotation.smali +++ /dev/null @@ -1,4 +0,0 @@ -.class public abstract interface annotation LClassAnnotation; -.super Ljava/lang/Object; -.implements Ljava/lang/annotation/Annotation; - diff --git a/brut.apktool.smali/examples/AnnotationTypes/FieldAnnotation.smali b/brut.apktool.smali/examples/AnnotationTypes/FieldAnnotation.smali deleted file mode 100644 index 17846b96..00000000 --- a/brut.apktool.smali/examples/AnnotationTypes/FieldAnnotation.smali +++ /dev/null @@ -1,4 +0,0 @@ -.class public abstract interface annotation LFieldAnnotation; -.super Ljava/lang/Object; -.implements Ljava/lang/annotation/Annotation; - diff --git a/brut.apktool.smali/examples/AnnotationTypes/Main.smali b/brut.apktool.smali/examples/AnnotationTypes/Main.smali deleted file mode 100644 index 293edc4d..00000000 --- a/brut.apktool.smali/examples/AnnotationTypes/Main.smali +++ /dev/null @@ -1,138 +0,0 @@ -.class public LMain; -.super Ljava/lang/Object; - - -#expected output: -#@ClassAnnotation() -#@MethodAnnotation() -#@FieldAnnotation() -#@ParameterAnnotation() - - -.method public static main([Ljava/lang/String;)V - .registers 1 - - invoke-static {}, LMain;->testClassAnnotation()V - - invoke-static {}, LMain;->testMethodAnnotation()V - - invoke-static {}, LMain;->testFieldAnnotation()V - - const-string v0, "" - - invoke-static {v0}, LMain;->testParameterAnnotation(Ljava/lang/String;)V - - return-void -.end method - -.annotation runtime LClassAnnotation; -.end annotation - -.method public static testClassAnnotation()V - .registers 3 - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - - const-class v1, LMain; - const-class v2, LClassAnnotation; - - invoke-virtual {v1, v2}, Ljava/lang/Class;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation; - move-result-object v1 - - invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - return-void -.end method - - - -.method public static testMethodAnnotation()V - .registers 4 - - .annotation runtime LMethodAnnotation; - .end annotation - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - - const-class v1, LMain; - const-string v2, "testMethodAnnotation" - - const/4 v3, 0 - new-array v3, v3, [Ljava/lang/Class; - - invoke-virtual {v1, v2, v3}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; - move-result-object v1 - - const-class v2, LMethodAnnotation; - - invoke-virtual {v1, v2}, Ljava/lang/reflect/Method;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation; - move-result-object v1 - - invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - return-void -.end method - - -.field public static fieldAnnotationTest:Ljava/lang/Object; - .annotation runtime LFieldAnnotation; - .end annotation -.end field - -.method public static testFieldAnnotation()V - .registers 3 - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - - const-class v1, LMain; - const-string v2, "fieldAnnotationTest" - - invoke-virtual {v1, v2}, Ljava/lang/Class;->getField(Ljava/lang/String;)Ljava/lang/reflect/Field; - move-result-object v1 - - const-class v2, LFieldAnnotation; - - invoke-virtual {v1, v2}, Ljava/lang/reflect/Field;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation; - move-result-object v1 - - invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - return-void -.end method - - -.method public static testParameterAnnotation(Ljava/lang/String;)V - .registers 6 - - .parameter - .annotation runtime LParameterAnnotation; - .end annotation - .end parameter - - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - - const-class v1, LMain; - const-string v2, "testParameterAnnotation" - - const/4 v3, 1 - new-array v3, v3, [Ljava/lang/Class; - - const-class v4, Ljava/lang/String; - const/4 v5, 0 - aput-object v4, v3, v5 - - invoke-virtual {v1, v2, v3}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; - move-result-object v1 - - - invoke-virtual {v1}, Ljava/lang/reflect/Method;->getParameterAnnotations()[[Ljava/lang/annotation/Annotation; - move-result-object v1 - - aget-object v1, v1, v5 - aget-object v1, v1, v5 - - invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - return-void -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/AnnotationTypes/MethodAnnotation.smali b/brut.apktool.smali/examples/AnnotationTypes/MethodAnnotation.smali deleted file mode 100644 index 2e632996..00000000 --- a/brut.apktool.smali/examples/AnnotationTypes/MethodAnnotation.smali +++ /dev/null @@ -1,4 +0,0 @@ -.class public abstract interface annotation LMethodAnnotation; -.super Ljava/lang/Object; -.implements Ljava/lang/annotation/Annotation; - diff --git a/brut.apktool.smali/examples/AnnotationTypes/ParameterAnnotation.smali b/brut.apktool.smali/examples/AnnotationTypes/ParameterAnnotation.smali deleted file mode 100644 index d114b2a1..00000000 --- a/brut.apktool.smali/examples/AnnotationTypes/ParameterAnnotation.smali +++ /dev/null @@ -1,3 +0,0 @@ -.class public abstract interface annotation LParameterAnnotation; -.super Ljava/lang/Object; -.implements Ljava/lang/annotation/Annotation; \ No newline at end of file diff --git a/brut.apktool.smali/examples/AnnotationValues/10.smali b/brut.apktool.smali/examples/AnnotationValues/10.smali deleted file mode 100644 index 4460a019..00000000 --- a/brut.apktool.smali/examples/AnnotationValues/10.smali +++ /dev/null @@ -1,6 +0,0 @@ -.class public L10; -.super Ljava/lang/Object; - -.method public static 11()V - return-void -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/AnnotationValues/AnnotationWithValues.smali b/brut.apktool.smali/examples/AnnotationValues/AnnotationWithValues.smali deleted file mode 100644 index 54465105..00000000 --- a/brut.apktool.smali/examples/AnnotationValues/AnnotationWithValues.smali +++ /dev/null @@ -1,67 +0,0 @@ -.class public abstract interface annotation LAnnotationWithValues; -.super Ljava/lang/Object; -.implements Ljava/lang/annotation/Annotation; - -.method public abstract booleanValue()Z -.end method - -.method public abstract byteValue()B -.end method - -.method public abstract charValue()C -.end method - -.method public abstract shortValue()S -.end method - -.method public abstract intValue()I -.end method - -.method public abstract longValue()J -.end method - -.method public abstract floatValue()F -.end method - -.method public abstract doubleValue()D -.end method - -.method public abstract stringValue()Ljava/lang/String; -.end method - -.method public abstract subAnnotationValue()LSubAnnotation; -.end method - -.method public abstract typeValue()Ljava/lang/Class; -.end method - -.method public abstract methodValue()Ljava/lang/reflect/Method; -.end method - -#dalvik doesn't seem to like field values -#.method public abstract fieldValue()Ljava/lang/reflect/Field; -#.end method - -.method public abstract enumValue()LEnum; -.end method - -.annotation system Ldalvik/annotation/AnnotationDefault; - value = .subannotation LAnnotationWithValues; - booleanValue = false - byteValue = 1t - charValue = '2' - shortValue = 3s - intValue = 4 - longValue = 5l - floatValue = 6.0f - doubleValue = 7.0 - stringValue = "8" - subAnnotationValue = .subannotation LSubAnnotation; - stringValue = "9" - .end subannotation - typeValue = L10; - methodValue = L10;->11()V - enumValue = .enum LEnum;->12:LEnum; - .end subannotation -.end annotation - diff --git a/brut.apktool.smali/examples/AnnotationValues/Enum.smali b/brut.apktool.smali/examples/AnnotationValues/Enum.smali deleted file mode 100644 index cbc60a44..00000000 --- a/brut.apktool.smali/examples/AnnotationValues/Enum.smali +++ /dev/null @@ -1,52 +0,0 @@ -.class public final enum LEnum; -.super Ljava/lang/Enum; - -.field private static final synthetic $VALUES:[LEnum; - -.field public static final enum 12:LEnum; - -.method static constructor ()V - .registers 4 - - const/4 v3, 1 - const/4 v2, 0 - new-instance v0, LEnum; - const-string v1, "12" - invoke-direct {v0, v1, v2}, LEnum;->(Ljava/lang/String;I)V - sput-object v0, LEnum;->12:LEnum; - - const/4 v0, 1 - new-array v0, v0, [LEnum; - sget-object v1, LEnum;->12:LEnum; - aput-object v1, v0, v2 - - sput-object v0, LEnum;->$VALUES:[LEnum; - return-void -.end method - -.method private constructor (Ljava/lang/String;I)V - .registers 3 - - invoke-direct {p0, p1, p2}, Ljava/lang/Enum;->(Ljava/lang/String;I)V - return-void -.end method - -.method public static valueOf(Ljava/lang/String;)LEnum; - .registers 2 - - const-class v0, LEnum; - invoke-static {v0, p0}, Ljava/lang/Enum;->valueOf(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum; - move-result-object v1 - check-cast v1, LEnum; - return-object v1 -.end method - -.method public static values()[LEnum; - .registers 1 - - sget-object v0, LEnum;->$VALUES:[LEnum; - invoke-virtual {v0}, [LEnum;->clone()Ljava/lang/Object; - move-result-object v0 - check-cast v0, [LEnum; - return-object v0 -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/AnnotationValues/Main.smali b/brut.apktool.smali/examples/AnnotationValues/Main.smali deleted file mode 100644 index 5f35c9de..00000000 --- a/brut.apktool.smali/examples/AnnotationValues/Main.smali +++ /dev/null @@ -1,25 +0,0 @@ -.class public LMain; -.super Ljava/lang/Object; - -#expected output: -#@AnnotationWithValues(booleanValue=false, byteValue=1, charValue=2, doubleValue=7.0, enumValue=12, floatValue=6.0, intValue=4, longValue=5, methodValue=public static void 10.11(), shortValue=3, stringValue=8, subAnnotationValue=@SubAnnotation(stringValue=9), typeValue=class 10) - - -.method public static main([Ljava/lang/String;)V - .registers 3 - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - - const-class v1, LMain; - const-class v2, LAnnotationWithValues; - - invoke-virtual {v1, v2}, Ljava/lang/Class;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation; - move-result-object v1 - - invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - return-void -.end method - -.annotation runtime LAnnotationWithValues; -.end annotation diff --git a/brut.apktool.smali/examples/AnnotationValues/SubAnnotation.smali b/brut.apktool.smali/examples/AnnotationValues/SubAnnotation.smali deleted file mode 100644 index 61ef9fd4..00000000 --- a/brut.apktool.smali/examples/AnnotationValues/SubAnnotation.smali +++ /dev/null @@ -1,6 +0,0 @@ -.class public abstract interface annotation LSubAnnotation; -.super Ljava/lang/Object; -.implements Ljava/lang/annotation/Annotation; - -.method public abstract stringValue()Ljava/lang/String; -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/Enums/Enum.smali b/brut.apktool.smali/examples/Enums/Enum.smali deleted file mode 100644 index 1bae8c5b..00000000 --- a/brut.apktool.smali/examples/Enums/Enum.smali +++ /dev/null @@ -1,73 +0,0 @@ -.class public final enum LEnum; -.super Ljava/lang/Enum; - -#This class is an example of how to define an enum. You have -#to do all of the work that java normally takes care of - -.field private static final synthetic $VALUES:[LEnum; - -.field public static final enum VALUE1:LEnum; -.field public static final enum VALUE2:LEnum; - -.method static constructor ()V - .registers 4 - - #create an instance of this class for the VALUE1 value - new-instance v0, LEnum; - const-string v1, "VALUE1" - const/4 v2, 0 - invoke-direct {v0, v1, v2}, LEnum;->(Ljava/lang/String;I)V - - #and store it in VALUE1 - sput-object v0, LEnum;->VALUE1:LEnum; - - #create an instance of this class for the VALUE2 value - new-instance v0, LEnum; - const-string v1, "VALUE2" - const/4 v3, 1 - invoke-direct {v0, v1, v3}, LEnum;->(Ljava/lang/String;I)V - - #and store it in VALUE2 - sput-object v0, LEnum;->VALUE2:LEnum; - - #create an array of Enums, for the $VALUES member - const/4 v0, 2 - new-array v0, v0, [LEnum; - - #add VALUE1 to the array - sget-object v1, LEnum;->VALUE1:LEnum; - aput-object v1, v0, v2 - - #add VALUE2 to the array - sget-object v1, LEnum;->VALUE2:LEnum; - aput-object v1, v0, v3 - - #and store the array in $VALUES - sput-object v0, LEnum;->$VALUES:[LEnum; - - return-void -.end method - -.method private constructor (Ljava/lang/String;I)V - .registers 3 - invoke-direct {p0, p1, p2}, Ljava/lang/Enum;->(Ljava/lang/String;I)V - return-void -.end method - -.method public static valueof(Ljava/lang/String;)LEnum; - .registers 2 - const-class v0, LEnum; - invoke-static {v0, p0}, Ljava/lang/Enum;->valueOf(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum; - move-result-object v1 - check-cast v1, LEnum; - return-object v1 -.end method - -.method public static values()[LEnum; - .registers 1 - sget-object v0, LEnum;->$VALUES:[LEnum; - invoke-virtual {v0}, [LEnum;->clone()Ljava/lang/Object; - move-result-object v0 - check-cast v0, [LEnum; - return-object v0 -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/Enums/Main.smali b/brut.apktool.smali/examples/Enums/Main.smali deleted file mode 100644 index 65354193..00000000 --- a/brut.apktool.smali/examples/Enums/Main.smali +++ /dev/null @@ -1,15 +0,0 @@ -.class public LMain; -.super Ljava/lang/Object; - - - -.method public static main([Ljava/lang/String;)V - .registers 2 - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - sget-object v1, LEnum;->VALUE1:LEnum; - - invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - return-void -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/HelloWorld/HelloWorld.smali b/brut.apktool.smali/examples/HelloWorld/HelloWorld.smali deleted file mode 100644 index 17b03f84..00000000 --- a/brut.apktool.smali/examples/HelloWorld/HelloWorld.smali +++ /dev/null @@ -1,27 +0,0 @@ -.class public LHelloWorld; - -#Ye olde hello world application -#To assemble and run this on a phone or emulator: -# -#java -jar smali.jar -o classes.dex HelloWorld.smali -#zip HelloWorld.zip classes.dex -#adb push HelloWorld.zip /data/local -#adb shell dalvikvm -cp /data/local/HelloWorld.zip HelloWorld -# -#if you get out of memory type errors when running smali.jar, try -#java -Xmx512m -jar smali.jar HelloWorld.smali -#instead - -.super Ljava/lang/Object; - -.method public static main([Ljava/lang/String;)V - .registers 2 - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - - const-string v1, "Hello World!" - - invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V - - return-void -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/Interface/Interface.smali b/brut.apktool.smali/examples/Interface/Interface.smali deleted file mode 100644 index 2c5d1548..00000000 --- a/brut.apktool.smali/examples/Interface/Interface.smali +++ /dev/null @@ -1,5 +0,0 @@ -.class public abstract interface LInterface; -.super Ljava/lang/Object; - -.method public abstract interfaceMethod()Ljava/lang/String; -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/Interface/Main.smali b/brut.apktool.smali/examples/Interface/Main.smali deleted file mode 100644 index f2f69f87..00000000 --- a/brut.apktool.smali/examples/Interface/Main.smali +++ /dev/null @@ -1,35 +0,0 @@ -.class public LMain; -.super Ljava/lang/Object; -.implements LInterface; - -#expected output: -#in interfaceMethod() - -.method public constructor ()V - .registers 1 - invoke-direct {p0}, Ljava/lang/Object;->()V - return-void -.end method - -.method public static main([Ljava/lang/String;)V - .registers 3 - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - - new-instance v1, LMain; - invoke-direct {v1}, LMain;->()V - invoke-interface {v1}, LInterface;->interfaceMethod()Ljava/lang/String; - move-result-object v1 - - invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - return-void -.end method - - -.method public interfaceMethod()Ljava/lang/String; - .registers 1 - - const-string v0, "in interfaceMethod()" - return-object v0 -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/MethodOverloading/Main.smali b/brut.apktool.smali/examples/MethodOverloading/Main.smali deleted file mode 100644 index a61303ec..00000000 --- a/brut.apktool.smali/examples/MethodOverloading/Main.smali +++ /dev/null @@ -1,50 +0,0 @@ -.class public LMain; -.super Ljava/lang/Object; - -#expected output: -#returning a string -#42 - -.method public constructor ()V - .registers 1 - invoke-direct {p0}, Ljava/lang/Object;->()V - return-void -.end method - -.method public static main([Ljava/lang/String;)V - .registers 4 - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - - new-instance v1, LMain; - invoke-direct {v1}, LMain;->()V - invoke-virtual {v1}, LMain;->overloadTest()Ljava/lang/String; - move-result-object v2 - - invoke-virtual {v0, v2}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - invoke-virtual {v1}, LMain;->overloadTest()I - move-result v2 - - invoke-static {v2}, Ljava/lang/Integer;->toString(I)Ljava/lang/String; - move-result-object v2 - - invoke-virtual {v0, v2}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - return-void -.end method - - -.method public overloadTest()Ljava/lang/String; - .registers 1 - - const-string v0, "returning a string" - return-object v0 -.end method - -.method public overloadTest()I - .registers 1 - - const v0, 42 - return v0 -.end method \ No newline at end of file diff --git a/brut.apktool.smali/examples/RecursiveAnnotation/Main.smali b/brut.apktool.smali/examples/RecursiveAnnotation/Main.smali deleted file mode 100644 index d44bdca8..00000000 --- a/brut.apktool.smali/examples/RecursiveAnnotation/Main.smali +++ /dev/null @@ -1,24 +0,0 @@ -.class public LMain; -.super Ljava/lang/Object; - -#expected output (using the dalvik's default stack size) -#@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=java.lang.StackOverflowError)))))))))))))))))))))))))))))) - -.method public static main([Ljava/lang/String;)V - .registers 3 - - sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; - - const-class v1, LMain; - const-class v2, LRecursiveAnnotation; - - invoke-virtual {v1, v2}, Ljava/lang/Class;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation; - move-result-object v1 - - invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V - - return-void -.end method - -.annotation runtime LRecursiveAnnotation; -.end annotation diff --git a/brut.apktool.smali/examples/RecursiveAnnotation/RecursiveAnnotation.smali b/brut.apktool.smali/examples/RecursiveAnnotation/RecursiveAnnotation.smali deleted file mode 100644 index 0fde4a88..00000000 --- a/brut.apktool.smali/examples/RecursiveAnnotation/RecursiveAnnotation.smali +++ /dev/null @@ -1,18 +0,0 @@ -.class public abstract interface annotation LRecursiveAnnotation; -.super Ljava/lang/Object; -.implements Ljava/lang/annotation/Annotation; - -#this is a recursive annotation that has a default value of itself. -#Trying to print .toString() on an instance of this annotation -#will cause a stack overflow - -.method public abstract value()LRecursiveAnnotation; -.end method - -.annotation system Ldalvik/annotation/AnnotationDefault; - value = .subannotation LRecursiveAnnotation; - value = .subannotation LRecursiveAnnotation; - .end subannotation - .end subannotation -.end annotation - diff --git a/brut.apktool.smali/examples/RecursiveExceptionHandler/Main.smali b/brut.apktool.smali/examples/RecursiveExceptionHandler/Main.smali deleted file mode 100644 index ea113650..00000000 --- a/brut.apktool.smali/examples/RecursiveExceptionHandler/Main.smali +++ /dev/null @@ -1,21 +0,0 @@ -.class public LMain; -.super Ljava/lang/Object; - -.method public static main([Ljava/lang/String;)V - .registers 3 - - :second_handler - :first_try_start - new-instance v0, Ljava/lang/RuntimeException; - invoke-direct {v0}, Ljava/lang/RuntimeException;->()V - throw v0 - :first_try_end - .catch Ljava/lang/Exception; {:first_try_start .. :first_try_end} :first_handler - :first_handler - :second_try_start - new-instance v0, Ljava/lang/RuntimeException; - invoke-direct {v0}, Ljava/lang/RuntimeException;->()V - throw v0 - :second_try_end - .catch Ljava/lang/Exception; {:second_try_start .. :second_try_end} :second_handler -.end method \ No newline at end of file diff --git a/brut.apktool.smali/scripts/baksmali b/brut.apktool.smali/scripts/baksmali deleted file mode 100755 index bd3f820e..00000000 --- a/brut.apktool.smali/scripts/baksmali +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2007 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# As per the Apache license requirements, this file has been modified -# from its original state. -# -# Such modifications are Copyright (C) 2010 Ben Gruver, and are released -# under the original license - -# This script is a wrapper around baksmali.jar, so you can simply call -# "baksmali", instead of java -jar baksmali.jar. It is heavily based on -# the "dx" script from the Android SDK - -# Set up prog to be the path of this script, including following symlinks, -# and set up progdir to be the fully-qualified pathname of its directory. -prog="$0" -while [ -h "${prog}" ]; do - newProg=`/bin/ls -ld "${prog}"` - echo ${newProg} - - - newProg=`expr "${newProg}" : ".* -> \(.*\)$"` - if expr "x${newProg}" : 'x/' >/dev/null; then - prog="${newProg}" - else - progdir=`dirname "${prog}"` - prog="${progdir}/${newProg}" - fi -done -oldwd=`pwd` -progdir=`dirname "${prog}"` -cd "${progdir}" -progdir=`pwd` -prog="${progdir}"/`basename "${prog}"` -cd "${oldwd}" - - -jarfile=baksmali.jar -libdir="$progdir" -if [ ! -r "$libdir/$jarfile" ] -then - echo `basename "$prog"`": can't find $jarfile" - exit 1 -fi - -javaOpts="" - -# If you want DX to have more memory when executing, uncomment the following -# line and adjust the value accordingly. Use "java -X" for a list of options -# you can pass here. -# -javaOpts="-Xmx256M" - -# Alternatively, this will extract any parameter "-Jxxx" from the command line -# and pass them to Java (instead of to dx). This makes it possible for you to -# add a command-line parameter such as "-JXmx256M" in your ant scripts, for -# example. -while expr "x$1" : 'x-J' >/dev/null; do - opt=`expr "$1" : '-J\(.*\)'` - javaOpts="${javaOpts} -${opt}" - shift -done - -if [ "$OSTYPE" = "cygwin" ] ; then - jarpath=`cygpath -w "$libdir/$jarfile"` -else - jarpath="$libdir/$jarfile" -fi - -exec java $javaOpts -jar "$jarpath" "$@" diff --git a/brut.apktool.smali/scripts/smali b/brut.apktool.smali/scripts/smali deleted file mode 100755 index b01199e1..00000000 --- a/brut.apktool.smali/scripts/smali +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2007 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# As per the Apache license requirements, this file has been modified -# from its original state. -# -# Such modifications are Copyright (C) 2010 Ben Gruver, and are released -# under the original license - -# This script is a wrapper for smali.jar, so you can simply call "smali", -# instead of java -jar smali.jar. It is heavily based on the "dx" script -# from the Android SDK - -# Set up prog to be the path of this script, including following symlinks, -# and set up progdir to be the fully-qualified pathname of its directory. -prog="$0" -while [ -h "${prog}" ]; do - newProg=`/bin/ls -ld "${prog}"` - echo ${newProg} - - - newProg=`expr "${newProg}" : ".* -> \(.*\)$"` - if expr "x${newProg}" : 'x/' >/dev/null; then - prog="${newProg}" - else - progdir=`dirname "${prog}"` - prog="${progdir}/${newProg}" - fi -done -oldwd=`pwd` -progdir=`dirname "${prog}"` -cd "${progdir}" -progdir=`pwd` -prog="${progdir}"/`basename "${prog}"` -cd "${oldwd}" - - -jarfile=smali.jar -libdir="$progdir" -if [ ! -r "$libdir/$jarfile" ] -then - echo `basename "$prog"`": can't find $jarfile" - exit 1 -fi - -javaOpts="" - -# If you want DX to have more memory when executing, uncomment the following -# line and adjust the value accordingly. Use "java -X" for a list of options -# you can pass here. -# -javaOpts="-Xmx256M" - -# Alternatively, this will extract any parameter "-Jxxx" from the command line -# and pass them to Java (instead of to dx). This makes it possible for you to -# add a command-line parameter such as "-JXmx256M" in your ant scripts, for -# example. -while expr "x$1" : 'x-J' >/dev/null; do - opt=`expr "$1" : '-J\(.*\)'` - javaOpts="${javaOpts} -${opt}" - shift -done - -if [ "$OSTYPE" = "cygwin" ] ; then - jarpath=`cygpath -w "$libdir/$jarfile"` -else - jarpath="$libdir/$jarfile" -fi - -exec java $javaOpts -jar "$jarpath" "$@" diff --git a/brut.apktool/apktool-cli/build.gradle b/brut.apktool/apktool-cli/build.gradle index 9eab2732..853174d3 100644 --- a/brut.apktool/apktool-cli/build.gradle +++ b/brut.apktool/apktool-cli/build.gradle @@ -16,8 +16,13 @@ version = apktoolversion +configurations { + proguard +} + dependencies { compile project(':brut.apktool:apktool-lib') + proguard 'net.sf.proguard:proguard-base:4.8' } gradle.taskGraph.whenReady { @@ -28,4 +33,27 @@ gradle.taskGraph.whenReady { attributes("Main-Class": "brut.apktool.Main") } } -} \ No newline at end of file +} + +task proguard(type: JavaExec, dependsOn: jar) { + def outFile = jar.destinationDir.getPath() + '/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension + inputs.file jar.archivePath + outputs.file outFile + + classpath = configurations.proguard + main = 'proguard.ProGuard' + args '-injars ' + "${jar.archivePath}" + ' (!META-INF/LICENSE.txt,!META-INF/NOTICE.txt,!README)' + args "-outjars ${outFile}" + args "-libraryjars ${System.properties['java.home']}/lib/rt.jar" + args '-dontobfuscate' + args '-dontoptimize' + args '-keep public class brut.apktool.Main { public static void main(java.lang.String[]); }' + args '-keep class org.yaml.snakeyaml.** { public protected private *; }' + args '-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }' + args '-dontwarn com.google.common.base.**' + args '-dontwarn com.google.common.collect.**' + args '-dontwarn javax.xml.xpath.**' + args '-dontnote **' +} + +tasks.getByPath(':release').dependsOn(proguard) \ No newline at end of file