newaetech / chipwhisperer-jupyter Goto Github PK
View Code? Open in Web Editor NEWInteractive ChipWhisperer tutorials using Jupyter notebooks.
Interactive ChipWhisperer tutorials using Jupyter notebooks.
For the plotting in the show(o)
block, you must have specifically bokeh-2.4.3.
However it conflicts with other library requirements:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
jupyter-bokeh 4.0.0 requires bokeh==3.*, but you have bokeh 2.4.3 which is incompatible.
panel 1.3.8 requires bokeh<3.4.0,>=3.2.0, but you have bokeh 2.4.3 which is incompatible.
using a higher version of bokeh will result in error upon execution of the above block.
pyzmq fails to build
It would be really nice to be able to have a server with multiple hardware boards attached and have the jupyter notebooks run for all of them. This will require a preprocessor that changes all the cw.scope() calls to ones that have the serial numbers in them, specified by the tutorials.yaml configuration file for running the functional tests.
Dear all,
the glitch code on notebook "Fault 2_1" (which starts with "from importlib import reload") unfortunately has a bug (see figure).
However, the code on [1] (see "In [9]" and following figure) is correct.
Cheers,
Fabio
SerializationError: can't serialize <class 'range'>
I'm running the default packages from requirements.txt with the suggested pyenv 3.9.5. Bokeh 3.1.1 is relatively new, maybe thats the issue? I found a quick fix, try replacing:
# xrange = range(len(trace_array[0]))[plot_start:plot_end]
with
xrange = [x for x in range(len(trace_array[0]))][plot_start:plot_end]
Look into adding a filter for Jupyter Notebook using jq that removes output and metadata. Issues:
Sorry, I have a simple question. π
Is there a special reason to use emoji "courses/sca101/generators/Lab* - GENERATOR π.ipynb" ?
I use dropbox to sync multiple devices conveniently. But, the filename with emoji makes a sync problem.
https://help.dropbox.com/en-en/installs-integrations/sync-uploads/files-not-syncing
Hello, I would like to ask if it is possible to compile Verilog code using the ChipWhisperer-Lite XMEGA. The tutorials I have found so far are all based on C code. As I understand it, I need to create a new folder in the \hardware\victims\firmware directory and add my Verilog code there. Could you please confirm if this is the correct approach? I am not entirely sure. Thank you so much!
Old notebooks used bokeh/holoviews, so this wasn't really an issue, but now most notebooks use matplotlib.
Can be fixed by %matplotlib inline
, but then plots lose their interactivity.
I get the error
$ python -m jupyter notebook
Traceback (most recent call last):
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/notebook/traittypes.py", line 235, in _resolve_classes
klass = self._resolve_string(klass)
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/traitlets/traitlets.py", line 2018, in _resolve_string
return import_item(string)
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/traitlets/utils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
ModuleNotFoundError: No module named 'jupyter_server.contents'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/.pyenv/versions/cw/bin/jupyter-notebook", line 8, in <module>
sys.exit(main())
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/jupyter_core/application.py", line 281, in launch_instance
super().launch_instance(argv=argv, **kwargs)
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/traitlets/config/application.py", line 1075, in launch_instance
app = cls.instance(**kwargs)
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/traitlets/config/configurable.py", line 583, in instance
inst = cls(*args, **kwargs)
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/traitlets/traitlets.py", line 1294, in __new__
inst.setup_instance(*args, **kwargs)
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/traitlets/traitlets.py", line 1337, in setup_instance
super(HasTraits, self).setup_instance(*args, **kwargs)
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/traitlets/traitlets.py", line 1313, in setup_instance
init(self)
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/notebook/traittypes.py", line 226, in instance_init
self._resolve_classes()
File "/home/user/.pyenv/versions/cw/lib/python3.9/site-packages/notebook/traittypes.py", line 238, in _resolve_classes
warn(f"{klass} is not importable. Is it installed?", ImportWarning)
TypeError: warn() missing 1 required keyword-only argument: 'stacklevel'
As suggested by https://stackoverflow.com/questions/77549493/modulenotfounderror-no-module-named-jupyter-server-contents, this is solved by uninstalling traitlets and reinstalling to fixed version of 5.9.0. I suggest to add it to requirements.txt, but I canΒ΄t test it right. However, reinstalling and installing to this version fixes this issue for me.
Hey,
while working through your (great!) glitching courses I might have encountered a bug in the 1_2 password bypass example, leading to the bypass not working as intended.
As a result from a lot of head-scratching and trial and error I came to notice, that the bypass fails for every wrong password not starting with the correct letter 't'.
This especially expands to the all-zero password used in the solution.
When using an otherwise incorrect password starting with 't' however, the bypass works like a charm.
Given my understanding is correct, the clock glitch should allow us to skip one single instruction.
Looking at the disassembly I assume to see a reason for the described outcome:
When the first letter is 't', r25 is not set to zero at 0x00000338 and the glitch might eventually skip the backward jump at 0x0000033e.
If the initial character takes any other value however, we might glitch over the r25 = 0 assignment, but then are still left in the loop where simply the next check will leave us failing.
Glitching over 0x0000033e instead, the assignment is executed as it should and we are again lost.
Accordingly, the attack can not work as long as the assembly looks as it does and we merely may skip one instruction.
Does this make any sense to you?
Kind regards,
Max
target.write('p' + "00"*16 + \n)
File "", line 1
target.write('p' + "00"*16 + \n)
^
SyntaxError: unexpected character after line continuation character
Solution:
target.write('p' + "00"*16 + "\n")
Simple typo, but on the latest version of the tutorial for Fault 104, the SimpleSerial pre-compile is set to 2_0, which errors the compilation defaulting back to 1_0.
Setting the SS_VER='SS_VER_2_1' successfully built and compiled the FW.
SCOPETYPE can be gotten through the serial number instead. May want to add a check after %run Helper_Scripts/Setup.ipynb
to make sure that the selected scope will work for a given tutorial for each tutorial.
There's probably tutorials that are broken due to API changes. These will need to be solved before release
Hello, thanks for this awesome tutorial!
I would like to contribute Japanese translation for chipwhisperer-jupyter courses.
Could you see it if I fork this repo and send pull-request?
Testing server: Currently not running
Passing:
Issues:
simpleserial_read
that handles glitchesIf I use default setting of the notebook, valid
will always return False.
Compare with Fault 1_2 and Fault 2_2, I find out the SS_VER
is the point. So I fix in #40 .
notebook needs to be pinned at <= 6.5.5 because "ModuleNotFoundError: No module named 'notebook.base'" in notebook >= 7.0.0
perhaps this belongs in chipwhisperer-jupyter requirements.txt not sure
Jupyter-contrib/jupyter_nbextensions_configurator#164
pip install notebook==6.5.5
[E 2023-08-16 15:03:18.848 ServerApp] Uncaught exception GET /api/nbconvert?1692165798678 (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/nbconvert?1692165798678', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
File "/home/user/.pyenv/versions/cw/lib/python3.10/site-packages/tornado/web.py", line 1786, in _execute
result = await result
File "/home/user/.pyenv/versions/cw/lib/python3.10/site-packages/jupyter_server/services/nbconvert/handlers.py", line 40, in get
exporters = await run_sync(base.get_export_names)
File "/home/user/.pyenv/versions/cw/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/home/user/.pyenv/versions/cw/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/home/user/.pyenv/versions/cw/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/home/user/.pyenv/versions/cw/lib/python3.10/site-packages/nbconvert/exporters/base.py", line 150, in get_export_names
e = get_exporter(exporter_name)(config=config)
File "/home/user/.pyenv/versions/cw/lib/python3.10/site-packages/nbconvert/exporters/base.py", line 109, in get_exporter
exporter = [e for e in exporters if e.name == name or e.name == name.lower()][0].load()
File "/home/user/.pyenv/versions/3.10.12/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
module = import_module(match.group('module'))
File "/home/user/.pyenv/versions/3.10.12/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/user/.pyenv/versions/cw/lib/python3.10/site-packages/jupyter_contrib_nbextensions/__init__.py", line 5, in <module>
import jupyter_nbextensions_configurator
File "/home/user/.pyenv/versions/cw/lib/python3.10/site-packages/jupyter_nbextensions_configurator/__init__.py", line 18, in <module>
from notebook.base.handlers import APIHandler, IPythonHandler
ModuleNotFoundError: No module named 'notebook.base'
Hello,
I was trying to go through lab 3_1a in sca201 the other day, but could not get past the beginning of "Communicating with the Bootloader" : the expected checksum (0xA1) would never show up.
In fact, I believe that the limited amount of RAM on the STM32F071RB is causing a stack overflow which, apparently, is messing with the UART part of the HAL : getch() can only be called once, and any subsequent call to getch() hangs the program. This problem does not arise with the STM32F303RC which has more RAM (48 kB vs 16 kB).
int main(void)
{
platform_init();
init_uart();
trigger_setup();
// Do this forever (we don't actually have a jumper to bootloader)
uint8_t i;
uint16_t crc;
uint8_t c;
while(1){
c = (uint8_t)getch();
putch(c);
}
}
int main(void)
{
platform_init();
init_uart();
trigger_setup();
**//Load Super-Secret key
aes256_context ctx;
uint8_t tmp32[32] = SECRET_KEY;
//Load super-secret IV
uint8_t iv[16] = IV;**
//Do this forever (we don't actually have a jumper to bootloader)
uint8_t i;
uint16_t crc;
uint8_t c;
while(1){
c = (uint8_t)getch();
putch(c);
}
}
I tried to determine precisely what in the HAL gets overwritten, but have not been successful in my endeavours.
Respectfully Yours,
TotallyNotAStudent0
Hi,
I have been working through Lab 2_1A using the ChipWhisperer NANO board. I am attempting to insert the multiply instructions; however, doing so results in a syntax error when initializing volatile long int A since Python doesn't support these keywords. I am pasting the instructions into a Jupyter cell and inserting them in that fashion. Maybe I am missing something about how to insert instructions?
We are the recent purchaser of the Chipwhisperer Pro 1200 kit.
We are trying to run the file '1 - Connecting to Hardware', unfortunately we are facing 'NoneType' object has no attribute 'serialstm32f' when we attempt to run the following command:
cw.program_target(scope, cw.programmers.STM32FProgrammer,"../hardware/victims/firmware/simpleserial-aes/simpleserial-aes-CW308_STM32F3.hex" )
We have followed all the commands preceding the mentioned one, as same in the '1 - Connecting to Hardware file'
Any steps we missed or how should we proceed?
Following the instructions for Lab 2_1A, I've encountered the following issue when attempting to build firmware.
I'm running the following in Jupyter:
%%cmd -s "$PLATFORM" cd C:/Users/15055/ChipWhisperer5_64/cw/home/portable/chipwhisperer/hardware/victims/firmware/simpleserial-base-lab2 make PLATFORM=CWNANO CRYPTO_TARGET=NONE
Note that I'm using %%cmd rather than %%bash due to working in a Windows environment. I've used Chocolatey to install a working make command on Windows. I'm using the ChipWhisperer-NANO board and therefore use CWNANO for my platform.
I'm encountering the following error:
process_begin: CreateProcess(NULL, rm -f -- simpleserial-base-CWNANO.hex, ...) failed. make (e=2): The system cannot find the file specified. make[1]: *** [.././Makefile.inc:510: clean_objs] Error 2 make[1]: Leaving directory 'C:/Users/15055/ChipWhisperer5_64/cw/home/portable/chipwhisperer/hardware/victims/firmware/simpleserial-base-lab2' make: *** [.././Makefile.inc:323: all] Error 2
I've verified that the simpleserial-base-lab2 directory exists and contains the makefile and simpleserial-base.c file. What steps should I take to resolve this error?
The Installing ChipWhisperer link in the Getting Started section of the readme appears to be dead:
\ SORRY /
\ /
\ This page does /
] not exist yet. [ ,'|
] [ / |
]___ ___[ ,' |
] ]\ /[ [ |: |
] ] \ / [ [ |: |
] ] ] [ [ [ |: |
] ] ]__ __[ [ [ |: |
] ] ] ]\ _ /[ [ [ [ |: |
] ] ] ] (#) [ [ [ [ :===='
] ] ]_].nHn.[_[ [ [
] ] ] HHHHH. [ [ [
] ] / `HH("N \ [ [
]__]/ HHH " \[__[
] NNN [
] N/" [
] N H [
/ N \
/ q, \
/ \
Hardware should be in all caps
Will probably be kind of hacky: need to check if scope exists, then check if it's connected.
Extra parenthesis in every print command
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.