nfcscript 0.0.12__tar.gz → 0.0.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nfcscript-0.0.12 → nfcscript-0.0.13}/PKG-INFO +1 -1
- {nfcscript-0.0.12 → nfcscript-0.0.13}/pyproject.toml +2 -2
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/reader.py +16 -15
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfcscript.egg-info/PKG-INFO +1 -1
- {nfcscript-0.0.12 → nfcscript-0.0.13}/README.md +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/setup.cfg +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/__init__.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/assertions.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/bits.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/checksum.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/cli.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/delay.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/hex_util.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/nfc_cli.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfc/trace.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfcscript.egg-info/SOURCES.txt +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfcscript.egg-info/dependency_links.txt +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfcscript.egg-info/entry_points.txt +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfcscript.egg-info/requires.txt +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/src/nfcscript.egg-info/top_level.txt +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/tests/test_assertions.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/tests/test_bits.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/tests/test_checksum.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/tests/test_cli.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/tests/test_cli_collect.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/tests/test_delay.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/tests/test_hex_util.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/tests/test_reader.py +0 -0
- {nfcscript-0.0.12 → nfcscript-0.0.13}/tests/test_trace.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nfcscript"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.13"
|
|
4
4
|
description = "A plugin-based core engine for DSL-style NFC testing automation."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.14"
|
|
@@ -34,7 +34,7 @@ dev = [
|
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
[tool.bumpversion]
|
|
37
|
-
current_version = "0.0.
|
|
37
|
+
current_version = "0.0.13"
|
|
38
38
|
commit = true
|
|
39
39
|
tag = true
|
|
40
40
|
allow_dirty = true
|
|
@@ -103,7 +103,7 @@ def active(low_layer: bool = False, ignore_error: bool = False, reqa_cmd: int =
|
|
|
103
103
|
# 手动底层寻卡流程
|
|
104
104
|
# 1. REQA
|
|
105
105
|
res_reqa = reqa(cmd=reqa_cmd)
|
|
106
|
-
if not res_reqa:
|
|
106
|
+
if not res_reqa.data:
|
|
107
107
|
return None
|
|
108
108
|
atq = res_reqa.data
|
|
109
109
|
|
|
@@ -111,7 +111,7 @@ def active(low_layer: bool = False, ignore_error: bool = False, reqa_cmd: int =
|
|
|
111
111
|
full_uid = []
|
|
112
112
|
for cl in [1, 2, 3]:
|
|
113
113
|
res = anticoll(cl_level=cl, nvb=0x20)
|
|
114
|
-
if not res
|
|
114
|
+
if not res.data:
|
|
115
115
|
return None
|
|
116
116
|
|
|
117
117
|
data = res.data
|
|
@@ -171,7 +171,7 @@ def transceive(data: list[int], tx_crc: bool = True, rx_crc: bool = True) -> lis
|
|
|
171
171
|
return res.data if res and res.data else []
|
|
172
172
|
|
|
173
173
|
|
|
174
|
-
def transceive_bits(data: list[int], last_tx_bits: int = 0, tx_crc: bool = True, rx_crc: bool = True) -> TransceiveBits
|
|
174
|
+
def transceive_bits(data: list[int], last_tx_bits: int = 0, tx_crc: bool = True, rx_crc: bool = True) -> TransceiveBits:
|
|
175
175
|
"""
|
|
176
176
|
使用底层帧交互方式发送数据,并支持对最后一个字节进行位控制。
|
|
177
177
|
|
|
@@ -182,14 +182,15 @@ def transceive_bits(data: list[int], last_tx_bits: int = 0, tx_crc: bool = True,
|
|
|
182
182
|
rx_crc: 接收时是否自动校验 CRC。False 则原样接收不校验。
|
|
183
183
|
|
|
184
184
|
Returns:
|
|
185
|
-
TransceiveBits
|
|
185
|
+
TransceiveBits: 包含 data 和 bits 属性,失败返回空的 TransceiveBits(data=[], bits=0)。
|
|
186
186
|
"""
|
|
187
187
|
_state.ensure_connected()
|
|
188
188
|
reader = _state.reader
|
|
189
|
-
|
|
189
|
+
res = reader.transceive(data, last_tx_bits=last_tx_bits, tx_crc=tx_crc, rx_crc=rx_crc)
|
|
190
|
+
return res if res else TransceiveBits(data=[], bits=0)
|
|
190
191
|
|
|
191
192
|
|
|
192
|
-
def reqa(cmd: int = 0x26) -> TransceiveBits
|
|
193
|
+
def reqa(cmd: int = 0x26) -> TransceiveBits:
|
|
193
194
|
"""
|
|
194
195
|
ISO14443-A REQA (7 bits)。
|
|
195
196
|
|
|
@@ -197,27 +198,27 @@ def reqa(cmd: int = 0x26) -> TransceiveBits | None:
|
|
|
197
198
|
cmd: REQA 命令字节,默认 0x26。
|
|
198
199
|
|
|
199
200
|
Returns:
|
|
200
|
-
TransceiveBits
|
|
201
|
+
TransceiveBits: 包含 data 和 bits 属性,失败返回空的 TransceiveBits(data=[], bits=0)。
|
|
201
202
|
"""
|
|
202
203
|
return transceive_bits([cmd], last_tx_bits=7, tx_crc=False, rx_crc=False)
|
|
203
204
|
|
|
204
205
|
|
|
205
|
-
def wupa() -> TransceiveBits
|
|
206
|
+
def wupa() -> TransceiveBits:
|
|
206
207
|
"""
|
|
207
208
|
ISO14443-A WUPA (7 bits)。
|
|
208
209
|
|
|
209
210
|
Returns:
|
|
210
|
-
TransceiveBits
|
|
211
|
+
TransceiveBits: 包含 data 和 bits 属性,失败返回空的 TransceiveBits(data=[], bits=0)。
|
|
211
212
|
"""
|
|
212
213
|
return transceive_bits([0x52], last_tx_bits=7, tx_crc=False, rx_crc=False)
|
|
213
214
|
|
|
214
215
|
|
|
215
|
-
def halt() -> list[int]
|
|
216
|
+
def halt() -> list[int]:
|
|
216
217
|
"""
|
|
217
218
|
ISO14443-A HALT (Standard Frame)。
|
|
218
219
|
|
|
219
220
|
Returns:
|
|
220
|
-
list[int]
|
|
221
|
+
list[int]: 返回响应数据。
|
|
221
222
|
"""
|
|
222
223
|
return transceive([0x50, 0x00], tx_crc=True, rx_crc=True)
|
|
223
224
|
|
|
@@ -241,7 +242,7 @@ def _get_sel_cmd(cl_level: int) -> int:
|
|
|
241
242
|
return sel_map[cl_level]
|
|
242
243
|
|
|
243
244
|
|
|
244
|
-
def anticoll(cl_level: int, nvb: int = 0x20, uid_prefix: list[int] = []) -> TransceiveBits
|
|
245
|
+
def anticoll(cl_level: int, nvb: int = 0x20, uid_prefix: list[int] = []) -> TransceiveBits:
|
|
245
246
|
"""
|
|
246
247
|
ISO14443-A ANTICOLL (Anti-collision)。
|
|
247
248
|
|
|
@@ -251,13 +252,13 @@ def anticoll(cl_level: int, nvb: int = 0x20, uid_prefix: list[int] = []) -> Tran
|
|
|
251
252
|
uid_prefix: 已知的部分 UID (0-4 字节)。
|
|
252
253
|
|
|
253
254
|
Returns:
|
|
254
|
-
TransceiveBits
|
|
255
|
+
TransceiveBits: 包含 data 和 bits 属性,失败返回空的 TransceiveBits(data=[], bits=0)。
|
|
255
256
|
"""
|
|
256
257
|
cmd = [_get_sel_cmd(cl_level), nvb] + uid_prefix
|
|
257
258
|
return transceive_bits(cmd, last_tx_bits=0, tx_crc=False, rx_crc=False)
|
|
258
259
|
|
|
259
260
|
|
|
260
|
-
def select(cl_level: int, uid: list[int]) -> list[int]
|
|
261
|
+
def select(cl_level: int, uid: list[int]) -> list[int]:
|
|
261
262
|
"""
|
|
262
263
|
ISO14443-A SELECT (Standard Frame)。
|
|
263
264
|
|
|
@@ -266,7 +267,7 @@ def select(cl_level: int, uid: list[int]) -> list[int] | None:
|
|
|
266
267
|
uid: 完整 5 字节 UID (包含 BCC)。
|
|
267
268
|
|
|
268
269
|
Returns:
|
|
269
|
-
list[int]
|
|
270
|
+
list[int]: 返回响应数据。
|
|
270
271
|
"""
|
|
271
272
|
cmd = [_get_sel_cmd(cl_level), 0x70] + uid
|
|
272
273
|
return transceive(cmd, tx_crc=True, rx_crc=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|