diff --git a/.github/workflows/smoke_tests.yml b/.github/workflows/smoke_tests.yml index 2e1ee1398eb..cfc7faf6d22 100644 --- a/.github/workflows/smoke_tests.yml +++ b/.github/workflows/smoke_tests.yml @@ -3,11 +3,7 @@ name: 'Smoke tests' on: push: branches: - - dev - "release*" - tags: - - '*' - pull_request: env: TARGETS: f7 diff --git a/scripts/flippigator/flippigator/extensions/command_result.py b/scripts/flippigator/flippigator/extensions/command_result.py index 27ce6ea8555..55f40e3f839 100644 --- a/scripts/flippigator/flippigator/extensions/command_result.py +++ b/scripts/flippigator/flippigator/extensions/command_result.py @@ -13,8 +13,10 @@ def Result(self): def __init__(self, input): print("input: ", input) s = str(input).split("\n") + # remove empty lines + s = list(filter(None, s)) self.__Command = s[0] - self.__Result = s[1].removeprefix("[+] ").removesuffix(" ") + self.__Result = s[1:] class proxmark_command: diff --git a/scripts/flippigator/flippigator/extensions/proxmark_wrapper.py b/scripts/flippigator/flippigator/extensions/proxmark_wrapper.py index 00b79557000..b61594bec45 100644 --- a/scripts/flippigator/flippigator/extensions/proxmark_wrapper.py +++ b/scripts/flippigator/flippigator/extensions/proxmark_wrapper.py @@ -44,7 +44,7 @@ def execute(self, cmd) -> List[command_result]: result = self.__get_result(data_out) print("result: ", result[0]) - return result + return result[0] def shutdown(self): pass @@ -57,8 +57,8 @@ def __parse_data(self, output_data): raw_result = str(output_data).split("[usb|script] pm3 --> ") print("raw_result: ", raw_result) + print("-------------------------------------") result = [] for raw in raw_result[1:]: - print("raw: ", raw) result.append(command_result(raw).Result) return result diff --git a/scripts/flippigator/flippigator/flippigator.py b/scripts/flippigator/flippigator/flippigator.py index 351de9be62f..a837e9bd9fc 100644 --- a/scripts/flippigator/flippigator/flippigator.py +++ b/scripts/flippigator/flippigator/flippigator.py @@ -46,6 +46,8 @@ def __init__( self.logger = logging.getLogger(window_name) if self._debugFlag: self.logger.setLevel(logging.DEBUG) + else: + self.logger.setLevel(logging.WARNING) self.nfc = AppNfc(self) self.rfid = AppRfid(self) @@ -298,14 +300,21 @@ def get_first_item(self, browser: Optional[bool] = False): return menus - def go_to(self, target, area=(0, 64, 0, 128)): + def go_to(self, target, area=(0, 64, 0, 128), direction: Optional[str] = "down"): state = self.get_current_state(area=area) self.logger.info("Going to " + target) while not (target in state): - self.press_down() + if direction == "down": + self.press_down() + elif direction == "up": + self.press_up() state = self.get_current_state(area=area) + def open(self, target, area=(0, 64, 0, 128), direction: Optional[str] = "down"): + self.go_to(target, area, direction) + self.press_ok() + def go_to_main_screen(self): self.press_back() self.press_back() diff --git a/scripts/flippigator/img/ref/Rename.bmp b/scripts/flippigator/img/ref/Rename.bmp new file mode 100644 index 00000000000..196edc6cc85 Binary files /dev/null and b/scripts/flippigator/img/ref/Rename.bmp differ diff --git a/scripts/flippigator/img/ref/Restore Data Changes.bmp b/scripts/flippigator/img/ref/Restore Data Changes.bmp new file mode 100644 index 00000000000..fd6106677ee Binary files /dev/null and b/scripts/flippigator/img/ref/Restore Data Changes.bmp differ diff --git a/scripts/flippigator/img/ref/Update from Initial Card.bmp b/scripts/flippigator/img/ref/Update from Initial Card.bmp new file mode 100644 index 00000000000..c56f9f3ca50 Binary files /dev/null and b/scripts/flippigator/img/ref/Update from Initial Card.bmp differ diff --git a/scripts/flippigator/img/ref/Write to Initial Card.bmp b/scripts/flippigator/img/ref/Write to Initial Card.bmp new file mode 100644 index 00000000000..5cc7152a5b7 Binary files /dev/null and b/scripts/flippigator/img/ref/Write to Initial Card.bmp differ diff --git a/scripts/flippigator/img/ref/browser_T_mfc_4k7.bmp b/scripts/flippigator/img/ref/browser_T_mfc_4k7.bmp new file mode 100644 index 00000000000..f72daac12eb Binary files /dev/null and b/scripts/flippigator/img/ref/browser_T_mfc_4k7.bmp differ diff --git a/scripts/flippigator/img/ref/browser_head_Favorites.bmp b/scripts/flippigator/img/ref/browser_head_Favorites.bmp new file mode 100644 index 00000000000..1a2ab1f364f Binary files /dev/null and b/scripts/flippigator/img/ref/browser_head_Favorites.bmp differ diff --git a/scripts/flippigator/nfc/test_emulate_mifare_classic.py b/scripts/flippigator/nfc/test_emulate_mifare_classic.py new file mode 100644 index 00000000000..9e99f6c9a36 --- /dev/null +++ b/scripts/flippigator/nfc/test_emulate_mifare_classic.py @@ -0,0 +1,186 @@ +import pytest +from flippigator.extensions.proxmark_wrapper import proxmark_wrapper +from flippigator.flippigator import FlipperHEXKeyboard, FlipperTextKeyboard +import time + + +class TestEmulateClassic: + @pytest.fixture(scope="class", autouse=True) + def add_4k7_manually(self, nav): + # Code below will run before each "function" (test) + + # Delete file if exists, needs to be added as picture sadly + # nav.delete_file("NFC", "T_mfc_4k7") + # Todo: return back to line above, after browser is fixed + nav.nfc.go_into() + nav.open("Saved") + menu_items = nav.get_menu_list() + if "browser_T_mfc_4k7" in menu_items: + nav.open("browser_T_mfc_4k7", direction="up") + nav.open("Delete", direction="up") + nav.press_right() + + nav.nfc.go_into() + nav.open("Add Manually") + # direction for faster testing, since its last element + nav.open("Mifare Classic 4k 7byte UID", direction="up") + nav.press_right() + nav.press_ok() + key = FlipperTextKeyboard(nav) + # if you need, you can make another fixture and use any "existing" file name in /img/ref + key.send("T_mfc_4k7\n") + nav.go_to_main_screen() + + # here will be a test call + yield + + # This code will run after each "function" (test) + # nav.delete_file("NFC", "T_mfc_4k7") + # Todo: return back to line above, after browser is fixed + # Todo2: move to function + nav.nfc.go_into() + nav.open("Saved") + menu_items = nav.get_menu_list() + if "browser_T_mfc_4k7" in menu_items: + nav.open("browser_T_mfc_4k7", direction="up") + nav.open("Delete", direction="up") + nav.press_right() + + @pytest.fixture(scope="function") + def emulate_classic(self, nav): + nav.go_to_main_screen() + if nav.open_file("NFC", "T_mfc_4k7") == -1: + assert 0, "File not found" + + # Need for emulation to start, otherwise error on proxmark side + time.sleep(1) + + def test_mfc_4k7_basic(self, px, emulate_classic): + """ + px: proxmark_wrapper fixture + command: command to be executed + expected_result: expected result of the command + error: if the command should return an error + """ + + # read 1 block + read1 = px.execute("hf mf rdbl --blk 1 -k ffffffffffff") + expected = "[=] 1 | FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ................ " + assert expected in read1, "Incorrect block read" + + # write 1 block + write1 = px.execute( + "hf mf wrbl --blk 1 -k ffffffffffff -d 11223344556677889910111213141516" + ) + expected = "[+] Write ( ok )" + assert expected in write1, "Incorrect block write" + + # read 1 block + read1_wrong = px.execute("hf mf rdbl --blk 1 -k ffffffffffff") + expected = '[=] 1 | 11 22 33 44 55 66 77 88 99 10 11 12 13 14 15 16 | ."3DUfw......... ' + assert expected in read1_wrong, "Incorrect block read" + + # set value block + set_value = px.execute("hf mf value --blk 1 -k ffffffffffff --set 1000") + expected = "[=] set value to : 1000" + expected_status = "[+] Update ... : success" + assert expected in set_value, "Incorrect set value" + assert expected_status in set_value, "Update failed" + + # increment value block + inc_value = px.execute("hf mf value --blk 1 -k ffffffffffff --inc 200") + expected = "[=] Value incremented by : 200" + expected_status = "[+] Update ... : success" + + assert expected in inc_value, "Incorrect increment value" + assert expected_status in inc_value, "Update failed" + + # decrement value block + dec_value = px.execute("hf mf value --blk 1 -k ffffffffffff --dec 10000") + expected = "[=] Value decremented by : 10000" + expected_status = "[+] Update ... : success" + assert expected in dec_value, "Incorrect decrement value" + assert expected_status in dec_value, "Update failed" + + # change key A in 0 sector + change_key = px.execute( + "hf mf wrbl --blk 3 -k ffffffffffff -d a0a1a2a3a4a5ff078069ffffffffffff" + ) + expected = "[=] data: A0 A1 A2 A3 A4 A5 FF 07 80 69 FF FF FF FF FF FF" + expected_status = "[+] Write ( ok )" + assert expected in change_key, "Incorrect change key" + assert expected_status in change_key, "Update failed" + + # read 1 block with old key + read1 = px.execute("hf mf rdbl --blk 1 -k ffffffffffff") + expected_status = "[#] Auth error" + assert expected_status in read1, "Auth error not present" + + # read 1 block with new key + read1 = px.execute("hf mf rdbl --blk 1 -k a0a1a2a3a4a5") + expected = "[=] 1 | E8 03 00 00 17 FC FF FF E8 03 00 00 01 FE 01 FE | ................ " + assert expected in read1, "Incorrect block read" + + # all tests below are non-functional, need help verifying them + # change key B in 0 sector + # change_key = px.execute("hf mf wrbl --blk 3 -k ffffffffffff -d ffffffffffff078069b0b1b2b3b4b5ff") + # assert change_key[0] == "Block write OK", "Incorrect change key" + + # read sector trailer with key A + # trailer_a_key = px.execute("hf mf rdbl --blk 3 -k a0a1a2a3a4a5") + # assert trailer_a_key[0] == "Key A not present, Access Bits present, Key B present in the output", "Incorrect trailer read" + + # read sector trailer with key B + # trailer_b_key = px.execute("hf mf rdbl --blk 3 -b -k b0b1b2b3b4b5") + # assert trailer_b_key[0] == "Key A not present, Access Bits not present, Key B not present in the output", "Incorrect trailer read" + + # FF0F00 http://calc.gmss.ru/Mifare1k/ hf mf wrbl --blk 3 -k ffffffffffff -d ffffffffffffff0f0069ffffffffffff + # hf mf rdbl --blk 3 -k ffffffffffff No keyA, ACs, KeyB + # hf mf rdbl --blk 3 -b -k ffffffffffff No KeyA, No ACs, No KeyB + # hf mf wrbl --blk 3 -k ffffffffffff -d a0a1a2a3a4a5ff0f0069b0b1b2b3b4b5 Keys changed + # hf mf wrbl --blk 3 -b -k ffffffffffff -d a1a2a3a4a5a6ff0f0069b1b2b3b4b5b6 Keys not changed + # hf mf wrbl --blk 3 (-b) -k ffffffffffff -d a1a2a3a4a5a6ff078069b1b2b3b4b5b6 ACs not changed + + data = [ + ( + "FF0F00", + [ + ( + "hf mf wrbl --blk 3 -k ffffffffffff -d ffffffffffffff0f0069ffffffffffff", + "[+] Write ( ok )", + ), + ( + "hf mf rdbl --blk 3 -k ffffffffffff", + "[=] 3 | 00 00 00 00 00 00 FF 0F 00 69 FF FF FF FF FF FF | .........i......", + ), + ( + "hf mf rdbl --blk 3 -b -k ffffffffffff", + "[#] Read block error", + ), # [#] Read block error + ( + "hf mf wrbl --blk 3 -k ffffffffffff -d a0a1a2a3a4a5ff0f0069b0b1b2b3b4b5", + "[+] Write ( ok )", + ), + ( + "hf mf wrbl --blk 3 -b -k b0b1b2b3b4b5 -d a1a2a3a4a5a6ff0f0069b1b2b3b4b5b6", + "[-] ⛔ Write ( fail )", + ), + ( + "hf mf wrbl --blk 3 -k a0a1a2a3a4a5 -d a1a2a3a4a5a6ff078069b1b2b3b4b5b6", + "[+] Write ( ok )", + ), + ( + "hf mf wrbl --blk 3 -b -k b1b2b3b4b5b6 -d a1a2a3a4a5a6ff078069b1b2b3b4b5b6", + "[-] ⛔ Write ( fail )", + ), + ], + ), + ] + + @pytest.mark.parametrize("condition, cmds", data) + def test_trailer_access_condition(self, px, emulate_classic, condition, cmds): + for i, cmd in enumerate(cmds): + command = cmd[0] + expected = cmd[1] + result = px.execute(command) + assert expected in result, f"{i}: {command} failed" diff --git a/scripts/flippigator/nfc/test_emulate_ntag213.py b/scripts/flippigator/nfc/test_emulate_ntag213.py index 4d46897d378..93596f3c98a 100644 --- a/scripts/flippigator/nfc/test_emulate_ntag213.py +++ b/scripts/flippigator/nfc/test_emulate_ntag213.py @@ -11,20 +11,26 @@ def emulate_ntag213(self, nav): if nav.open_file("NFC", "T_Ntag_213") == -1: assert 0, "File not found" + @pytest.fixture(scope="function") + def reset_card_and_emulate(self, nav): + nav.nfc.go_into() + nav.open("Saved") + nav.open("browser_T_Ntag_213", direction="up") + menu_items = nav.get_menu_list() + if "Restore Data Changes" in menu_items: + nav.open("Restore Data Changes", direction="up") + nav.press_right() + time.sleep(1) + + nav.go_to_main_screen() + if nav.open_file("NFC", "T_Ntag_213") == -1: + assert 0, "File not found" + @pytest.mark.skip(reason="not implemented") def test_ntag213_basic(self, px): - # nav.go_to_main_screen() - # - # if nav.open_file("NFC", "Ntag213") == -1: - # assert 0, "File not found" - # nav.get_current_state() - - # data = px.execute_single("hf 14a raw -sc 3000") - # repeat previous line with enter button in the end - # data = px.execute(["hf 14a raw -sc 3000\n"]) - # - # print(data) - # result = px.execute_single("hf 14a raw -sc 3000") + """ + Todo: Rewrite proper example (not up to date) + """ pm = proxmark_wrapper("/home/vk/work/proxmark3/pm3") # pm.execute_single("hf 14a raw -sc 3000") @@ -34,32 +40,11 @@ def test_ntag213_basic(self, px): print(result) print("-------------------------------------") - # result = px.execute(["hf 14a raw -sc 3000\n","hf 14a raw -sc 3000\n","hf 14a raw -sc 3001\n"]) - # print(result) - assert ( result == "04 63 5D B2 9A 5A 12 90 42 48 00 00 E1 10 6D 00 [ 65 9C ]" ), "Incorrect data on NFC card" - # reader_nfc.go_to_place() - # reader_nfc.clear() - # - # if nav.open_file("NFC", "BN2") == -1: - # assert 0, "File not found" - # nav.get_current_state() - # - # start_time = time.time() - # while start_time + 5 > time.time(): - # if reader_nfc.update(): - # string = reader_nfc.get() - # assert string == "W58W60950399D1334", "Emulated NFC card reading failed" - # break - # - # if start_time + 5 < time.time(): - # assert 0, "Timeout of emulation" - - # nav.go_to_main_screen() - - Test_Data = [ + + test_data_byte_0 = [ ("hf 14a raw -sc A229440024FF", "0A", "Error: NFC card not found"), ( "hf 14a raw -sc 3024", @@ -73,34 +58,34 @@ def test_ntag213_basic(self, px): ), ( "hf 14a raw -sc 3025", - "46 46 43 41 34 44 35 44 38 30 00 00 00 AA AA BD [ 32 A3 ]", + "46 46 43 41 34 44 35 44 38 30 00 00 00 00 00 BD [ 10 8D ]", "Error: Incorrect data on NFC card", ), ] - @pytest.mark.parametrize("command, expected_result, error", Test_Data) + @pytest.mark.parametrize("command, expected_result, error", test_data_byte_0) def test_ascii_mirror_uid(self, px, command, expected_result, error): px_result = px.execute(command) result = px_result[0] - assert expected_result == result, error + assert expected_result in result, error test_data_byte_1 = [ ("hf 14a raw -sc A229440024FF", "0A", "Error: NFC card not found"), ( "hf 14a raw -sc 3024", - "30 34 42 41 46 46 43 41 34 44 35 44 38 30 00 00 [ E9 19 ]", + "00 30 34 42 41 46 46 43 41 34 44 35 44 38 30 00 [ 45 02 ]", "Error: Incorrect data on NFC card", ), ( "hf 14a raw -sc 3023", - "00 00 00 00 30 34 42 41 46 46 43 41 34 44 35 44 [ 1C AC ]", + "00 00 00 00 00 30 34 42 41 46 46 43 41 34 44 35 [ B1 7C ]", "Error: Incorrect data on NFC card", ), ( "hf 14a raw -sc 3025", - "46 46 43 41 34 44 35 44 38 30 00 00 00 AA AA BD [ 32 A3 ]", + "41 46 46 43 41 34 44 35 44 38 30 00 00 00 00 BD [ 14 04 ]", "Error: Incorrect data on NFC card", ), ] @@ -111,23 +96,23 @@ def test_ascii_mirror_uid_byte_1(self, px, command, expected_result, error): result = px_result[0] - assert expected_result == result, error + assert expected_result in result, error test_data_byte_2 = [ ("hf 14a raw -sc A229540024FF", "0A", "Error: NFC card not found"), ( "hf 14a raw -sc 3024", - "00 30 34 42 41 46 46 43 41 34 44 35 44 38 30 00 [ 45 02 ]", + "00 00 30 34 42 41 46 46 43 41 34 44 35 44 38 30 [ EE 77 ]", "Error: Incorrect data on NFC card", ), ( "hf 14a raw -sc 3023", - "00 00 00 00 00 30 34 42 41 46 46 43 41 34 44 35 [ B1 7C ]", + "00 00 00 00 00 00 30 34 42 41 46 46 43 41 34 44 [ 76 6C ]", "Error: Incorrect data on NFC card", ), ( "hf 14a raw -sc 3025", - "41 46 46 43 41 34 44 35 44 38 30 00 00 AA AA BD [ 36 2A ]", + "42 41 46 46 43 41 34 44 35 44 38 30 00 00 00 BD [ 68 FA ]", "Error: Incorrect data on NFC card", ), ] @@ -138,78 +123,74 @@ def test_ascii_mirror_uid_byte_2(self, px, command, expected_result, error): result = px_result[0] - assert expected_result == result, error + assert expected_result in result, error - test_data_ascii_counter_0 = [ - ("hf 14a raw -sc A22A00050000", "0A"), - ("hf 14a raw -sc A229840026FF", "0A"), - ( - "hf 14a raw -sc 3025", - "00 00 00 00 00 00 00 00 00 00 00 00 00 AA AA BD [ 7B 09 ]", - ), + test_data_byte_3 = [ + ("hf 14a raw -sc A229540024FF", "0A", "Error: NFC card not found"), ( - "hf 14a raw -sc 3026", - "00 00 00 00 00 00 00 00 00 AA AA BD 84 00 26 FF [ DB E9 ]", + "hf 14a raw -sc 3024", + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 37 49 ]", + "Error: Incorrect data on NFC card", ), ( - "hf 14a raw -sc 3027", - "00 00 00 00 00 AA AA BD 84 00 26 FF 00 05 00 00 [ E3 5C ]", + "hf 14a raw -sc 3023", + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 37 49 ]", + "Error: Incorrect data on NFC card", ), - ("hf 14a raw -sc A22A10050000", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 30 30 30 30 30 30 00 00 00 AA AA BD [ 54 E9 ]", + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BD [ 59 27 ]", + "Error: Incorrect data on NFC card", ), + ] + + @pytest.mark.parametrize("command, expected_result, error", test_data_byte_3) + def test_ascii_mirror_uid_byte_3(self, px, command, expected_result, error): + px_result = px.execute(command) + + result = px_result[0] + + assert expected_result in result, error + + test_data_ascii_counter_0 = [ + ("hf 14a raw -sc A22A00050000", "0A"), + ("hf 14a raw -sc A229840026FF", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 30 30 30 30 30 31 00 00 00 AA AA BD [ 81 76 ]", - ), - ( - "hf 14a raw -sck 3025", - "00 00 00 00 30 30 30 30 30 32 00 00 00 AA AA BD [ EF DE ]", - ), - ( - "hf 14a raw -ac 3025", - "00 00 00 00 30 30 30 30 30 33 00 00 00 AA AA BD [ 3A 41 ]", + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BD [ 59 27 ]", ), ( "hf 14a raw -sc 3026", - "30 30 30 30 30 33 00 00 00 AA AA BD 84 00 26 FF [ 63 23 ]", + "00 00 00 00 00 00 00 00 00 00 00 BD 84 00 26 FF [ DE 4C ]", ), ( "hf 14a raw -sc 3027", - "30 34 00 00 00 AA AA BD 84 00 26 FF 10 05 00 00 [ 4F B2 ]", + "00 00 00 00 00 00 00 BD 84 00 26 FF 00 05 00 00 [ DE 04 ]", ), - ("hf 14a raw -sc A22A00050000", "0A"), - ] - - ASCII_COUNTER_1 = [ - ("hf 14a raw -sc A22A00050000", "0A"), - ("hf 14a raw -sc A229940026FF", "0A"), + ("hf 14a raw -sc A22A10050000", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 00 00 00 00 00 00 00 00 00 AA AA BD [ 7B 09 ]", + "00 00 00 00 30 30 30 30 30 30 00 00 00 00 00 BD [ 76 C7 ]", ), ( - "hf 14a raw -sc 3026", - "00 00 00 00 00 00 00 00 00 AA AA BD 84 00 26 FF [ DB E9 ]", + "hf 14a raw -sc 3025", + "00 00 00 00 30 30 30 30 30 31 00 00 00 00 00 BD [ A3 58 ]", ), ( - "hf 14a raw -sc 3027", - "00 00 00 00 00 AA AA BD 84 00 26 FF 00 05 00 00 [ E3 5C ]", + "hf 14a raw -sck 3025", + "00 00 00 00 30 30 30 30 30 32 00 00 00 00 00 BD [ CD F0 ]", ), - ("hf 14a raw -sc A22A10050000", "0A"), ( - "hf 14a raw -sc 3025", - "00 00 00 00 30 30 30 30 35 39 00 00 00 AA AA BD [ 0C 3F ]", + "hf 14a raw -ac 3025", + "00 00 00 00 30 30 30 30 30 33 00 00 00 00 00 BD [ 18 6F ]", ), ( "hf 14a raw -sc 3026", - "30 30 30 30 35 41 00 00 00 AA AA BD 84 00 26 FF [ A8 56 ]", + "30 30 30 30 30 33 00 00 00 00 00 BD 84 00 26 FF [ 66 86 ]", ), ( "hf 14a raw -sc 3027", - "35 42 00 00 00 AA AA BD 84 00 26 FF 10 05 00 00 [ 5F D8 ]", + "30 34 00 00 00 00 00 BD 84 00 26 FF 10 05 00 00 [ 72 EA ]", ), ("hf 14a raw -sc A22A00050000", "0A"), ] @@ -219,28 +200,28 @@ def test_ascii_mirror_uid_byte_2(self, px, command, expected_result, error): ("hf 14a raw -sc A229840026FF", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 00 00 00 00 00 00 00 00 00 AA AA BD [ 7B 09 ]", + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BD [ 59 27 ]", ), ( "hf 14a raw -sc 3026", - "00 00 00 00 00 00 00 00 00 AA AA BD 84 00 26 FF [ DB E9 ]", + "00 00 00 00 00 00 00 00 00 00 00 BD 94 00 26 FF [ 7F 8F ]", ), ( "hf 14a raw -sc 3027", - "00 00 00 00 00 AA AA BD 84 00 26 FF 00 05 00 00 [ E3 5C ]", + "00 00 00 00 00 00 00 BD 94 00 26 FF 00 05 00 00 [ A6 5F ]", ), ("hf 14a raw -sc A22A10050000", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 30 30 30 30 35 39 00 00 00 AA AA BD [ 0C 3F ]", + "00 00 00 00 00 30 30 30 30 30 35 00 00 00 00 BD [ 49 2A ]", ), ( "hf 14a raw -sc 3026", - "30 30 30 30 35 41 00 00 00 AA AA BD 84 00 26 FF [ A8 56 ]", + "00 30 30 30 30 30 36 00 00 00 00 BD 94 00 26 FF [ C8 C7 ]", ), ( "hf 14a raw -sc 3027", - "35 42 00 00 00 AA AA BD 84 00 26 FF 10 05 00 00 [ 5F D8 ]", + "30 30 37 00 00 00 00 BD 94 00 26 FF 10 05 00 00 [ 5C 9A ]", ), ("hf 14a raw -sc A22A00050000", "0A"), ] @@ -250,28 +231,28 @@ def test_ascii_mirror_uid_byte_2(self, px, command, expected_result, error): ("hf 14a raw -sc A229A40026FF", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 00 00 00 00 00 00 00 00 00 AA AA BD [ 7B 09 ]", + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BD [ 59 27 ]", ), ( "hf 14a raw -sc 3026", - "00 00 00 00 00 00 00 00 00 AA AA BD 84 00 26 FF [ DB E9 ]", + "00 00 00 00 00 00 00 00 00 00 00 BD A4 00 26 FF [ 8D C3 ]", ), ( "hf 14a raw -sc 3027", - "00 00 00 00 00 AA AA BD 84 00 26 FF 00 05 00 00 [ E3 5C ]", + "00 00 00 00 00 00 00 BD A4 00 26 FF 00 05 00 00 [ 2E B2 ]", ), ("hf 14a raw -sc A22A10050000", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 30 30 30 30 35 39 00 00 00 AA AA BD [ 0C 3F ]", + "00 00 00 00 00 00 30 30 30 30 30 38 00 00 00 BD [ F0 23 ]", ), ( "hf 14a raw -sc 3026", - "30 30 30 30 35 41 00 00 00 AA AA BD 84 00 26 FF [ A8 56 ]", + "00 00 30 30 30 30 30 39 00 00 00 BD A4 00 26 FF [ 4F B6 ]", ), ( "hf 14a raw -sc 3027", - "35 42 00 00 00 AA AA BD 84 00 26 FF 10 05 00 00 [ 5F D8 ]", + "30 30 30 41 00 00 00 BD A4 00 26 FF 10 05 00 00 [ AF 61 ]", ), ("hf 14a raw -sc A22A00050000", "0A"), ] @@ -281,28 +262,28 @@ def test_ascii_mirror_uid_byte_2(self, px, command, expected_result, error): ("hf 14a raw -sc A229B40026FF", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 00 00 00 00 00 00 00 00 00 AA AA BD [ 7B 09 ]", + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BD [ 59 27 ]", ), ( "hf 14a raw -sc 3026", - "00 00 00 00 00 00 00 00 00 AA AA BD B4 00 26 FF [ 29 A5 ]", + "00 00 00 00 00 00 00 00 00 00 00 BD B4 00 26 FF [ 2C 00 ]", ), ( "hf 14a raw -sc 3027", - "00 00 00 00 00 AA AA BD B4 00 26 FF 00 05 00 00 [ 6B B1 ]", + "00 00 00 00 00 00 00 BD B4 00 26 FF 00 05 00 00 [ 56 E9 ]", ), ("hf 14a raw -sc A22A10050000", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 00 00 00 00 00 00 00 00 00 AA AA BD [ 7B 09 ]", + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BD [ 59 27 ]", ), ( "hf 14a raw -sc 3026", - "00 00 00 00 00 00 00 00 00 AA AA BD B4 00 26 FF [ 29 A5 ]", + "00 00 00 00 00 00 00 00 00 00 00 BD B4 00 26 FF [ 2C 00 ]", ), ( "hf 14a raw -sc 3027", - "00 00 00 00 00 AA AA BD B4 00 26 FF 10 05 00 00 [ CA 72 ]", + "00 00 00 00 00 00 00 BD B4 00 26 FF 10 05 00 00 [ F7 2A ]", ), ("hf 14a raw -sc A22A00050000", "0A"), ] @@ -313,11 +294,7 @@ def test_ascii_counter_0(self, px, command, expected_result): result = px_result[0] - assert expected_result == result - - result = px_result[0] - - assert expected_result == result + assert expected_result in result @pytest.mark.parametrize("command, expected_result", test_data_ascii_counter_1) def test_ascii_counter_1(self, px, command, expected_result): @@ -325,7 +302,7 @@ def test_ascii_counter_1(self, px, command, expected_result): result = px_result[0] - assert expected_result == result + assert expected_result in result @pytest.mark.parametrize("command, expected_result", test_data_ascii_counter_2) def test_ascii_counter_2(self, px, command, expected_result): @@ -333,7 +310,7 @@ def test_ascii_counter_2(self, px, command, expected_result): result = px_result[0] - assert expected_result == result + assert expected_result in result @pytest.mark.parametrize("command, expected_result", test_data_ascii_counter_3) def test_ascii_counter_3(self, px, command, expected_result): @@ -341,47 +318,47 @@ def test_ascii_counter_3(self, px, command, expected_result): result = px_result[0] - assert expected_result == result + assert expected_result in result test_data_ascii_counter_0_pwd = [ ("hf 14a raw -sc A22A00050000", "0A"), ("hf 14a raw -sc A229840026FF", "0A"), ( "hf 14a raw -sc 3025", - "00 00 00 00 00 00 00 00 00 00 00 00 00 AA AA BD [ 7B 09 ]", + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BD [ 59 27 ]", ), ( "hf 14a raw -sc 3026", - "00 00 00 00 00 00 00 00 00 AA AA BD 84 00 26 FF [ DB E9 ]", + "00 00 00 00 00 00 00 00 00 00 00 BD 84 00 26 FF [ DE 4C ]", ), ( "hf 14a raw -sc 3027", - "00 00 00 00 00 AA AA BD 84 00 26 FF 00 05 00 00 [ E3 5C ]", + "00 00 00 00 00 00 00 BD 84 00 26 FF 00 05 00 00 [ DE 04 ]", ), ("hf 14a raw -sc A22A18050000", "0A"), ( "hf 14a raw -sck 1BFFFFFFFF", - "00 00 00 00 30 30 30 30 35 39 00 00 00 AA AA BD [ 0C 3F ]", + "00 00 [ A0 1E ]", ), ( "hf 14a raw -ack 3025", - "00 00 00 00 30 30 30 30 35 39 00 00 00 AA AA BD [ 0C 3F ]", + "00 00 00 00 30 30 30 30 30 45 00 00 00 00 00 BD [ 99 26 ]", ), ( "hf 14a raw -ack 3026", - "30 30 30 30 35 41 00 00 00 AA AA BD 84 00 26 FF [ A8 56 ]", + "30 30 30 30 30 46 00 00 00 00 00 BD 84 00 26 FF [ 68 D3 ]", ), ( "hf 14a raw -ack 3027", - "35 42 00 00 00 AA AA BD 84 00 26 FF 10 05 00 00 [ 5F D8 ]", + "30 46 00 00 00 00 00 BD 84 00 26 FF 18 05 00 00 [ 71 EB ]", ), ("hf 14a raw -ac A22A00050000", "0A"), ] @pytest.mark.parametrize("command, expected_result", test_data_ascii_counter_0_pwd) - def test_ascii_counter_0_pwd(self, px, command, expected_result): + def test_ascii_counter_pwd_0(self, px, command, expected_result): px_result = px.execute(command) result = px_result[0] - assert expected_result == result + assert expected_result in result