11# APDU Response Decoder
22
3- APDU Response Decoder是一个用于解析和显示Flipper Zero NFC APDU Runner应用程序生成的 ` .apdures ` 文件的工具。
3+ APDU Response Decoder is a tool for parsing and displaying ` .apdures ` files generated by the Flipper Zero NFC APDU Runner application.
44
5- ## 功能特点
5+ ## Features
66
7- - 支持从本地文件加载 ` .apdures ` 文件
8- - 支持直接从Flipper Zero设备加载 ` .apdures ` 文件(通过SD卡挂载或串口通信)
9- - 支持自定义解码格式模板
10- - 美观的彩色输出
7+ - Support for loading ` .apdures ` files from local storage
8+ - Support for loading ` .apdures ` files directly from Flipper Zero devices (via SD card mounting or serial communication)
9+ - Support for custom decoding format templates
10+ - Beautiful colored output
1111
12- ## 安装
12+ ## Installation
1313
14- ### 安装依赖
14+ ### Install Dependencies
1515
1616``` bash
1717go get go.bug.st/serial
@@ -20,92 +20,92 @@ go get github.com/spf13/cobra
2020go get github.com/fatih/color
2121```
2222
23- ### 构建
23+ ### Build
2424
2525``` bash
2626go build -o response_decoder
2727```
2828
29- ## 使用方法
29+ ## Usage
3030
31- ### 从本地文件加载
31+ ### Load from Local File
3232
3333``` bash
3434./response_decoder -f path/to/file.apdures
3535```
3636
37- ### 从Flipper Zero设备加载(SD卡挂载)
37+ ### Load from Flipper Zero Device (SD Card Mount)
3838
3939``` bash
4040./response_decoder -d
4141```
4242
43- ### 从Flipper Zero设备加载(串口通信)
43+ ### Load from Flipper Zero Device (Serial Communication)
4444
4545``` bash
4646./response_decoder -d -s
4747```
4848
49- 如果需要指定串口:
49+ If you need to specify a serial port:
5050
5151``` bash
5252./response_decoder -d -s -p /dev/tty.usbmodem123456
5353```
5454
55- ### 使用自定义解码格式
55+ ### Use Custom Decoding Format
5656
5757``` bash
5858./response_decoder -f file.apdures --decode-format path/to/format.apdufmt
5959```
6060
61- ## 解码格式模板
61+ ## Decoding Format Templates
6262
63- 解码格式模板是一个文本文件,用于定义如何解析和显示APDU响应数据。模板文件的第一行是格式名称,后续行是解码规则。
63+ A decoding format template is a text file that defines how to parse and display APDU response data. The first line of the template file is the format name, and subsequent lines are decoding rules.
6464
65- 例如,PBOC格式模板:
65+ For example, a PBOC format template:
6666
6767```
6868PBOC
69- 卡号 : {hex(O[1][10:18])}
70- 姓名 : {hex(O[2][10:20], "utf-8")}
71- 余额 : {hex(O[3][10:18])} 元
72- 有效期 : 20{O[4][10:12]}-{O[4][12:14]}
73- 交易记录 : {hex(O[5][10:30])}
69+ Card Number : {hex(O[1][10:18])}
70+ Name : {hex(O[2][10:20], "utf-8")}
71+ Balance : {hex(O[3][10:18])} Yuan
72+ Valid Until : 20{O[4][10:12]}-{O[4][12:14]}
73+ Transaction Record : {hex(O[5][10:30])}
7474```
7575
76- ### 模板语法
76+ ### Template Syntax
7777
78- - ` I[n] ` : 第n个输入命令
79- - ` O[n] ` : 第n个输出响应
80- - ` hex(data) ` : 将十六进制字符串转换为可读文本
81- - ` hex(data, "utf-8") ` : 将十六进制字符串按UTF-8编码转换为文本
82- - ` O[n]TAG(tag) ` : 从第n个输出响应中提取指定TLV标签的值
83- - ` O[n]TAG(tag, "encoding") ` : 从第n个输出响应中提取指定TLV标签的值,并按指定编码转换为文本
78+ - ` I[n] ` : The nth input command
79+ - ` O[n] ` : The nth output response
80+ - ` hex(data) ` : Convert a hexadecimal string to readable text
81+ - ` hex(data, "utf-8") ` : Convert a hexadecimal string to text using UTF-8 encoding
82+ - ` O[n]TAG(tag) ` : Extract the value of the specified TLV tag from the nth output response
83+ - ` O[n]TAG(tag, "encoding") ` : Extract the value of the specified TLV tag from the nth output response and convert it to text using the specified encoding
8484
85- ### TLV解析
85+ ### TLV Parsing
8686
87- 本工具支持解析EMV和其他智能卡中常用的TLV( Tag-Length-Value)数据结构。TLV解析功能允许您直接从APDU响应中提取特定标签的值,而无需手动计算偏移量。
87+ This tool supports parsing TLV ( Tag-Length-Value) data structures commonly used in EMV and other smart cards. The TLV parsing functionality allows you to extract values for specific tags directly from APDU responses without manually calculating offsets.
8888
89- 支持的编码类型:
90- - ` utf-8 ` : UTF-8编码
91- - ` ascii ` : ASCII编码
92- - ` numeric ` : 数字编码(如BCD码)
89+ Supported encoding types:
90+ - ` utf-8 ` : UTF-8 encoding
91+ - ` ascii ` : ASCII encoding
92+ - ` numeric ` : Numeric encoding (such as BCD code)
9393
94- #### TLV模板示例
94+ #### TLV Template Example
9595
96- EMV格式模板:
96+ EMV format template:
9797
9898```
99- EMV卡片信息
100- 卡号 : {O[1]TAG(5A), "numeric"}
101- 持卡人姓名 : {O[2]TAG(5F20), "utf-8"}
102- 有效期 : {O[2]TAG(5F24), "numeric"}
103- 货币代码 : {O[3]TAG(9F42)}
104- 余额 : {O[3]TAG(9F79)}
105- 交易日志 : {O[4]TAG(9F4D)}
106- 应用标签 : {O[0]TAG(50), "ascii"}
99+ EMV Card Information
100+ Card Number : {O[1]TAG(5A), "numeric"}
101+ Cardholder Name : {O[2]TAG(5F20), "utf-8"}
102+ Expiration Date : {O[2]TAG(5F24), "numeric"}
103+ Currency Code : {O[3]TAG(9F42)}
104+ Balance : {O[3]TAG(9F79)}
105+ Transaction Log : {O[4]TAG(9F4D)}
106+ Application Label : {O[0]TAG(50), "ascii"}
107107```
108108
109- ## 许可证
109+ ## License
110110
111- GNU通用公共许可证第3版 (GPL-3.0)
111+ GNU General Public License v3.0 (GPL-3.0)
0 commit comments