.class public Lcom/example/hook/MainActivity;
.super Landroid/app/Activity;
.source "MainActivity.java"


# instance fields
.field contextWrapper:Landroid/content/ContextWrapper;


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 22
    invoke-direct {p0}, Landroid/app/Activity;-><init>()V

    return-void
.end method

.method public static byteArrayToHex([B)Ljava/lang/String;
    .locals 8
    .param p0, "byteArray"    # [B

    .prologue
    .line 139
    const/16 v5, 0x10

    new-array v1, v5, [C

    fill-array-data v1, :array_0

    .line 142
    .local v1, "hexDigits":[C
    array-length v5, p0

    mul-int/lit8 v5, v5, 0x2

    new-array v4, v5, [C

    .line 144
    .local v4, "resultCharArray":[C
    const/4 v2, 0x0

    .line 145
    .local v2, "index":I
    array-length v6, p0

    const/4 v5, 0x0

    move v3, v2

    .end local v2    # "index":I
    .local v3, "index":I
    :goto_0
    if-lt v5, v6, :cond_0

    .line 150
    new-instance v5, Ljava/lang/String;

    invoke-direct {v5, v4}, Ljava/lang/String;-><init>([C)V

    return-object v5

    .line 145
    :cond_0
    aget-byte v0, p0, v5

    .line 146
    .local v0, "b":B
    add-int/lit8 v2, v3, 0x1

    .end local v3    # "index":I
    .restart local v2    # "index":I
    ushr-int/lit8 v7, v0, 0x4

    and-int/lit8 v7, v7, 0xf

    aget-char v7, v1, v7

    aput-char v7, v4, v3

    .line 147
    add-int/lit8 v3, v2, 0x1

    .end local v2    # "index":I
    .restart local v3    # "index":I
    and-int/lit8 v7, v0, 0xf

    aget-char v7, v1, v7

    aput-char v7, v4, v2

    .line 145
    add-int/lit8 v5, v5, 0x1

    goto :goto_0

    .line 139
    nop

    :array_0
    .array-data 2
        0x30s
        0x31s
        0x32s
        0x33s
        0x34s
        0x35s
        0x36s
        0x37s
        0x38s
        0x39s
        0x41s
        0x42s
        0x43s
        0x44s
        0x45s
        0x46s
    .end array-data
.end method

.method public static getApkSignInfo(Ljava/lang/String;)Ljava/lang/String;
    .locals 13
    .param p0, "apkFilePath"    # Ljava/lang/String;

    .prologue
    const/4 v10, 0x0

    .line 76
    const/16 v11, 0x2000

    new-array v9, v11, [B

    .line 77
    .local v9, "readBuffer":[B
    const/4 v0, 0x0

    .line 79
    .local v0, "certs":[Ljava/security/cert/Certificate;
    :try_start_0
    new-instance v6, Ljava/util/jar/JarFile;

    invoke-direct {v6, p0}, Ljava/util/jar/JarFile;-><init>(Ljava/lang/String;)V

    .line 80
    .local v6, "jarFile":Ljava/util/jar/JarFile;
    invoke-virtual {v6}, Ljava/util/jar/JarFile;->entries()Ljava/util/Enumeration;

    move-result-object v2

    .line 81
    .local v2, "entries":Ljava/util/Enumeration;
    :cond_0
    :goto_0
    invoke-interface {v2}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v11

    if-nez v11, :cond_1

    .line 109
    invoke-virtual {v6}, Ljava/util/jar/JarFile;->close()V

    .line 110
    new-instance v11, Ljava/lang/String;

    const/4 v12, 0x0

    aget-object v12, v0, v12

    invoke-virtual {v12}, Ljava/security/cert/Certificate;->getEncoded()[B

    move-result-object v12

    invoke-static {v12}, Lcom/example/hook/MainActivity;->toChars([B)[C

    move-result-object v12

    invoke-direct {v11, v12}, Ljava/lang/String;-><init>([C)V

    move-object v10, v11

    .line 114
    .end local v2    # "entries":Ljava/util/Enumeration;
    .end local v6    # "jarFile":Ljava/util/jar/JarFile;
    :goto_1
    return-object v10

    .line 82
    .restart local v2    # "entries":Ljava/util/Enumeration;
    .restart local v6    # "jarFile":Ljava/util/jar/JarFile;
    :cond_1
    invoke-interface {v2}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Ljava/util/jar/JarEntry;

    .line 83
    .local v7, "je":Ljava/util/jar/JarEntry;
    invoke-virtual {v7}, Ljava/util/jar/JarEntry;->isDirectory()Z

    move-result v11

    if-nez v11, :cond_0

    .line 84
    invoke-virtual {v7}, Ljava/util/jar/JarEntry;->getName()Ljava/lang/String;

    move-result-object v11

    const-string v12, "META-INF/"

    invoke-virtual {v11, v12}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v11

    if-nez v11, :cond_0

    .line 85
    invoke-static {v6, v7, v9}, Lcom/example/hook/MainActivity;->loadCertificates(Ljava/util/jar/JarFile;Ljava/util/jar/JarEntry;[B)[Ljava/security/cert/Certificate;

    move-result-object v8

    .line 88
    .local v8, "localCerts":[Ljava/security/cert/Certificate;
    if-nez v0, :cond_2

    .line 89
    move-object v0, v8

    goto :goto_0

    .line 91
    :cond_2
    const/4 v4, 0x0

    .local v4, "i":I
    :goto_2
    array-length v11, v0

    if-ge v4, v11, :cond_0

    .line 92
    const/4 v3, 0x0

    .line 93
    .local v3, "found":Z
    const/4 v5, 0x0

    .local v5, "j":I
    :goto_3
    array-length v11, v8

    if-lt v5, v11, :cond_4

    .line 100
    :goto_4
    if-eqz v3, :cond_3

    .line 101
    array-length v11, v0

    array-length v12, v8

    if-eq v11, v12, :cond_6

    .line 102
    :cond_3
    invoke-virtual {v6}, Ljava/util/jar/JarFile;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1

    .line 111
    .end local v2    # "entries":Ljava/util/Enumeration;
    .end local v3    # "found":Z
    .end local v4    # "i":I
    .end local v5    # "j":I
    .end local v6    # "jarFile":Ljava/util/jar/JarFile;
    .end local v7    # "je":Ljava/util/jar/JarEntry;
    .end local v8    # "localCerts":[Ljava/security/cert/Certificate;
    :catch_0
    move-exception v1

    .line 112
    .local v1, "e":Ljava/lang/Exception;
    invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_1

    .line 94
    .end local v1    # "e":Ljava/lang/Exception;
    .restart local v2    # "entries":Ljava/util/Enumeration;
    .restart local v3    # "found":Z
    .restart local v4    # "i":I
    .restart local v5    # "j":I
    .restart local v6    # "jarFile":Ljava/util/jar/JarFile;
    .restart local v7    # "je":Ljava/util/jar/JarEntry;
    .restart local v8    # "localCerts":[Ljava/security/cert/Certificate;
    :cond_4
    :try_start_1
    aget-object v11, v0, v4

    if-eqz v11, :cond_5

    .line 95
    aget-object v11, v0, v4

    aget-object v12, v8, v5

    invoke-virtual {v11, v12}, Ljava/security/cert/Certificate;->equals(Ljava/lang/Object;)Z
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    move-result v11

    if-eqz v11, :cond_5

    .line 96
    const/4 v3, 0x1

    .line 97
    goto :goto_4

    .line 93
    :cond_5
    add-int/lit8 v5, v5, 0x1

    goto :goto_3

    .line 91
    :cond_6
    add-int/lit8 v4, v4, 0x1

    goto :goto_2
.end method

.method private static loadCertificates(Ljava/util/jar/JarFile;Ljava/util/jar/JarEntry;[B)[Ljava/security/cert/Certificate;
    .locals 6
    .param p0, "jarFile"    # Ljava/util/jar/JarFile;
    .param p1, "je"    # Ljava/util/jar/JarEntry;
    .param p2, "readBuffer"    # [B

    .prologue
    const/4 v2, 0x0

    .line 62
    :try_start_0
    invoke-virtual {p0, p1}, Ljava/util/jar/JarFile;->getInputStream(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream;

    move-result-object v1

    .line 63
    .local v1, "is":Ljava/io/InputStream;
    :cond_0
    const/4 v3, 0x0

    array-length v4, p2

    invoke-virtual {v1, p2, v3, v4}, Ljava/io/InputStream;->read([BII)I

    move-result v3

    const/4 v4, -0x1

    if-ne v3, v4, :cond_0

    .line 65
    invoke-virtual {v1}, Ljava/io/InputStream;->close()V

    .line 66
    if-eqz p1, :cond_1

    invoke-virtual {p1}, Ljava/util/jar/JarEntry;->getCertificates()[Ljava/security/cert/Certificate;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v2

    .line 72
    .end local v1    # "is":Ljava/io/InputStream;
    :cond_1
    :goto_0
    return-object v2

    .line 67
    :catch_0
    move-exception v0

    .line 68
    .local v0, "e":Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 69
    sget-object v3, Ljava/lang/System;->err:Ljava/io/PrintStream;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Exception reading "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {p1}, Ljava/util/jar/JarEntry;->getName()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, " in "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    .line 70
    invoke-virtual {p0}, Ljava/util/jar/JarFile;->getName()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, ": "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    .line 69
    invoke-virtual {v3, v4}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public static stringMD5(Ljava/lang/String;)Ljava/lang/String;
    .locals 5
    .param p0, "input"    # Ljava/lang/String;

    .prologue
    .line 120
    :try_start_0
    const-string v4, "MD5"

    invoke-static {v4}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v2

    .line 122
    .local v2, "messageDigest":Ljava/security/MessageDigest;
    invoke-virtual {p0}, Ljava/lang/String;->getBytes()[B

    move-result-object v1

    .line 124
    .local v1, "inputByteArray":[B
    invoke-virtual {v2, v1}, Ljava/security/MessageDigest;->update([B)V

    .line 126
    invoke-virtual {v2}, Ljava/security/MessageDigest;->digest()[B

    move-result-object v3

    .line 128
    .local v3, "resultByteArray":[B
    invoke-static {v3}, Lcom/example/hook/MainActivity;->byteArrayToHex([B)Ljava/lang/String;
    :try_end_0
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v4

    .line 130
    .end local v1    # "inputByteArray":[B
    .end local v2    # "messageDigest":Ljava/security/MessageDigest;
    .end local v3    # "resultByteArray":[B
    :goto_0
    return-object v4

    .line 129
    :catch_0
    move-exception v0

    .line 130
    .local v0, "e":Ljava/security/NoSuchAlgorithmException;
    const/4 v4, 0x0

    goto :goto_0
.end method

.method private static toChars([B)[C
    .locals 10
    .param p0, "mSignature"    # [B

    .prologue
    const/16 v9, 0xa

    .line 44
    move-object v4, p0

    .line 45
    .local v4, "sig":[B
    array-length v0, v4

    .line 46
    .local v0, "N":I
    mul-int/lit8 v1, v0, 0x2

    .line 47
    .local v1, "N2":I
    new-array v5, v1, [C

    .line 49
    .local v5, "text":[C
    const/4 v3, 0x0

    .local v3, "j":I
    :goto_0
    if-lt v3, v0, :cond_0

    .line 56
    return-object v5

    .line 50
    :cond_0
    aget-byte v6, v4, v3

    .line 51
    .local v6, "v":B
    shr-int/lit8 v7, v6, 0x4

    and-int/lit8 v2, v7, 0xf

    .line 52
    .local v2, "d":I
    mul-int/lit8 v8, v3, 0x2

    if-lt v2, v9, :cond_1

    add-int/lit8 v7, v2, 0x61

    add-int/lit8 v7, v7, -0xa

    :goto_1
    int-to-char v7, v7

    aput-char v7, v5, v8

    .line 53
    and-int/lit8 v2, v6, 0xf

    .line 54
    mul-int/lit8 v7, v3, 0x2

    add-int/lit8 v8, v7, 0x1

    if-lt v2, v9, :cond_2

    add-int/lit8 v7, v2, 0x61

    add-int/lit8 v7, v7, -0xa

    :goto_2
    int-to-char v7, v7

    aput-char v7, v5, v8

    .line 49
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 52
    :cond_1
    add-int/lit8 v7, v2, 0x30

    goto :goto_1

    .line 54
    :cond_2
    add-int/lit8 v7, v2, 0x30

    goto :goto_2
.end method


# virtual methods
.method public getApplicationContext()Landroid/content/Context;
    .locals 3

    .prologue
    .line 37
    new-instance v0, Lcom/example/hook/MyContext;

    invoke-super {p0}, Landroid/app/Activity;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lcom/example/hook/MyContext;-><init>(Landroid/content/Context;)V

    .line 38
    .local v0, "myContext":Lcom/example/hook/MyContext;
    sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;

    const-string v2, "\u8c03\u7528\u6211\u7684context"

    invoke-virtual {v1, v2}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    .line 39
    return-object v0
.end method

.method public getSign(Landroid/content/Context;)Ljava/lang/String;
    .locals 7
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 162
    :try_start_0
    invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v1

    .line 164
    .local v1, "manager":Landroid/content/pm/PackageManager;
    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v4

    const/16 v5, 0x40

    .line 163
    invoke-virtual {v1, v4, v5}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;

    move-result-object v2

    .line 165
    .local v2, "packageInfo":Landroid/content/pm/PackageInfo;
    iget-object v3, v2, Landroid/content/pm/PackageInfo;->signatures:[Landroid/content/pm/Signature;

    .line 166
    .local v3, "signs":[Landroid/content/pm/Signature;
    sget-object v4, Ljava/lang/System;->out:Ljava/io/PrintStream;

    new-instance v5, Ljava/lang/StringBuilder;

    const-string v6, "\u8fd9\u662f\u7b7e\u540d"

    invoke-direct {v5, v6}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const/4 v6, 0x0

    aget-object v6, v3, v6

    invoke-virtual {v6}, Landroid/content/pm/Signature;->toCharsString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    .line 167
    const/4 v4, 0x0

    aget-object v4, v3, v4

    invoke-virtual {v4}, Landroid/content/pm/Signature;->toCharsString()Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v4

    .line 171
    .end local v1    # "manager":Landroid/content/pm/PackageManager;
    .end local v2    # "packageInfo":Landroid/content/pm/PackageInfo;
    .end local v3    # "signs":[Landroid/content/pm/Signature;
    :goto_0
    return-object v4

    .line 168
    :catch_0
    move-exception v0

    .line 169
    .local v0, "e":Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 170
    sget-object v4, Ljava/lang/System;->out:Ljava/io/PrintStream;

    const-string v5, "\u3002\u3002\u3002\u3002\u3002"

    invoke-virtual {v4, v5}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    .line 171
    const/4 v4, 0x0

    goto :goto_0
.end method

.method protected onCreate(Landroid/os/Bundle;)V
    .locals 4
    .param p1, "savedInstanceState"    # Landroid/os/Bundle;

    .prologue
    .line 27
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

    .line 28
    const/high16 v2, 0x7f030000

    invoke-virtual {p0, v2}, Lcom/example/hook/MainActivity;->setContentView(I)V

    .line 29
    invoke-virtual {p0}, Lcom/example/hook/MainActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v2

    invoke-virtual {v2}, Landroid/content/Context;->getPackageResourcePath()Ljava/lang/String;

    move-result-object v0

    .line 30
    .local v0, "path":Ljava/lang/String;
    invoke-static {v0}, Lcom/example/hook/MainActivity;->getApkSignInfo(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 31
    .local v1, "signinfo":Ljava/lang/String;
    const-string v2, "1111"

    invoke-static {v2, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 32
    sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;

    invoke-virtual {p0}, Lcom/example/hook/MainActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v3

    invoke-virtual {p0, v3}, Lcom/example/hook/MainActivity;->getSign(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    .line 35
    return-void
.end method
