2014-01-24 74 views
1

我用dex2jar工具來反編譯的apk文件, 的所有代碼可以正確反編譯,但是這種方法,爲什麼不能從android apk反編譯這個方法?

// ERROR // 
    public void sendPacket(byte[] paramArrayOfByte) 
    { 
    // Byte code: 
    // 0: new 82 android/net/LocalSocket 
    // 3: dup 
    // 4: invokespecial 83 android/net/LocalSocket:<init> ()V 
    // 7: astore_2 
    // 8: aload_2 
    // 9: new 85 android/net/LocalSocketAddress 
    // 12: dup 
    // 13: ldc 87 
    // 15: getstatic 93 android/net/LocalSocketAddress$Namespace:FILESYSTEM Landroid/net/LocalSocketAddress$Namespace; 
    // 18: invokespecial 96 android/net/LocalSocketAddress:<init> (Ljava/lang/String;Landroid/net/LocalSocketAddress$Namespace;)V 
    // 21: invokevirtual 100 android/net/LocalSocket:connect (Landroid/net/LocalSocketAddress;)V 
    // 24: aload_2 
    // 25: invokevirtual 104 android/net/LocalSocket:getOutputStream()Ljava/io/OutputStream; 
    // 28: astore 7 
    // 30: aload_2 
    // 31: invokevirtual 108 android/net/LocalSocket:getInputStream ()Ljava/io/InputStream; 
    // 34: astore 8 
    // 36: aload 7 
    // 38: aload_1 
    // 39: invokevirtual 113 java/io/OutputStream:write ([B)V 
    // 42: aload 7 
    // 44: invokevirtual 116 java/io/OutputStream:flush ()V 
    // 47: sipush 128 
    // 50: newarray byte 
    // 52: astore 9 
    // 54: aload 8 
    // 56: aload 9 
    // 58: invokevirtual 122 java/io/InputStream:read ([B)I 
    // 61: pop 
    // 62: new 124 com/qualcomm/logkit/settings/ConfigPacket 
    // 65: dup 
    // 66: aload 9 
    // 68: invokespecial 126 com/qualcomm/logkit/settings/ConfigPacket:<init> ([B)V 
    // 71: astore 11 
    // 73: aload 11 
    // 75: getfield 130 com/qualcomm/logkit/settings/ConfigPacket:msg_type B 
    // 78: tableswitch default:+26 -> 104, -127:+50->128, -126:+26->104, -125:+95->173 
    // 105: iconst_4 
    // 106: invokevirtual 133 java/io/OutputStream:close ()V 
    // 109: aload 8 
    // 111: invokevirtual 134 java/io/InputStream:close ()V 
    // 114: aload_2 
    // 115: ifnull +7 -> 122 
    // 118: aload_2 
    // 119: invokevirtual 135 android/net/LocalSocket:close ()V 
    // 122: aload_0 
    // 123: iconst_0 
    // 124: putfield 18 com/qualcomm/logkit/settings/UnixSocketSendThread:isRunning Z 
    // 127: return 
    // 128: aload 11 
    // 130: getfield 139 com/qualcomm/logkit/settings/ConfigPacket:logConfig Lcom/qualcomm/logkit/settings/ConfigPacket$qlog_conf; 
    // 133: getfield 144 com/qualcomm/logkit/settings/ConfigPacket$qlog_conf:filter_str [B 
    // 136: invokestatic 150 com/qualcomm/logkit/utils/UtilsStringOperation:byteToString ([B)Ljava/lang/String; 
    // 139: invokestatic 152 com/qualcomm/logkit/settings/UnixSocketSendThread:logd (Ljava/lang/Object;)V 
    // 142: goto -38 -> 104 
    // 145: astore 5 
    // 147: aload 5 
    // 149: invokestatic 154 com/qualcomm/logkit/settings/UnixSocketSendThread:loge (Ljava/lang/Object;)V 
    // 152: aload_2 
    // 153: ifnull -31 -> 122 
    // 156: aload_2 
    // 157: invokevirtual 135 android/net/LocalSocket:close ()V 
    // 160: goto -38 -> 122 
    // 163: astore 6 
    // 165: aload 6 
    // 167: invokestatic 154 com/qualcomm/logkit/settings/UnixSocketSendThread:loge (Ljava/lang/Object;)V 
    // 170: goto -48 -> 122 
    // 173: aload 11 
    // 175: getfield 158 com/qualcomm/logkit/settings/ConfigPacket:logGlobalConfig Lcom/qualcomm/logkit/settings/ConfigPacket$qlog_global_conf; 
    // 178: getfield 163 com/qualcomm/logkit/settings/ConfigPacket$qlog_global_conf:log_path [B 
    // 181: invokestatic 152 com/qualcomm/logkit/settings/UnixSocketSendThread:logd (Ljava/lang/Object;)V 
    // 184: goto -80 -> 104 
    // 187: astore_3 
    // 188: aload_2 
    // 189: ifnull +7 -> 196 
    // 192: aload_2 
    // 193: invokevirtual 135 android/net/LocalSocket:close ()V 
    // 196: aload_3 
    // 197: athrow 
    // 198: astore 12 
    // 200: aload 12 
    // 202: invokestatic 154 com/qualcomm/logkit/settings/UnixSocketSendThread:loge (Ljava/lang/Object;)V 
    // 205: goto -83 -> 122 
    // 208: astore 4 
    // 210: aload 4 
    // 212: invokestatic 154 com/qualcomm/logkit/settings/UnixSocketSendThread:loge (Ljava/lang/Object;)V 
    // 215: goto -19 -> 196 
    // 
    // Exception table: 
    // from to target type 
    // 8 114 145 java/io/IOException 
    // 128 142 145 java/io/IOException 
    // 173 184 145 java/io/IOException 
    // 156 160 163 java/io/IOException 
    // 8 114 187 finally 
    // 128 142 187 finally 
    // 147 152 187 finally 
    // 173 184 187 finally 
    // 118 122 198 java/io/IOException 
    // 192 196 208 java/io/IOException 
    } 

有什麼不對?

+0

dex2jar無法正確解析某些方法,因此您會得到如此的結果。 –

+0

@PankajKumar有沒有比dex2jar更好的工具? –

回答

3

怎麼了?

沒有錯。反編譯器經常遇到代碼太複雜或者被混淆的問題(故意使其難以反編譯...)

你能做些什麼呢?除了手動反編碼代碼之外,沒有太多... (但這並不容易,首先,你需要找出異常處理的範圍,並重新創建try/catch/finally塊。)

+0

只有這種方法不能正確解編譯,其他方法全部解編成功。 –

+0

@VictorS - 這表明代碼沒有被混淆......但並沒有從根本上改變答案。 –

+0

dex2jar和類似的工具臭名昭着的排除有問題的異常處理程序表(重疊範圍,奇怪的不連續性等)。這可能是原因,但除了嘗試另一個反編譯器之外,沒有其他解決方案。 –

1

它或者只是一個反編譯器的限制,或者這種方法被混淆了。儘管通常整個.apks都是混淆的,而不僅僅是一個方法。也許如果你說這是.apk,它會提示更可能的答案。

+0

這是一個內部apk只用作開發工具。 –