From 4fde3eb3054a0cc6be7212a76c64bf24dcc352e0 Mon Sep 17 00:00:00 2001 From: Dingzb Date: Fri, 9 Jan 2026 16:44:15 +0800 Subject: [PATCH 1/4] fix: glitch effect regression after merge --- .../src/components/Acquisition.tsx | 4 +- src/cracknuts/acquisition/acquisition.py | 77 ++- src/cracknuts/cracker/cracker_s1.py | 5 +- tests/jupyter/0.20/0.20_g1_startup.ipynb | 144 +++++ tests/jupyter/0.20/0.20_s1_startup.ipynb | 146 +++++ tests/jupyter/archive/fly_flip_power.ipynb | 561 ++++++++++++++++++ tests/jupyter/archive/new_plot.ipynb | 331 +++++++++++ tests/jupyter/archive/new_trace_monitor.ipynb | 33 ++ tests/jupyter/archive/pl_io_test1.ipynb | 216 +++++++ .../jupyter/archive/scope_optimization.ipynb | 226 +++++++ .../archive/trigger_reset_analysis.ipynb | 100 ++++ tests/jupyter/archive/uart_receive.ipynb | 329 ++++++++++ tests/jupyter/test_cracknuts_panel.py | 112 ---- 13 files changed, 2137 insertions(+), 147 deletions(-) create mode 100644 tests/jupyter/0.20/0.20_g1_startup.ipynb create mode 100644 tests/jupyter/0.20/0.20_s1_startup.ipynb create mode 100644 tests/jupyter/archive/fly_flip_power.ipynb create mode 100644 tests/jupyter/archive/new_plot.ipynb create mode 100644 tests/jupyter/archive/new_trace_monitor.ipynb create mode 100644 tests/jupyter/archive/pl_io_test1.ipynb create mode 100644 tests/jupyter/archive/scope_optimization.ipynb create mode 100644 tests/jupyter/archive/trigger_reset_analysis.ipynb create mode 100644 tests/jupyter/archive/uart_receive.ipynb delete mode 100644 tests/jupyter/test_cracknuts_panel.py diff --git a/jupyter_frontend/src/components/Acquisition.tsx b/jupyter_frontend/src/components/Acquisition.tsx index 58970de0..2bd290b7 100644 --- a/jupyter_frontend/src/components/Acquisition.tsx +++ b/jupyter_frontend/src/components/Acquisition.tsx @@ -111,8 +111,8 @@ const Acquisition: React.FC = () => { size={"small"} value={triggerJudgeWaitTime} addonAfter={intl.formatMessage({id: "cracker.config.unit.second"})} - min={0.05} - step={0.01} + min={0.001} + step={0.001} onChange={(v) => { setTriggerJudgeWaitTime(Number(v)); }} diff --git a/src/cracknuts/acquisition/acquisition.py b/src/cracknuts/acquisition/acquisition.py index 0bf259fc..dd8ee069 100644 --- a/src/cracknuts/acquisition/acquisition.py +++ b/src/cracknuts/acquisition/acquisition.py @@ -14,7 +14,6 @@ import numpy as np from cracknuts import logger -from cracknuts.cracker.cracker_s1 import CrackerS1 from cracknuts.cracker.cracker_basic import CrackerBasic from cracknuts.trace.trace import ZarrTraceDataset, NumpyTraceDataset @@ -25,7 +24,8 @@ class AcquisitionConfig: sample_length: int = 1024 sample_offset: int = 0 trigger_judge_timeout: float = 0.005 - trigger_judge_wait_time: float = 0.001 + trigger_judge_wait_time: float = 0.05 + # trigger_judge_wait_time: float = 0.001 do_error_max_count: int = 1 file_path: str = "" file_format: str = "zarr" @@ -56,22 +56,22 @@ class Acquisition(abc.ABC): MAX_WAVE_LENGTH = 32_000_000 def __init__( - self, - cracker: CrackerBasic, - trace_count: int = 1000, - sample_length: int = -1, - sample_offset: int = 0, - data_plaintext_length: int | None = None, - data_ciphertext_length: int | None = None, - data_key_length: int | None = None, - data_extended_length: int | None = None, - trigger_judge_wait_time: float = 0.01, - trigger_judge_timeout: float = 1.0, - do_error_handler_strategy: int = DO_ERROR_HANDLER_STRATEGY_EXIT, - do_error_max_count: int = -1, - file_format: str = "zarr", - file_path: str = "auto", - trace_fetch_interval: float = 0, + self, + cracker: CrackerBasic, + trace_count: int = 1000, + sample_length: int = -1, + sample_offset: int = 0, + data_plaintext_length: int | None = None, + data_ciphertext_length: int | None = None, + data_key_length: int | None = None, + data_extended_length: int | None = None, + trigger_judge_wait_time: float = 0.01, + trigger_judge_timeout: float = 1.0, + do_error_handler_strategy: int = DO_ERROR_HANDLER_STRATEGY_EXIT, + do_error_max_count: int = -1, + file_format: str = "zarr", + file_path: str = "auto", + trace_fetch_interval: float = 0, ): """ :param cracker: The controlled Cracker object. @@ -846,7 +846,7 @@ def _is_triggered(self): return triggered def _get_waves(self, offset: int, sample_length: int) -> dict[int, np.ndarray]: - if sample_length == -1 or sample_length is None: + if sample_length == -1: sample_length = self.cracker.get_current_config().osc_sample_length config = self.cracker.get_current_config() @@ -857,20 +857,35 @@ def _get_waves(self, offset: int, sample_length: int) -> dict[int, np.ndarray]: enable_channels.append(1) wave_dict = {} for c in enable_channels: - _count = sample_length // self.MAX_WAVE_LENGTH - _left = sample_length % self.MAX_WAVE_LENGTH - _offset = offset - waves = [] - for _ in range(_count): - _, _wave = self.cracker.osc_get_analog_wave(c, _offset, self.MAX_WAVE_LENGTH) - waves.append(_wave) - _offset += self.MAX_WAVE_LENGTH - if _left > 0: - _, _wave = self.cracker.osc_get_analog_wave(c, _offset, _left) - waves.append(_wave) - wave_dict[c] = np.concatenate(waves) + status, wave_dict[c] = self.cracker.osc_get_analog_wave(c, offset, sample_length) return wave_dict + # def _get_waves(self, offset: int, sample_length: int) -> dict[int, np.ndarray]: + # if sample_length == -1 or sample_length is None: + # sample_length = self.cracker.get_current_config().osc_sample_length + # config = self.cracker.get_current_config() + # + # enable_channels = [] + # if config.osc_channel_0_enable: + # enable_channels.append(0) + # if config.osc_channel_1_enable: + # enable_channels.append(1) + # wave_dict = {} + # for c in enable_channels: + # _count = sample_length // self.MAX_WAVE_LENGTH + # _left = sample_length % self.MAX_WAVE_LENGTH + # _offset = offset + # waves = [] + # for _ in range(_count): + # _, _wave = self.cracker.osc_get_analog_wave(c, _offset, self.MAX_WAVE_LENGTH) + # waves.append(_wave) + # _offset += self.MAX_WAVE_LENGTH + # if _left > 0: + # _, _wave = self.cracker.osc_get_analog_wave(c, _offset, _left) + # waves.append(_wave) + # wave_dict[c] = np.concatenate(waves) + # return wave_dict + def _pre_finish(self): ... def _post_finish(self): ... diff --git a/src/cracknuts/cracker/cracker_s1.py b/src/cracknuts/cracker/cracker_s1.py index 4d070b3c..2a364597 100644 --- a/src/cracknuts/cracker/cracker_s1.py +++ b/src/cracknuts/cracker/cracker_s1.py @@ -757,12 +757,12 @@ def _nut_set_clock_enable(self, enable: bool) -> tuple[int, None]: return status, None @connection_status_check - def nut_clock_freq(self, clock: int | str) -> tuple[int, None]: + def nut_clock_freq(self, clock: float | int | str) -> tuple[int, None]: """ Set nut clock. :param clock: The clock of the nut in kHz - :type clock: int | str + :type clock: float | int | str :return: The device response status :rtype: tuple[int, None] """ @@ -781,6 +781,7 @@ def nut_clock_freq(self, clock: int | str) -> tuple[int, None]: else: self._logger.error(f"Unknown clock type: {clock}, 64M or 24M or 12M or 8M or 4M") return protocol.STATUS_ERROR, None + clock = round(clock) # TODO 这里由于这些设置是在cracker中的server程序完成的,目前只支持这些整数值,后续优化 validate_nut_clock = (64000, 24000, 12000, 8000, 4000) if clock not in validate_nut_clock: self._logger.error(f"UnSupport osc clock, it should in {validate_nut_clock}") diff --git a/tests/jupyter/0.20/0.20_g1_startup.ipynb b/tests/jupyter/0.20/0.20_g1_startup.ipynb new file mode 100644 index 00000000..af7b5f78 --- /dev/null +++ b/tests/jupyter/0.20/0.20_g1_startup.ipynb @@ -0,0 +1,144 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "1cb5a996-2f83-417b-9efb-fdc4fb35d980", + "metadata": {}, + "outputs": [], + "source": [ + "import cracknuts as cn" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "ede7207d-0411-4fb2-aded-d1f4c5c82c4b", + "metadata": {}, + "outputs": [], + "source": [ + "g1 = cn.cracker_g1('192.168.0.10')\n", + "g1.connect(force_update_bin=True, force_write_default_config=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "442c29be-5fc3-4186-a704-e529e33b258d", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "43863abee97146958540d18613b869f7", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "WorkbenchG1Panel(acq_run_progress={'finished': 0, 'total': -1}, connect_status=True, custom_y_range={'0': (0, …" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import random\n", + "import time\n", + "from cracknuts.cracker import serial\n", + "\n", + "\n", + "cmd_set_aes_enc_key = \"01 00 00 00 00 00 00 10\"\n", + "cmd_aes_enc = \"01 02 00 00 00 00 00 10\"\n", + "\n", + "aes_key = \"11 22 33 44 55 66 77 88 99 00 aa bb cc dd ee ff\"\n", + "aes_data_len = 16\n", + "\n", + "sample_length = 20000\n", + "\n", + "def init(cracker):\n", + " cracker.nut_voltage_enable()\n", + " cracker.nut_voltage(3.3)\n", + " cracker.nut_clock_enable()\n", + " cracker.nut_clock_freq('8M')\n", + " cracker.uart_io_enable()\n", + " cracker.osc_sample_clock('48m')\n", + " cracker.osc_sample_length(sample_length)\n", + " cracker.osc_trigger_source('N')\n", + " cracker.osc_analog_gain('B', 10)\n", + " cracker.osc_trigger_level(0)\n", + " cracker.osc_trigger_mode('E')\n", + " cracker.osc_trigger_edge('U')\n", + " cracker.uart_config(baudrate=serial.Baudrate.BAUDRATE_115200, bytesize=serial.Bytesize.EIGHTBITS, parity=serial.Parity.PARITY_NONE, stopbits=serial.Stopbits.STOPBITS_ONE)\n", + "\n", + " time.sleep(2)\n", + " cmd = cmd_set_aes_enc_key + aes_key\n", + " status, ret = cracker.uart_transmit_receive(cmd, timeout=1000, rx_count=6)\n", + "\n", + "# def do(cracker, count):\n", + "# plaintext_data = random.randbytes(aes_data_len)\n", + "# tx_data = bytes.fromhex(cmd_aes_enc.replace(' ', '')) + plaintext_data\n", + "# status, ret = cracker.uart_transmit_receive(tx_data, rx_count= 6 + aes_data_len, is_trigger=True)\n", + " \n", + "# return {\n", + "# \"plaintext\": plaintext_data,\n", + "# \"ciphertext\": ret[-aes_data_len:],\n", + "# \"key\": bytes.fromhex(aes_key)\n", + "# }\n", + "\n", + "def do(cracker, count):\n", + " # plaintext_data = random.randbytes(aes_data_len)\n", + " plaintext_data = bytes.fromhex('AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99')\n", + " tx_data = bytes.fromhex(cmd_aes_enc.replace(' ', '')) + plaintext_data\n", + " status, ret = cracker.uart_transmit_receive(tx_data, rx_count= 6 + aes_data_len, is_trigger=True)\n", + " # print(ret.hex(' ') if ret else 'None')\n", + " return {\n", + " \"plaintext\": plaintext_data,\n", + " \"ciphertext\": ret[-aes_data_len:],\n", + " \"key\": bytes.fromhex(aes_key)\n", + " }\n", + "\n", + "\n", + "def finish(cracker):\n", + " ...\n", + " # print('optional behavior')\n", + "\n", + "\n", + "acq = cn.simple_glitch_acq(g1, init, do)\n", + "\n", + "p = cn.show_panel(acq)\n", + "p" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a0562d3d-745d-4a3b-9b24-ab1b03ea18ff", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tests/jupyter/0.20/0.20_s1_startup.ipynb b/tests/jupyter/0.20/0.20_s1_startup.ipynb new file mode 100644 index 00000000..32fcc4c2 --- /dev/null +++ b/tests/jupyter/0.20/0.20_s1_startup.ipynb @@ -0,0 +1,146 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 4, + "id": "1cb5a996-2f83-417b-9efb-fdc4fb35d980", + "metadata": {}, + "outputs": [], + "source": [ + "import cracknuts as cn" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "ede7207d-0411-4fb2-aded-d1f4c5c82c4b", + "metadata": {}, + "outputs": [], + "source": [ + "s1 = cn.cracker_s1('192.168.0.15')\n", + "s1.connect(force_update_bin=True, force_write_default_config=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "442c29be-5fc3-4186-a704-e529e33b258d", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "4eeb599b99854089a9540b55fb16e85f", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "CracknutsPanelWidget(acq_run_progress={'finished': 0, 'total': -1}, connect_status=True, custom_y_range={'0': …" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import random\n", + "import time\n", + "from cracknuts.cracker import serial\n", + "\n", + "\n", + "cmd_set_aes_enc_key = \"01 00 00 00 00 00 00 10\"\n", + "cmd_aes_enc = \"01 02 00 00 00 00 00 10\"\n", + "\n", + "aes_key = \"11 22 33 44 55 66 77 88 99 00 aa bb cc dd ee ff\"\n", + "aes_data_len = 16\n", + "\n", + "sample_length = 20000\n", + "\n", + "def init(cracker):\n", + " cracker.nut_voltage_enable()\n", + " cracker.nut_voltage(3.3)\n", + " cracker.nut_clock_enable()\n", + " cracker.nut_clock_freq('8M')\n", + " cracker.uart_io_enable()\n", + " cracker.osc_sample_clock('48m')\n", + " cracker.osc_sample_length(sample_length)\n", + " cracker.osc_trigger_source('N')\n", + " cracker.osc_analog_gain('B', 10)\n", + " cracker.osc_trigger_level(0)\n", + " cracker.osc_trigger_mode('E')\n", + " cracker.osc_trigger_edge('U')\n", + " cracker.uart_config(baudrate=serial.Baudrate.BAUDRATE_115200, bytesize=serial.Bytesize.EIGHTBITS, parity=serial.Parity.PARITY_NONE, stopbits=serial.Stopbits.STOPBITS_ONE)\n", + "\n", + " time.sleep(2)\n", + " cmd = cmd_set_aes_enc_key + aes_key\n", + " status, ret = cracker.uart_transmit_receive(cmd, timeout=1000, rx_count=6)\n", + "\n", + "# def do(cracker, count):\n", + "# plaintext_data = random.randbytes(aes_data_len)\n", + "# tx_data = bytes.fromhex(cmd_aes_enc.replace(' ', '')) + plaintext_data\n", + "# status, ret = cracker.uart_transmit_receive(tx_data, rx_count= 6 + aes_data_len, is_trigger=True)\n", + " \n", + "# return {\n", + "# \"plaintext\": plaintext_data,\n", + "# \"ciphertext\": ret[-aes_data_len:],\n", + "# \"key\": bytes.fromhex(aes_key)\n", + "# }\n", + "\n", + "def do(cracker, count):\n", + " # plaintext_data = random.randbytes(aes_data_len)\n", + " plaintext_data = bytes.fromhex('AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99')\n", + " tx_data = bytes.fromhex(cmd_aes_enc.replace(' ', '')) + plaintext_data\n", + " status, ret = cracker.uart_transmit_receive(tx_data, rx_count= 6 + aes_data_len, is_trigger=True)\n", + " # print(ret.hex(' ') if ret else 'None')\n", + " return {\n", + " \"plaintext\": plaintext_data,\n", + " \"ciphertext\": ret[-aes_data_len:],\n", + " \"key\": bytes.fromhex(aes_key)\n", + " }\n", + "\n", + "\n", + "def finish(cracker):\n", + " ...\n", + " # print('optional behavior')\n", + "\n", + "\n", + "acq = cn.simple_acq(s1, init, do)\n", + "\n", + "p = cn.show_panel(acq)\n", + "p" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "973b2a5d-f6db-4281-949d-b679cf081109", + "metadata": {}, + "outputs": [], + "source": [ + "s1.get_firmware_info()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tests/jupyter/archive/fly_flip_power.ipynb b/tests/jupyter/archive/fly_flip_power.ipynb new file mode 100644 index 00000000..21b1d872 --- /dev/null +++ b/tests/jupyter/archive/fly_flip_power.ipynb @@ -0,0 +1,561 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b80b27f2-791e-4736-81b9-3218810bb233", + "metadata": {}, + "outputs": [], + "source": [ + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd1200 = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251029153409_1200_power_8m_30.zarr')\n", + "\n", + "p1200 = zd1200.plot()\n", + "p1200.show_trace(0, slice(2,3))\n", + "f1200 = p1200.plot_line(width=2300)\n", + "f1200" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cd3e8568-de19-47e7-90da-d7eb35d13ae9", + "metadata": {}, + "outputs": [], + "source": [ + "p1200.show_trace(0, slice(13,14))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8963fefd-37f4-4770-9b47-207499b8f2ed", + "metadata": {}, + "outputs": [], + "source": [ + "p1200.zoom_x((7_000_000, 9_000_000))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "15e8e1f4-8447-43e8-803a-5c6c73f8df6f", + "metadata": {}, + "outputs": [], + "source": [ + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd1300 = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251029153409_1300_power_8m_30.zarr')\n", + "\n", + "p1300 = zd1300.plot()\n", + "p1300.show_trace(0, slice(2,3))\n", + "f1300 = p1300.plot_line(width=2300)\n", + "f1300" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3f88234d-bbf3-4514-8e49-cfbce117eea3", + "metadata": {}, + "outputs": [], + "source": [ + "p1300.show_trace(0, slice(11, 12))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9150479b-3c9a-47ad-ace3-f3f8f2e1c18b", + "metadata": {}, + "outputs": [], + "source": [ + "p1300.zoom_x((7_000_000, 9_000_000))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "10b1568e-a75e-4bbc-a2cc-4138feb57b18", + "metadata": {}, + "outputs": [], + "source": [ + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd1100 = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251030110021_1100_power_8m_30.zarr')\n", + "\n", + "p1100 = zd1100.plot()\n", + "p1100.show_trace(0, slice(2,3))\n", + "f1100 = p1100.plot_line(width=2300)\n", + "f1100" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3f2330fb-a5bb-4c6c-93c2-e6ba330e4198", + "metadata": {}, + "outputs": [], + "source": [ + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd1000 = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251030112125_1000_power_8m_30.zarr')\n", + "\n", + "p1000 = zd1000.plot()\n", + "p1000.show_trace(0, slice(2,3))\n", + "f1000 = p1000.plot_line(width=2300)\n", + "f1000" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "373f5ed5-48db-475e-8e64-3602949611d2", + "metadata": {}, + "outputs": [], + "source": [ + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd1000 = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251030112125_1000_power_8m_30.zarr')\n", + "\n", + "p1000 = zd1000.plot()\n", + "p1000.show_trace(0, slice(2,3))\n", + "f1000 = p1000.plot_line(width=2300)\n", + "f1000" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c2e1eeb5-77c4-4f7c-a93c-7b05e4534771", + "metadata": {}, + "outputs": [], + "source": [ + "p1000.zoom_x((0, 8_000_0))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "43c677f0-ceed-414b-8560-d14b90f2d429", + "metadata": {}, + "outputs": [], + "source": [ + "p1000.show_trace(0, slice(2, 6))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "90bfa8f3-50c0-47c2-bf56-13375dd55a23", + "metadata": {}, + "outputs": [], + "source": [ + "p1000.shift(0, 3, -25)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b4739a53-e794-4910-aaf5-99f3f50d568d", + "metadata": {}, + "outputs": [], + "source": [ + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd1000 = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251031144124_1000_power_8m_delay0m_2000m_30.zarr')\n", + "\n", + "p1000 = zd1000.plot()\n", + "p1000.show_trace(0, slice(1, 4))\n", + "f1000 = p1000.plot_line(width=2300)\n", + "f1000" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "555d18e1-e185-4fc5-ab41-e379f4e8b5f9", + "metadata": {}, + "outputs": [], + "source": [ + "# 1 2\n", + "p1000.shift(0, 2, -20)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "7b21a955-78ab-4f38-804a-7ac18e8b0869", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1c3c369b74de4466b2d3711ad0481ceb", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "FigureWidgetResampler({\n", + " 'data': [{'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T2 ~16k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': '4eb63cfc-57b6-48d0-b176-6082260a763d',\n", + " 'x': {'bdata': ('AAAAAH8JAABWRQAAIo0AAMfBAAAvEA' ... 'C4JPMAe2XzAJS38wA6APQA/yP0AA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('bP8ACDv+8QE//ssBZv7aASX+ygEl/q' ... 'sGuvzHBtL89gbT/FMH1fyMB6D8jv8='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T3 ~16k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': '18081a9c-b815-4738-a240-e527df415580',\n", + " 'x': {'bdata': ('AAAAAGwKAAClegAA334AAOzBAADDAw' ... 'BkQPMAwobzANeR8wAS3vMA/yP0AA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('HAUB+O8EXfyWAXb+owFE/qQBYv7AAS' ... 'n8oQbb/OoGrvwdB6D8MweK/JAHOwI='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T5 ~16k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': '79230bbe-5703-4281-bcee-1dfa78246301',\n", + " 'x': {'bdata': ('AAAAABAAAACsUQAAsIwAAMTLAAAnDg' ... 'AzO/MAxV3zAMGm8wCxEfQA/yP0AA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('mP0ACCv+EwJh/pUBTv6tASz+pgFd/o' ... 'YGrvzsBqv8dAfR/HYHZ/yTB+8H7P4='),\n", + " 'dtype': 'i2'}}],\n", + " 'layout': {'height': 350,\n", + " 'margin': {'b': 40, 'l': 0, 't': 40},\n", + " 'paper_bgcolor': 'white',\n", + " 'plot_bgcolor': 'white',\n", + " 'template': '...',\n", + " 'width': 2300,\n", + " 'xaxis': {'gridcolor': '#dddddd',\n", + " 'gridwidth': 1,\n", + " 'linecolor': '#dddddd',\n", + " 'linewidth': 1,\n", + " 'mirror': True,\n", + " 'showline': True},\n", + " 'yaxis': {'gridcolor': '#dddddd',\n", + " 'gridwidth': 1,\n", + " 'linecolor': '#dddddd',\n", + " 'linewidth': 1,\n", + " 'mirror': True,\n", + " 'showline': True}}\n", + "})" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd1100_64 = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251031144124_1000_power_8m_delay0m_2000m_30.zarr')\n", + "\n", + "p1100_64 = zd1100_64.plot()\n", + "p1100_64.show_trace(0, [slice(2,4), slice(5,6)])\n", + "f1100_64 = p1100_64.plot_line(width=2300)\n", + "f1100_64" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "02f6ce18-312d-4cc2-9d17-60b68bec9ee0", + "metadata": {}, + "outputs": [], + "source": [ + "p1100_64.shift(0, 0, 4)\n", + "p1100_64.shift(0, 2, -20)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7482255b-67e7-4977-8d52-44032dd3c9a5", + "metadata": {}, + "outputs": [], + "source": [ + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd1000_64 = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251030165220_1000_power_64m_delay59m_10m_10.zarr')\n", + "\n", + "p1000_64 = zd1000_64.plot()\n", + "p1000_64.show_trace(0, slice(2,4))\n", + "f1000_64 = p1000_64.plot_line(width=2300)\n", + "f1000_64" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "726d4945-c57d-4f40-9113-19dd6bb892f9", + "metadata": {}, + "outputs": [], + "source": [ + "# p1000_64.shift(0, 0, 593200)\n", + "p1000_64.shift(0, 0, 0)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "c68804dc-fa7c-4bcd-b50a-6090f063d8f9", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "ea102d526afe4c7e8149704672abe43e", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "TracePanelWidget(chart_size={'width': 0, 'height': 0}, language='zh', overview_select_range=(0, 0), overview_t…" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from cracknuts.jupyter import TracePanelWidget\n", + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251102122308_1000_power_64m_delay0m_.192_00_k.zarr')\n", + "tp = TracePanelWidget()\n", + "tp.set_trace_dataset(zd)\n", + "\n", + "tp.show_trace[0, 2:4]\n", + "tp" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "bc2d469a-5256-4de0-9b61-479994188088", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "21db94daafc643599173782a3cb50fd6", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "TracePanelWidget(chart_size={'width': 0, 'height': 0}, language='zh', overview_select_range=(0, 0), overview_t…" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "from cracknuts.jupyter import TracePanelWidget\n", + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251031144124_1000_power_8m_delay0m_2000m_30.zarr')\n", + "tp = TracePanelWidget()\n", + "tp.set_trace_dataset(zd)\n", + "# tp.change_range(0, 80_000)\n", + "tp.show_trace[0, 2:4]\n", + "tp" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3eae92aa-61a7-4869-a4b3-52e9ed96f9a1", + "metadata": {}, + "outputs": [], + "source": [ + "import cracknuts as cn\n", + "from cracknuts.jupyter import TracePanelWidget\n", + "import zarr\n", + "\n", + "zd = zarr.open(r'D:\\work\\00.project\\cracknuts-show\\dataset\\smt32f103_aes_power_CPAAnalysis.zarr')\n", + "\n", + "data = zd[\"/0/0/correlation\"][:,0,:]\n", + "print(data.shape)\n", + "\n", + "pt = cn.panel_trace()\n", + "pt.set_numpy_like_data(data)\n", + "pt.show_all_trace()\n", + "pt.highlight(0x11)\n", + "pt" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b8360d51-4910-433b-862a-a13989c936be", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "\n", + "def plot_correlation_peaks_plotly_to_matplotlib(correlation_data, bytes_index, the_key, sample_len=None):\n", + " \"\"\"\n", + " 将原来的 Plotly-Resampler 图转换为 Matplotlib 静态绘图版本。\n", + " correlation_data: ndarray, shape = (256, N_bytes, N_samples)\n", + " bytes_index: int, 指定第几个字节\n", + " the_key: int, 目标 key 的索引\n", + " sample_len: int or None, 指定绘制的采样长度\n", + " \"\"\"\n", + "\n", + " if sample_len is None:\n", + " sample_len = correlation_data.shape[2]\n", + "\n", + " x = np.arange(sample_len)\n", + "\n", + " # 创建画布\n", + " fig, ax = plt.subplots(figsize=(9, 3)) # 约等于 900x300 像素\n", + " fig.patch.set_facecolor(\"white\")\n", + "\n", + " # 绘制所有 key 曲线(非 target key 灰色)\n", + " for i in range(256):\n", + " if i == the_key:\n", + " continue\n", + " ax.plot(\n", + " x,\n", + " correlation_data[i, bytes_index, :sample_len],\n", + " color=\"gray\",\n", + " linewidth=0.5,\n", + " alpha=0.3\n", + " )\n", + "\n", + " # 绘制 target key(红色)\n", + " ax.plot(\n", + " x,\n", + " correlation_data[the_key, bytes_index, :sample_len],\n", + " color=\"red\",\n", + " linewidth=1.0,\n", + " label=f\"target key {the_key}\"\n", + " )\n", + "\n", + " # 样式与布局\n", + " ax.set_facecolor(\"white\")\n", + " ax.grid(True, linewidth=1, color=\"#dddddd\", linestyle=\"-\", alpha=0.6)\n", + " ax.set_xlabel(\"Sample index\")\n", + " ax.set_ylabel(\"Correlation\")\n", + " ax.set_title(f\"Correlation peaks for byte {bytes_index} (key {the_key})\", pad=10)\n", + " ax.legend(loc=\"upper right\", frameon=False)\n", + "\n", + " # 边框样式(类似 Plotly 的 mirror=True)\n", + " for spine in ax.spines.values():\n", + " spine.set_linewidth(1)\n", + " spine.set_color(\"#dddddd\")\n", + "\n", + " plt.tight_layout()\n", + " plt.show()\n", + "\n", + " return fig, ax\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7f75c2b7-583f-426d-b0ff-aad412326d55", + "metadata": {}, + "outputs": [], + "source": [ + "plot_correlation_peaks_plotly_to_matplotlib(zd[\"/0/0/correlation\"], 0, 0x11)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cd5fbef3-f2bf-4e77-9a55-dbfa89b8a711", + "metadata": {}, + "outputs": [], + "source": [ + "import plotly.graph_objects as go\n", + "from plotly_resampler import FigureWidgetResampler\n", + "import zarr\n", + "\n", + "zd = zarr.open(r'D:\\work\\00.project\\cracknuts-show\\dataset\\smt32f103_aes_power_CPAAnalysis.zarr')\n", + "data = zd[\"/0/0/correlation\"][:,0,:]\n", + "\n", + "fig = FigureWidgetResampler(go.Figure())\n", + "\n", + "# ======== 3. 添加每条曲线 ========\n", + "for i in range(data.shape[0]):\n", + " if i == 0x11:\n", + " continue\n", + " fig.add_trace(\n", + " go.Scattergl(\n", + " y=data[i, :],\n", + " mode='lines',\n", + " name=f\"Signal {i+1}\",\n", + " line=dict(\n", + " color='gray', # 可以是颜色名 'red', 'blue', 'green' 或者十六进制 '#ff0000'\n", + " width=1 # 线宽,可选\n", + " )\n", + " )\n", + " )\n", + "\n", + "fig.add_trace(\n", + " go.Scattergl(\n", + " y=data[0x11, :],\n", + " mode='lines',\n", + " name=f\"Signal {i+1}\",\n", + " line=dict(\n", + " color='red', # 可以是颜色名 'red', 'blue', 'green' 或者十六进制 '#ff0000'\n", + " width=1 # 线宽,可选\n", + " )\n", + " )\n", + " )\n", + "\n", + "fig.update_layout(\n", + " title=\"二维 NumPy 数据示例\",\n", + " width=2000, # ← 指定画布宽度(像素)\n", + " height=500\n", + ")\n", + "\n", + "fig" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7f977745-3595-4eb5-85d9-1aa8e878e93e", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tests/jupyter/archive/new_plot.ipynb b/tests/jupyter/archive/new_plot.ipynb new file mode 100644 index 00000000..8f2f8c4a --- /dev/null +++ b/tests/jupyter/archive/new_plot.ipynb @@ -0,0 +1,331 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "id": "b80b27f2-791e-4736-81b9-3218810bb233", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3fdea9c64cfa419aa50b46fa4f2c4237", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "FigureWidgetResampler({\n", + " 'data': [{'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T2 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'd2071d28-bfd3-4e65-98e2-7090d1836e85',\n", + " 'x': {'bdata': ('AAAAAOAJAAANawEAUiEDALbZAwBvSA' ... 'SXx78EPy/BBBqywgRDVcQE/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('AgDSAdb/LQDX/yoA0f8rANT/LgDV/y' ... '0Az/8wANH/MwDM/zIA0P80ADAA9v8='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T3 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'a00908dd-19b2-4542-8e50-d2be8e3dffa9',\n", + " 'x': {'bdata': ('AAAAANQJAADYWwEADXMCAMTxAwAv8A' ... 'THy78EqkPBBMHbwQQ4ecME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('DwC7AtT/KwDW/ysA1f8sANf/LQDV/y' ... 'P/MgDR/zIAzP88ANP/NgDT/zMACAA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T4 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'ce57a7cf-31b1-4324-a0d9-aa86cfde91fd',\n", + " 'x': {'bdata': ('AAAAAM8JAABZsAEAsfwCAJfAAwC3FA' ... 'Qigr8EE67ABNbVwgSRE8ME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('+P+uAdb/LQDW/ysA1/8sANX/LgDX/y' ... 'H/LgDS/zUA0f85ANL/NADS/zQAAwA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T5 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'cb10bb05-a6a7-49e4-8cd4-654f9975207c',\n", + " 'x': {'bdata': ('AAAAANIJAACOhAEAudgCAFz/AwCbTg' ... 'QH+r8EyQXCBC8jwgQktsME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('EAAAA9X/KwDV/ywA1v8sANj/LQDY/y' ... 'IAzv8xANH/MgDN/zcANQDQ/zQABwA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T6 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'd3aafb41-bc86-48c0-b5ba-a1b5b59383ed',\n", + " 'x': {'bdata': ('AAAAAAEKAAB+pAEAggoDAL4mBAAu8g' ... 'ThpL8E3LPABDRSwgQwMcQE/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('//8XAdX/LgDT/ywA0/8sANb/KwDW/y' ... 'L/NQDQ/y4AMgDT/zAAz/8zAC8ABwA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T7 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'e0338ae5-8732-4d47-a6fd-21b72572703d',\n", + " 'x': {'bdata': ('AAAAAO4JAABPfAEA76sCAEYCBACM/Q' ... 'Tahb8Ef5jABAkMwgQSVMQE/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('/f+sAc//LADX/y4A1P8sANb/LgDW/y' ... 'MA0f8vANL/MQDN/zQA0v8yAC4A4P8='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T8 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': '248a8fe2-844b-4bde-81d6-786c4d308a6d',\n", + " 'x': {'bdata': ('AAAAAMgJAACnbgEAeowCACvuAwD+Sw' ... 'Szi78EzRHBBFJiwgQ9OcQE/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('FAByAtb/LwDQ/y4A1/8vANX/KwDW/y' ... 'P/MADU/y8A0/8xAM7/LgDV/9H/CAA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T9 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'bcb78ae7-9e0d-476b-b701-08747c18922a',\n", + " 'x': {'bdata': ('AAAAAMkJAADlYgEAFrcCADTeAwCxJA' ... 'Sper8Ekv/ABI4twgSqG8QE/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('5v9sAtb/KwDW/y8A0f8rANP/KwDX/y' ... 'D/MADR/zEA0/82ANP/LwDU/8//FgA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T10 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': '2f10a7fe-8c51-4258-8799-952a90511dc9',\n", + " 'x': {'bdata': ('AAAAAOwJAABEPQEALJICAGXbAwDH7A' ... 'THxb8EtRzBBMBqwgT8fMQE/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('+v+SAtT/LADX/ywA1/8sANP/KgDV/y' ... 'L/LQDU/zQA0f8yAM//LADQ/87/GQA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T11 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': '0a2d8929-d357-4d56-9141-98f6d0f4930c',\n", + " 'x': {'bdata': ('AAAAAM0JAADOfgEAlL4CALHHAwCzAg' ... 'RKor8ESOTABNs/wgSYCcME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('9f/MA9b/KwDX/ysA1P8rANX/LADX/y' ... 'YA0f8wAM//MwAzANP/NgDQ/zIA+f8='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T12 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': '552f1464-3805-4cdf-93be-b0b851fc7b97',\n", + " 'x': {'bdata': ('AAAAANMJAAAgmAEAn+MCAE7FAwBSWg' ... 'Q7zb8EZgHBBKoBwgTl38ME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('+f9/A9f/KwDX/ysA2P8rANX/KwDW/y' ... 'MAzv8yAM//NgDO/zAA0/81ANX/8P8='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T13 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': '9c0b1bdb-e88e-44b3-9a8d-41d14ee38c8c',\n", + " 'x': {'bdata': ('AAAAAM0JAADXYwEAyfACAEjRAwA/OQ' ... 'S4vL8ELITBBLB9wgS2McME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('DQAJBNf/LwDY/ysA1f8qANj/LQDY/y' ... 'IA0P83ANH/LQDR/y8A0P8wANT/BAA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T14 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'bfb31c76-df78-4b52-8e4c-23c0cb10bd25',\n", + " 'x': {'bdata': ('AAAAAMIJAADZSgEAtYICAOYaBADO7A' ... 'TPKcAEFmzBBCItwgRpMcQE/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('AQC9A9X/LwDV/ywA0v8rANf/KgDX/y' ... '7/MwDR/y4A0P8uANT/OgDS/9D/BAA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T15 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'c031fdc6-fded-4aa8-99ac-14b6bf864417',\n", + " 'x': {'bdata': ('AAAAANcJAABvfAEArYACAMDPAwAXNA' ... 'T9rb8EI3zBBCyMwgQlbMME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('9/8LBNT/LADT/ysA1P8uANb/KgDY/y' ... 'X/LwDQ/zYA0P8zANH/LwDV/y4AAAA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T16 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'ea429b81-ea7d-4d4a-bb55-d2d877078ab1',\n", + " 'x': {'bdata': ('AAAAAMwJAACUSwEAurQCALLLAwB+6Q' ... 'S1nL8EwL7ABL5cwgR6U8ME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('BABMBdf/MADY/ywA1v8qANf/NADR/y' ... '//MQDS/y0A0P/R/zUA0f8xANL/DwA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T17 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'bf3b43e6-586a-476e-a7e6-e89400558d7b',\n", + " 'x': {'bdata': ('AAAAALgJAAAOUwEAIt8CAJirAwA9MQ' ... 'QtEMAES5HBBE1DwgSUesME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('+P+tBdf/LQDX/y0A1v8rANj/LQDX/y' ... '8A0P8zANP/MADS/ywA0v8yANL/DwA='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T18 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': '322169dd-a50a-4c3e-b2f0-32b7fec1f518',\n", + " 'x': {'bdata': ('AAAAAKsJAAAAdwEAs/wCADK3AwDJXg' ... 'Sd078EySnBBOITwgTVHsME/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('5/+6BNb/LADO/y0A1f8yANT/MQDW/y' ... '8A0f86AM//MwDP/zYA0/8vANH//P8='),\n", + " 'dtype': 'i2'}},\n", + " {'line': {'width': 1},\n", + " 'mode': 'lines',\n", + " 'name': '[R] T19 ~80k',\n", + " 'showlegend': True,\n", + " 'type': 'scattergl',\n", + " 'uid': 'eea0f842-1d25-4f60-aa06-04a3a95e7406',\n", + " 'x': {'bdata': ('AAAAAKwJAAByagEAXpQCAEGyAwAufQ' ... 'QnxL8Eot3ABLFMwgSqNsQE/7PEBA=='),\n", + " 'dtype': 'i4'},\n", + " 'y': {'bdata': ('/P/uA9T/LgDW/y0A1f8uANP/LgDT/y' ... 'T/MQDV/8//NADQ/zcA0f8sAC0ABQA='),\n", + " 'dtype': 'i2'}}],\n", + " 'layout': {'height': 350,\n", + " 'margin': {'b': 40, 'l': 0, 't': 40},\n", + " 'paper_bgcolor': 'white',\n", + " 'plot_bgcolor': 'white',\n", + " 'template': '...',\n", + " 'xaxis': {'gridcolor': '#dddddd',\n", + " 'gridwidth': 1,\n", + " 'linecolor': '#dddddd',\n", + " 'linewidth': 1,\n", + " 'mirror': True,\n", + " 'showline': True},\n", + " 'yaxis': {'gridcolor': '#dddddd',\n", + " 'gridwidth': 1,\n", + " 'linecolor': '#dddddd',\n", + " 'linewidth': 1,\n", + " 'mirror': True,\n", + " 'showline': True}}\n", + "})" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251029153409_1200_power_8m_30.zarr')\n", + "\n", + "p = zd.plot()\n", + "p.show_trace(0, slice(2,20))\n", + "f = p.plot_line()\n", + "f" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "682a189c-c0ed-4958-9e3f-433cb21b191d", + "metadata": {}, + "outputs": [], + "source": [ + "p.zoom(x=(10000, 20000), y=(0, 200))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bca1f8e0-3622-4dc0-a3a9-6a170b630ef1", + "metadata": {}, + "outputs": [], + "source": [ + "r = 9000000\n", + "start = 3000\n", + "f.layout.xaxis.range = [start, start+r] # X 轴显示 20~50" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "8483d41d-622b-4796-b138-1a9cadf35e09", + "metadata": {}, + "outputs": [], + "source": [ + "# 执行后 会自动宽度\n", + "f.layout.autosize=False\n", + "f.layout.autosize=True" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "11e4d84f-59ca-4a1d-86ba-dee8546de76b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.layout.autosize" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "32a1c788-e40e-425f-ba2b-98dfb2990b58", + "metadata": {}, + "outputs": [], + "source": [ + "from cracknuts.trace import ZarrTraceDataset\n", + "\n", + "zd = ZarrTraceDataset.load(r'D:\\work\\01.testing\\02.fly(gpio02)\\cracknuts\\tests\\jupyter\\dataset\\20251029153409_1200_power_8m_30.zarr')\n", + "\n", + "p = zd.plot()\n", + "p.show_trace(0, slice(2,20))\n", + "f = p.plot_line()\n", + "f\n", + "# 执行后 会自动宽度\n", + "f.layout.autosize=False\n", + "f.layout.autosize=True" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tests/jupyter/archive/new_trace_monitor.ipynb b/tests/jupyter/archive/new_trace_monitor.ipynb new file mode 100644 index 00000000..324b2c05 --- /dev/null +++ b/tests/jupyter/archive/new_trace_monitor.ipynb @@ -0,0 +1,33 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "1c83ebe8-fb6b-41d6-866c-347d03bf07a7", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tests/jupyter/archive/pl_io_test1.ipynb b/tests/jupyter/archive/pl_io_test1.ipynb new file mode 100644 index 00000000..e23ab2dd --- /dev/null +++ b/tests/jupyter/archive/pl_io_test1.ipynb @@ -0,0 +1,216 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 28, + "id": "8f23a5fd-1412-4abd-ae70-7b6de6f9960f", + "metadata": {}, + "outputs": [], + "source": [ + "import cracknuts as cn" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "b96151cb-ef3e-4f75-b38a-133a5ff89a0d", + "metadata": {}, + "outputs": [], + "source": [ + "s1 = cn.new_cracker('192.168.0.15')\n", + "s1.connect(force_update_bin=True, force_write_default_config=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "5ada5d09-1c38-4681-bcdc-203586ee21c3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0,\n", + " \"operator_version: 0.3.0-alpha.3, server_version: 0.5.6-alpha.2, bitstream_version: b'S1-0.1.0-alpha.15'\")" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1.get_firmware_version()" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "51db0764-5363-43da-9c9c-c8bf914456f1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0, None)" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 复位 PL IO\n", + "s1.register_write(base_address=0x43c10000, offset=0x300, data=0x01)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "15590cd5-26bc-41a0-ab50-7355cfe50116", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0, None)" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 使能 PL IO\n", + "s1.register_write(base_address=0x43c10000, offset=0x304, data=0b0000_0000_0000_0000_0000_0000_0000_0000)\n", + "s1.register_write(base_address=0x43c10000, offset=0x304, data=0b0000_0000_0000_0000_0000_0000_0001_1111)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "bcca88b2-b262-4111-9f92-2695a7416357", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0, None)" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 输入输出控制\n", + "s1.register_write(base_address=0x43c10000, offset=0x308, data=0b0000_0000_0000_0000_0000_0000_0000_0000) # 输出\n", + "# s1.register_write(base_address=0x43c10000, offset=0x308, data=0b0000_0000_0000_0000_0000_0000_0000_1111) # 输入" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "821ae232-5641-4fdb-9782-a5eb73954bca", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0, None)" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 波形控制\n", + "s1.register_write(base_address=0x43c10000, offset=0x318, data=0b0000_0000_0000_0000_0000_0000_0000_1010) # 波形\n", + "s1.register_write(base_address=0x43c10000, offset=0x32c, data=0x0000_0200) # 1000 10ns 10μs\n", + "s1.register_write(base_address=0x43c10000, offset=0x330, data=0x0000_0200) # 1000 10ns 10μs\n", + "s1.register_write(base_address=0x43c10000, offset=0x334, data=0x0000_0200) # 1000 10ns 10μs\n", + "s1.register_write(base_address=0x43c10000, offset=0x338, data=0x0000_0200) # 1000 10ns 10μs" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "09c3077d-3c11-4856-949e-8bd5bdbaf1d8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0, None)" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 设置波形开始\n", + "s1.register_write(base_address=0x43c10000, offset=0x30c, data=0b0000_0000_0000_0000_0000_0000_0001_1111)" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "ddde216e-319c-4bd1-a120-41388fa52cba", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'00000000 00000000 00000010 00000000'" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bytes_bin(s1.register_read(base_address=0x43c10000, offset=0x32c)[1])" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "6c498891-110f-40e2-be97-c75b1818999e", + "metadata": {}, + "outputs": [], + "source": [ + "def bytes_bin(b: bytes, sep: str = ' ') -> str:\n", + " return sep.join(f'{byte:08b}' for byte in b)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tests/jupyter/archive/scope_optimization.ipynb b/tests/jupyter/archive/scope_optimization.ipynb new file mode 100644 index 00000000..3cda03d1 --- /dev/null +++ b/tests/jupyter/archive/scope_optimization.ipynb @@ -0,0 +1,226 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "f5c99cb1-5585-4460-b0c1-9a87d854b3d0", + "metadata": {}, + "outputs": [], + "source": [ + "# 引入依赖\n", + "import cracknuts as cn\n", + "from cracknuts.acquisition import Acquisition\n", + "\n", + "# 创建 cracker \n", + "cracker = cn.new_cracker('192.168.0.15')" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "6d734bcc-74e8-49eb-a5cf-89c881b89aa8", + "metadata": {}, + "outputs": [], + "source": [ + "cracker.connect(force_update_bin=True, force_write_default_config=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "80cb363b-8504-42fa-894e-1e9408f46206", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6e04b89227674ef395f4e30f1b7e7084", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "CracknutsPanelWidget(acq_run_progress={'finished': 0, 'total': -1}, connect_status=True, custom_y_range={'0': …" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\Dingzb\\AppData\\Local\\Temp\\ipykernel_7472\\3407830264.py:19: DeprecationWarning: uart_enable() 已弃用,将在未来版本中移除,请使用 uart_io_enable() 替代。\n", + " cracker.uart_enable()\n", + "Exception in thread Thread-12 (_monitor):\n", + "Traceback (most recent call last):\n", + " File \"C:\\Users\\Dingzb\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\threading.py\", line 1075, in _bootstrap_inner\n", + "Exception in thread Thread-11 (_monitor):\n", + "Traceback (most recent call last):\n", + " File \"C:\\Users\\Dingzb\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\threading.py\", line 1075, in _bootstrap_inner\n", + " self.run()\n", + " File \"D:\\work\\00.project\\cracknuts\\.venv\\Lib\\site-packages\\ipykernel\\ipkernel.py\", line 772, in run_closure\n", + " self.run()\n", + " File \"D:\\work\\00.project\\cracknuts\\.venv\\Lib\\site-packages\\ipykernel\\ipkernel.py\", line 772, in run_closure\n", + " _threading_Thread_run(self)\n", + " File \"C:\\Users\\Dingzb\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\threading.py\", line 1012, in run\n", + " _threading_Thread_run(self)\n", + " File \"C:\\Users\\Dingzb\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\threading.py\", line 1012, in run\n", + " self._target(*self._args, **self._kwargs)\n", + " File \"D:\\work\\00.project\\cracknuts\\src\\cracknuts\\jupyter\\scope_panel.py\", line 127, in _monitor\n", + " self.update(wave)\n", + " File \"D:\\work\\00.project\\cracknuts\\src\\cracknuts\\jupyter\\scope_panel.py\", line 90, in update\n", + " self._target(*self._args, **self._kwargs)\n", + " File \"D:\\work\\00.project\\cracknuts\\src\\cracknuts\\jupyter\\scope_panel.py\", line 127, in _monitor\n", + " self.overview_series = {k: minmax(v, 0, v.shape[0], 1920) for k, v in series_data.items()}\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"D:\\work\\00.project\\cracknuts\\.venv\\Lib\\site-packages\\numba\\core\\dispatcher.py\", line 424, in _compile_for_args\n", + " error_rewrite(e, 'typing')\n", + " File \"D:\\work\\00.project\\cracknuts\\.venv\\Lib\\site-packages\\numba\\core\\dispatcher.py\", line 365, in error_rewrite\n", + " self.update(wave)\n", + " File \"D:\\work\\00.project\\cracknuts\\src\\cracknuts\\jupyter\\scope_panel.py\", line 90, in update\n", + " raise e.with_traceback(None)\n", + "numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)\n", + "\u001b[1m\u001b[1mCan't unify return type from the following types: Tuple(array(int32, 1d, C), array(float64, 1d, C)), Tuple(array(int32, 1d, C), array(int16, 1d, C))\n", + "\u001b[1mReturn of: IR name '$234return_value.17', type 'Tuple(array(int32, 1d, C), array(float64, 1d, C))', location: \u001b[1m\n", + "File \"..\\..\\src\\cracknuts\\trace\\downsample.py\", line 14:\u001b[0m\n", + "\u001b[1mdef minmax(value: NDArray[np.int16], mn: int, mx: int, down_count: int) -> tuple[NDArray[np.int32], NDArray[np.int16]]:\n", + " \n", + " _index = np.arange(mn, mx, dtype=np.int32)\n", + "\u001b[1m return _index, _value\n", + "\u001b[0m \u001b[1m^\u001b[0m\u001b[0m\u001b[0m\n", + "\u001b[1mReturn of: IR name '$618return_value.5', type 'Tuple(array(int32, 1d, C), array(int16, 1d, C))', location: \u001b[1m\n", + "File \"..\\..\\src\\cracknuts\\trace\\downsample.py\", line 28:\u001b[0m\n", + "\u001b[1mdef minmax(value: NDArray[np.int16], mn: int, mx: int, down_count: int) -> tuple[NDArray[np.int32], NDArray[np.int16]]:\n", + " \n", + " down_value[2 * i + 1] = block.min()\n", + "\u001b[1m return down_index, down_value\n", + "\u001b[0m \u001b[1m^\u001b[0m\u001b[0m\u001b[0m\u001b[0m\n", + "\u001b[0m\u001b[1mDuring: Pass nopython_type_inference\u001b[0m\n", + " self.overview_series = {k: minmax(v, 0, v.shape[0], 1920) for k, v in series_data.items()}\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"D:\\work\\00.project\\cracknuts\\.venv\\Lib\\site-packages\\numba\\core\\dispatcher.py\", line 424, in _compile_for_args\n", + " error_rewrite(e, 'typing')\n", + " File \"D:\\work\\00.project\\cracknuts\\.venv\\Lib\\site-packages\\numba\\core\\dispatcher.py\", line 365, in error_rewrite\n", + " raise e.with_traceback(None)\n", + "numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)\n", + "\u001b[1m\u001b[1mCan't unify return type from the following types: Tuple(array(int32, 1d, C), array(float64, 1d, C)), Tuple(array(int32, 1d, C), array(int16, 1d, C))\n", + "\u001b[1mReturn of: IR name '$234return_value.17', type 'Tuple(array(int32, 1d, C), array(float64, 1d, C))', location: \u001b[1m\n", + "File \"..\\..\\src\\cracknuts\\trace\\downsample.py\", line 14:\u001b[0m\n", + "\u001b[1mdef minmax(value: NDArray[np.int16], mn: int, mx: int, down_count: int) -> tuple[NDArray[np.int32], NDArray[np.int16]]:\n", + " \n", + " _index = np.arange(mn, mx, dtype=np.int32)\n", + "\u001b[1m return _index, _value\n", + "\u001b[0m \u001b[1m^\u001b[0m\u001b[0m\u001b[0m\n", + "\u001b[1mReturn of: IR name '$618return_value.5', type 'Tuple(array(int32, 1d, C), array(int16, 1d, C))', location: \u001b[1m\n", + "File \"..\\..\\src\\cracknuts\\trace\\downsample.py\", line 28:\u001b[0m\n", + "\u001b[1mdef minmax(value: NDArray[np.int16], mn: int, mx: int, down_count: int) -> tuple[NDArray[np.int32], NDArray[np.int16]]:\n", + " \n", + " down_value[2 * i + 1] = block.min()\n", + "\u001b[1m return down_index, down_value\n", + "\u001b[0m \u001b[1m^\u001b[0m\u001b[0m\u001b[0m\u001b[0m\n", + "\u001b[0m\u001b[1mDuring: Pass nopython_type_inference\u001b[0m\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n" + ] + } + ], + "source": [ + "import random\n", + "import time\n", + "from cracknuts.cracker import serial\n", + "\n", + "\n", + "cmd_set_aes_enc_key = \"01 00 00 00 00 00 00 10\"\n", + "cmd_aes_enc = \"01 02 00 00 00 00 00 10\"\n", + "\n", + "aes_key = \"11 22 33 44 55 66 77 88 99 00 aa bb cc dd ee ff\"\n", + "aes_data_len = 16\n", + "\n", + "sample_length = 20000\n", + "\n", + "def init(c):\n", + " cracker.nut_voltage_enable()\n", + " cracker.nut_voltage(3.3)\n", + " cracker.nut_clock_enable()\n", + " cracker.nut_clock_freq('8M')\n", + " cracker.uart_enable()\n", + " cracker.osc_sample_clock('48m')\n", + " cracker.osc_sample_length(sample_length)\n", + " cracker.osc_trigger_source('N')\n", + " cracker.osc_analog_gain('B', 10)\n", + " cracker.osc_trigger_level(0)\n", + " cracker.osc_trigger_mode('E')\n", + " cracker.osc_trigger_edge('U')\n", + " cracker.uart_config(baudrate=serial.Baudrate.BAUDRATE_115200, bytesize=serial.Bytesize.EIGHTBITS, parity=serial.Parity.PARITY_NONE, stopbits=serial.Stopbits.STOPBITS_ONE)\n", + "\n", + " time.sleep(2)\n", + " cmd = cmd_set_aes_enc_key + aes_key\n", + " status, ret = cracker.uart_transmit_receive(cmd, timeout=1000, rx_count=6)\n", + "\n", + "def do(cracer, count):\n", + " print(count)\n", + " plaintext_data = random.randbytes(aes_data_len)\n", + " tx_data = bytes.fromhex(cmd_aes_enc.replace(' ', '')) + plaintext_data\n", + " status, ret = cracker.uart_transmit_receive(tx_data, rx_count= 6 + aes_data_len, is_trigger=True)\n", + " \n", + " return {\n", + " \"plaintext\": plaintext_data,\n", + " \"ciphertext\": ret[-aes_data_len:],\n", + " \"key\": bytes.fromhex(aes_key)\n", + " }\n", + "\n", + "\n", + "def finish(c):\n", + " ...\n", + " # print('optional behavior')\n", + "\n", + "\n", + "acq = cn.new_acquisition(cracker, init=init, do=do, finish=finish)\n", + "cn.panel(acq)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "edad4468-9cb3-4ec4-b3d3-9b562db283b7", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tests/jupyter/archive/trigger_reset_analysis.ipynb b/tests/jupyter/archive/trigger_reset_analysis.ipynb new file mode 100644 index 00000000..ae3085a1 --- /dev/null +++ b/tests/jupyter/archive/trigger_reset_analysis.ipynb @@ -0,0 +1,100 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "dbacfa1e-7cb7-44f1-9571-3aa8fa789d0b", + "metadata": {}, + "outputs": [], + "source": [ + "import cracknuts as cn\n", + "from cracknuts.trace import ZarrTraceDataset" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "304aea6b-de65-4f9d-8476-f0f50cf1dd9b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Channel: ['0']\n", + "Trace: 30, 19200000\n", + "Data: 30 plaintext: 0 ciphertext: 0 key: 0 extended: None" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "trace_path = \"dataset/20251102122308.zarr/\"\n", + "\n", + "d = ZarrTraceDataset.load(trace_path)\n", + "\n", + "d.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "aee8758a-6044-4dfe-8a0a-72db46d03d96", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "a231c459da204a2cb1f6545fde00e81e", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "TracePanelWidget(chart_size={'width': 0, 'height': 0}, language='zh', overview_select_range=(0, 0), overview_t…" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tp = cn.panel_trace()\n", + "tp.set_trace_dataset(d)\n", + "tp.show_trace[0, :30]\n", + "tp" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c77ba3fe-9f24-4510-9095-addf160c0af2", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tests/jupyter/archive/uart_receive.ipynb b/tests/jupyter/archive/uart_receive.ipynb new file mode 100644 index 00000000..0fe8b13c --- /dev/null +++ b/tests/jupyter/archive/uart_receive.ipynb @@ -0,0 +1,329 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "0", + "metadata": {}, + "outputs": [], + "source": [ + "# 引入依赖\n", + "import cracknuts as cn\n", + "\n", + "# 创建 cracker \n", + "cracker = cn.new_cracker('192.168.0.15')" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "1", + "metadata": {}, + "outputs": [], + "source": [ + "cracker.connect(force_update_bin=True, force_write_default_config=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "c2eabcc4-a583-4b97-bd58-66582a602c67", + "metadata": {}, + "outputs": [], + "source": [ + "import random" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "591ed9ce-7592-4c1e-978d-7c13815c4767", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0, None)" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "cracker.nut_voltage_enable()\n", + "cracker.nut_voltage(3.3)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "adb0121b-b742-444e-962f-2656c4464a21", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0, None)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cracker.uart_io_enable()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "a8d99263-86fd-4747-98f2-22d4965654a7", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "01 00 00 00 00 00 00 10 11 22 33 44 55 66 77 88 99 00 aa bb cc dd ee ff\n", + "0\n", + "00 00 00 00 00 00\n" + ] + } + ], + "source": [ + "cmd_set_aes_enc_key = \"01 00 00 00 00 00 00 10\"\n", + "aes_key = \"11 22 33 44 55 66 77 88 99 00 aa bb cc dd ee ff\"\n", + "aes_data_len = 16\n", + "\n", + "# plaintext_data = random.randbytes(aes_data_len)\n", + "# tx_data = bytes.fromhex(cmd_aes_enc.replace(' ', '')) + plaintext_data\n", + "cmd = cmd_set_aes_enc_key + ' ' + aes_key\n", + "status, ret = cracker.uart_transmit_receive(cmd, timeout=1000, rx_count=6)\n", + "\n", + "print(cmd)\n", + "print(status)\n", + "print(ret.hex(' ') if ret else 'None')\n", + "\n", + "# cracker.uart_transmit_receive(tx_data, rx_count= 6 + aes_data_len, is_trigger=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "3fda7c7b-11a4-4bef-96d5-23fb764824a0", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "01 02 00 00 00 00 00 10 df b2 f7 6a 62 53 38 f7 07 67 e8 fb 8d 0d 67 25\n", + "None\n" + ] + } + ], + "source": [ + "cmd_aes_enc = \"01 02 00 00 00 00 00 10\"\n", + "plaintext_data = random.randbytes(aes_data_len)\n", + "tx_data = bytes.fromhex(cmd_aes_enc.replace(' ', '')) + plaintext_data\n", + "print(tx_data.hex(' '))\n", + "# s, r = cracker.uart_transmit_receive(tx_data, rx_count= 6 + aes_data_len, is_trigger=True)\n", + "# s, r = cracker.uart_transmit_receive(tx_data, rx_count=6, is_trigger=True)\n", + "s, r = cracker.uart_transmit(tx_data, is_trigger=True)\n", + "\n", + "print(r.hex(' ') if r else 'None')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eca717c6-019e-4832-80a8-e994e9780d6f", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "bdcec7ce-4654-4356-b5b6-9d76ff9c9ae0", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "00 00 00 00 00 10 20 7a c1 bc 35 25 f8 10 7d 9a e3 78 ad 31 bc a9\n" + ] + } + ], + "source": [ + "s, r = cracker.uart_receive_fifo_dump()\n", + "print(r.hex(' ') if r else 'None')" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "10239b57-b49e-418c-b7de-d7edc4bcb544", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "00 00 00 00 00 10 dc a1 a0 de 51 7a 46 71 40 68 27 bd 49 f4 74 ea\n" + ] + } + ], + "source": [ + "s, r = cracker.uart_receive(rx_count=22)\n", + "print(r.hex(' ') if r else 'None')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cc1e8740-01d1-4584-b29b-3df82d0e5ad1", + "metadata": {}, + "outputs": [], + "source": [ + "print(cracker.register_read(base_address=0x43c10000, offset=0x54))\n", + "print(cracker.register_read(base_address=0x43c10000, offset=0x58))\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "723228e6-012c-4707-b038-acddabb4433e", + "metadata": {}, + "outputs": [], + "source": [ + "print(cracker.register_read(base_address=0x43c10000, offset=0x40))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2", + "metadata": {}, + "outputs": [], + "source": [ + "cracker.get_id() # 获取设备ID" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3", + "metadata": {}, + "outputs": [], + "source": [ + "import random\n", + "import time\n", + "from cracknuts.cracker import serial\n", + "\n", + "\n", + "cmd_set_aes_enc_key = \"01 00 00 00 00 00 00 10\"\n", + "cmd_aes_enc = \"01 02 00 00 00 00 00 10\"\n", + "\n", + "aes_key = \"11 22 33 44 55 66 77 88 99 00 aa bb cc dd ee ff\"\n", + "aes_data_len = 16\n", + "\n", + "sample_length = 20000\n", + "\n", + "def init(c):\n", + " cracker.nut_voltage_enable()\n", + " cracker.nut_voltage(3.3)\n", + " cracker.nut_clock_enable()\n", + " cracker.nut_clock_freq('8M')\n", + " cracker.uart_io_enable()\n", + " cracker.osc_sample_clock('48m')\n", + " cracker.osc_sample_length(sample_length)\n", + " cracker.osc_trigger_source('N')\n", + " cracker.osc_analog_gain('B', 10)\n", + " cracker.osc_trigger_level(0)\n", + " cracker.osc_trigger_mode('E')\n", + " cracker.osc_trigger_edge('U')\n", + " cracker.uart_config(baudrate=serial.Baudrate.BAUDRATE_115200, bytesize=serial.Bytesize.EIGHTBITS, parity=serial.Parity.PARITY_NONE, stopbits=serial.Stopbits.STOPBITS_ONE)\n", + "\n", + " time.sleep(2)\n", + " cmd = cmd_set_aes_enc_key + aes_key\n", + " status, ret = cracker.uart_transmit_receive(cmd, timeout=1000, rx_count=6)\n", + "\n", + "def do(cracer, count):\n", + " plaintext_data = random.randbytes(aes_data_len)\n", + " tx_data = bytes.fromhex(cmd_aes_enc.replace(' ', '')) + plaintext_data\n", + " status, ret = cracker.uart_transmit_receive(tx_data, rx_count= 6 + aes_data_len, is_trigger=True)\n", + " \n", + " return {\n", + " \"plaintext\": plaintext_data,\n", + " \"ciphertext\": ret[-aes_data_len:],\n", + " \"key\": bytes.fromhex(aes_key)\n", + " }\n", + "\n", + "\n", + "def finish(c):\n", + " ...\n", + " # print('optional behavior')\n", + "\n", + "\n", + "acq = cn.new_acquisition(cracker, init=init, do=do, finish=finish)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4", + "metadata": {}, + "outputs": [], + "source": [ + "cn.panel(acq)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e8f3e5e2-f235-4b9e-9795-c5b1a5823542", + "metadata": {}, + "outputs": [], + "source": [ + "cracker.set_logging_level('debug')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a5a65297-d6bf-41cf-acb3-6de66922a702", + "metadata": {}, + "outputs": [], + "source": [ + "cracker.get_firmware_version()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tests/jupyter/test_cracknuts_panel.py b/tests/jupyter/test_cracknuts_panel.py deleted file mode 100644 index 8705ba67..00000000 --- a/tests/jupyter/test_cracknuts_panel.py +++ /dev/null @@ -1,112 +0,0 @@ -import logging -import os.path -import socket -import struct -import threading -import time -import subprocess -import sys -import pytest -from pathlib import Path -from playwright.sync_api import sync_playwright -import cracknuts.mock as mock -from cracknuts import CrackerS1 -from cracknuts.cracker.protocol import Command - - -@pytest.fixture(scope='module') -def mock_cracker(): - def start_mock_cracker(): - # mock.start(logging_level=logging.WARNING) - mock.start(logging_level=logging.INFO) - - mock_thread = threading.Thread(target=start_mock_cracker) - mock_thread.daemon = True - mock_thread.start() - time.sleep(1) - yield - - -def wait_for_jupyter(port=8888, timeout=10): - start_time = time.time() - while time.time() - start_time < timeout: - with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: - if s.connect_ex(("localhost", port)) == 0: - return True - time.sleep(0.5) - return False - - -@pytest.fixture(scope="module", autouse=True) -def start_jupyter_lab(request): - jupyter_process = subprocess.Popen( - [str(Path(sys.executable)), "-m", "jupyter", "lab", "--no-browser", "--ServerApp.token=''", - f"{os.path.dirname(request.fspath)}/test_cracknuts_panel.ipynb"], - stdout=subprocess.PIPE, stderr=subprocess.PIPE - ) - - if not wait_for_jupyter(): - raise RuntimeError("Jupyter Lab 启动失败") - - yield - - jupyter_process.terminate() - jupyter_process.wait() - - -@pytest.fixture(scope="module") -def browser(start_jupyter_lab): - with sync_playwright() as p: - browser = p.chromium.launch(headless=False) - # browser = p.chromium.launch() - yield browser - browser.close() - - -@pytest.fixture(scope="module") -def jupyter_page(browser): - context = browser.new_context() - page = context.new_page() - # page.set_viewport_size(viewport_size={"width": 1920, "height": 1080}) - yield page - page.close() - - -@pytest.fixture(scope="module") -def assert_cracker(mock_cracker): - cracker = CrackerS1("localhost") - cracker.connect(update_bin=False) - yield cracker - - -def get_result_by_command(device, command): - _, r = device.send_with_command(0xFFFF, payload=struct.pack('>I', command)) - return r - - -@pytest.fixture(scope="module") -def run_cell(mock_cracker, jupyter_page): - jupyter_page.goto('http://localhost:8888/lab/workspaces/auto-0/tree/test_cracknuts_panel.ipynb') - - jupyter_page.click("div.jp-Cell:first-of-type", timeout=15000) - - jupyter_page.click( - 'jp-button[title="Run this cell and advance (Shift+Enter)"][data-command="notebook:run-cell-and-select-next"]', timeout=15000) - - jupyter_page.wait_for_selector("#cracknuts_widget", timeout=15000, state="attached") - - -def test_uart_enable_disable(run_cell, assert_cracker, jupyter_page): - jupyter_page.click("#cracker_config_uart_enable", timeout=5000) - assert struct.unpack('?', get_result_by_command(assert_cracker, Command.CRACKER_UART_ENABLE))[0] - - # jupyter_page.click("#cracker_config_uart_enable", timeout=5000) - # assert not struct.unpack('?', get_result_by_command(assert_cracker, Command.CRACKER_UART_ENABLE))[0] - - jupyter_page.query_selector('.ant-select:has(#cracker_config_uart_baudrate)').click() - jupyter_page.click('.ant-select-item.ant-select-item-option[title="57600"]', timeout=5000) - assert struct.unpack('>BBBI', get_result_by_command(assert_cracker, Command.CRACKER_UART_CONFIG))[3] == 57600 - - jupyter_page.query_selector('.ant-select:has(#cracker_config_uart_baudrate)').click() - jupyter_page.click('.ant-select-item.ant-select-item-option[title="9600"]', timeout=5000) - assert struct.unpack('>BBBI', get_result_by_command(assert_cracker, Command.CRACKER_UART_CONFIG))[3] == 9600 \ No newline at end of file From 5278573d3178363fe5f11de00707215af8ba992a Mon Sep 17 00:00:00 2001 From: Dingzb Date: Sun, 11 Jan 2026 10:49:35 +0800 Subject: [PATCH 2/4] fix: glitch effect regression after merge --- src/cracknuts/firmware/map.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cracknuts/firmware/map.json b/src/cracknuts/firmware/map.json index b4cc2dbd..b95836e0 100644 --- a/src/cracknuts/firmware/map.json +++ b/src/cracknuts/firmware/map.json @@ -21,10 +21,10 @@ }, "cracker_g1_v1.0": { "server": "server-0.5.6-alpha.3.bin", - "bitstream": "bs-cracker_g1_v0.1-0.0.0-alpha.6.bit.bin" + "bitstream": "bs-cracker_g1_v0.1-0.0.0-alpha.9.bit.bin" }, - "cracker_g1_v1.0": { + "cracker_g1d_v1.0": { "server": "server-0.5.6-alpha.3.bin", - "bitstream": "bs-cracker_g1_v0.1-0.0.0-alpha.6.bit.bin" + "bitstream": "bs-cracker_g1_v0.1-0.0.0-alpha.9.bit.bin" } } \ No newline at end of file From 7b50328cc8a1ecfd7e7f00fbc30ccb8adb66126c Mon Sep 17 00:00:00 2001 From: Dingzb Date: Sun, 11 Jan 2026 16:20:37 +0800 Subject: [PATCH 3/4] fix: glitch effect regression after merge --- src/cracknuts/firmware/map.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cracknuts/firmware/map.json b/src/cracknuts/firmware/map.json index b95836e0..8df718cc 100644 --- a/src/cracknuts/firmware/map.json +++ b/src/cracknuts/firmware/map.json @@ -23,7 +23,7 @@ "server": "server-0.5.6-alpha.3.bin", "bitstream": "bs-cracker_g1_v0.1-0.0.0-alpha.9.bit.bin" }, - "cracker_g1d_v1.0": { + "cracker_g1d_v1_1": { "server": "server-0.5.6-alpha.3.bin", "bitstream": "bs-cracker_g1_v0.1-0.0.0-alpha.9.bit.bin" } From 0a977313b4a50579a2eab78b7fca5cae93bf93eb Mon Sep 17 00:00:00 2001 From: Dingzb Date: Sun, 11 Jan 2026 17:04:50 +0800 Subject: [PATCH 4/4] fix: glitch effect regression after merge --- .../firmware/bs-cracker_g1_v0.1-0.0.0-alpha.8.bit.bin | 3 --- .../firmware/bs-cracker_s1_v0.1-0.1.0-alpha.12.bit.bin | 3 --- .../firmware/bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin | 3 +++ .../firmware/bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin | 3 --- src/cracknuts/firmware/map.json | 10 +++++----- src/cracknuts/firmware/server-0.5.6-alpha.2.bin | 3 --- src/cracknuts/firmware/server-sd-0.5.6-alpha.2.bin | 3 --- 7 files changed, 8 insertions(+), 20 deletions(-) delete mode 100644 src/cracknuts/firmware/bs-cracker_g1_v0.1-0.0.0-alpha.8.bit.bin delete mode 100644 src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.12.bit.bin create mode 100644 src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin delete mode 100644 src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin delete mode 100644 src/cracknuts/firmware/server-0.5.6-alpha.2.bin delete mode 100644 src/cracknuts/firmware/server-sd-0.5.6-alpha.2.bin diff --git a/src/cracknuts/firmware/bs-cracker_g1_v0.1-0.0.0-alpha.8.bit.bin b/src/cracknuts/firmware/bs-cracker_g1_v0.1-0.0.0-alpha.8.bit.bin deleted file mode 100644 index 7c116fe8..00000000 --- a/src/cracknuts/firmware/bs-cracker_g1_v0.1-0.0.0-alpha.8.bit.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bfc1f2b6736852cacd251e8bd6bd4a87e921fad4577feb7ffab0122605e77bd3 -size 4045568 diff --git a/src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.12.bit.bin b/src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.12.bit.bin deleted file mode 100644 index 2d4aabcf..00000000 --- a/src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.12.bit.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c789ef83242001b97059764e1d8868b987104f42d05574091c6d425579cf30e6 -size 4045568 diff --git a/src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin b/src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin new file mode 100644 index 00000000..34f5ce66 --- /dev/null +++ b/src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa795d93db652a53a71df42df00c97f198c1ab9659a4bb0d4f7939f62413b990 +size 4045568 diff --git a/src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin b/src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin deleted file mode 100644 index cbac49fa..00000000 --- a/src/cracknuts/firmware/bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:230adfd023946da7996cb5823d5a17cd63a76de681ef18d44c2666b05e652fe3 -size 4045568 diff --git a/src/cracknuts/firmware/map.json b/src/cracknuts/firmware/map.json index 8df718cc..6fc29b21 100644 --- a/src/cracknuts/firmware/map.json +++ b/src/cracknuts/firmware/map.json @@ -1,23 +1,23 @@ { "cracker_s1_beta1": { "server": "server-0.5.6-alpha.3.bin", - "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin" + "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin" }, "cracker_s1_v0.1": { "server": "server-0.5.6-alpha.3.bin", - "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin" + "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin" }, "cracker_s1_v0.2": { "server": "server-0.5.6-alpha.3.bin", - "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin" + "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin" }, "cracker_s1_v1.0": { "server": "server-0.5.6-alpha.3.bin", - "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin" + "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin" }, "cracker_s1d_v1.0": { "server": "server-sd-0.5.6-alpha.3.bin", - "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.15.bit.bin" + "bitstream": "bs-cracker_s1_v0.1-0.1.0-alpha.14.bit.bin" }, "cracker_g1_v1.0": { "server": "server-0.5.6-alpha.3.bin", diff --git a/src/cracknuts/firmware/server-0.5.6-alpha.2.bin b/src/cracknuts/firmware/server-0.5.6-alpha.2.bin deleted file mode 100644 index 9f9ee59f..00000000 --- a/src/cracknuts/firmware/server-0.5.6-alpha.2.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:02076c63ad854a7730e1d8de33b08d2de17795a9b10378b31525a24b8a452e63 -size 2254020 diff --git a/src/cracknuts/firmware/server-sd-0.5.6-alpha.2.bin b/src/cracknuts/firmware/server-sd-0.5.6-alpha.2.bin deleted file mode 100644 index 50ba06cc..00000000 --- a/src/cracknuts/firmware/server-sd-0.5.6-alpha.2.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cfac4a0bfb5d1983f963129d712310457e0bf0667df39e1c7978e995023729d4 -size 2272988