【问题标题】:Log all calls to .tranceive()记录所有对 .tranceive() 的调用
【发布时间】:2016-07-04 10:29:14
【问题描述】:

有没有办法记录发送到 NFC 标签的 tranceive 方法的二进制数据? https://developer.android.com/reference/android/nfc/tech/NfcV.html#transceive(byte[])

我正在尝试查找协议中最后几个缺失的部分,如果我能听到发送的数据会有所帮助。

【问题讨论】:

    标签: android debugging nfc iso-15693


    【解决方案1】:

    我猜:

    • 您想要监控从您已安装的应用程序发送的 APDU/字节。
    • 您已经搜索过有关该特定协议的信息,但一无所获。
    • 在 Logcat 中,不显示相关信息(默认情况下)。

    抬头看收发源代码

     public byte[] transceive(byte[] data) throws IOException {
           return transceive(data, true);
        }
    

    重定向到:

        byte[] transceive(byte[] data, boolean raw) throws IOException {
            checkConnected();
    
            try {
                TransceiveResult result = mTag.getTagService().transceive(mTag.getServiceHandle(),
                        data, raw);
                if (result == null) {
                    throw new IOException("transceive failed");
                } else {
                    return result.getResponseOrThrow();
                }
            } catch (RemoteException e) {
                Log.e(TAG, "NFC service dead", e);
                throw new IOException("NFC service died");
            }
       }
    

    接下来是 TransceiveResult 类。

    我最好的选择(如果你想走到最后的话)是重新编译一个 Android 源代码,打印出输入到byte[] transceive(byte[] data) 函数的数据。祝你好运。

    编辑:我碰巧意识到的另一个选择是使用 APDU 嗅探器,尽管我不知道这个选项有多合法。

    【讨论】:

    • 你的猜测是对的 :) 我认为重新编译 android 是唯一的方法;但恐怕我没有时间这样做。不过还是谢谢。
    猜你喜欢
    • 2016-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-20
    • 1970-01-01
    相关资源
    最近更新 更多