9.1.3. chipwhisperer.common package

9.1.3.2. Submodules

9.1.3.3. chipwhisperer.common.autoscript module

class chipwhisperer.common.autoscript.AutoScript(parent=None)[source]

Bases: PySide.QtCore.QObject

Base functions for getting/setting stuff to make main script file

addFunction(key, funcstr, argstr, varassignment=None, obj='self', loc=None)[source]
addGroup(key)[source]
addVariable(key, varname, values, loc=None)[source]
autoScriptInit()[source]
clearStatements()[source]
delFunction(key, funcstr)[source]
getImportStatements()[source]
getStatements(key)[source]
importsAppend(statement)[source]
mergeGroups(key, otherscript, prefix='')[source]
runScriptFunction = <PySide.QtCore.Signal object at 0x044385E0>
scriptsUpdated = <PySide.QtCore.Signal object at 0x044385A0>
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x0443D350>
class chipwhisperer.common.autoscript.AutoScriptBase(parent=None, console=None, showScriptParameter=None)[source]

Bases: object

doAnalysis()[source]
doneAnalysis()[source]
doneReporting()[source]
initAnalysis()[source]
initPreprocessing()[source]
initProject()[source]
initReporting()[source]
log(sr, level=None)[source]
project()[source]
setProject(project)[source]
setTraceManager(tmanager)[source]
traceManager()[source]
class chipwhisperer.common.autoscript.SmartStatements[source]

Bases: object

SmartStatements is a simple class which holds a list of python commands to be run in a list. Adding a new command with addFunctionCall() will automatically replace a previous call in-place with the new arguments.

addFunctionCall(methodname, arguments, varassignment=None, obj='self', loc=None)[source]

Will add a python statement of the format ‘methodname(arguments)’ to the list of Python commands. If you already have a statement calling methodname() this will be replaced in-place.

addSelfReplacement(newstr, force=False)[source]
addVariableAssignment(varname, values, loc=None)[source]
delFunctionCall(methodname)[source]

Remove a function call or silently fail

selfReplacement()[source]
statements(replaceSelf=True)[source]

9.1.3.4. chipwhisperer.common.graphbits module

class chipwhisperer.common.graphbits.BitPlotWidget(parent=None)[source]

Bases: PySide.QtGui.QWidget

This class plots the faults injected in some location

addCustomLegendItem(legend, item, name)[source]
rgb(minimum, maximum, value)[source]
setData(data, dotsize=2, ydiv=4, yoffset=7, ymajor=8, failures=None)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x045B9F58>
class chipwhisperer.common.graphbits.CustomItemSample(item, brectx=20, brecty=20)[source]

Bases: pyqtgraph.graphicsItems.GraphicsWidget.GraphicsWidget

Copy of ItemSample from GIT

boundingRect()[source]
paint(p, *args)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x0461E800>
class chipwhisperer.common.graphbits.CustomLabelItem(name, div=4)[source]

Bases: pyqtgraph.graphicsItems.LabelItem.LabelItem

itemRect()[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x0461E940>
class chipwhisperer.common.graphbits.FaultTypevsTwoParameters(parent=None, xname='Parameter #1 Name', yname='Parameter #2 Name', title='100% Not Bullshit', legend=None)[source]

Bases: PySide.QtGui.QWidget

Plot type of fault vs. two parameters

addCustomLegendItem(legend, item, name)[source]
rgb(minimum, maximum, value)[source]
setData(data, dotsize=6)[source]
setData_old(data, dotsize=2, ydiv=4, yoffset=7, ymajor=8, failures=None)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x045B9198>
class chipwhisperer.common.graphbits.fakeItem[source]

Bases: object

9.1.3.5. chipwhisperer.common.GraphWidget module

class chipwhisperer.common.GraphWidget.ColorDialog(colorInt=None, auto=None)[source]

Bases: PySide.QtGui.QDialog

Simple dialog to pick colours for the trace data.

currentIndexChanged(indx)[source]
getValues()[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x07BE85A8>
class chipwhisperer.common.GraphWidget.GraphWidget[source]

Bases: PySide.QtGui.QWidget

This GraphWidget holds a pyqtgraph PlotWidget, and adds a toolbar for the user to control it.

VBStateChanged(obj)[source]

Called when ViewBox state changes, used to sync X/Y AutoScale buttons

VBXRangeChanged(vb, range)[source]

Called when X-Range changed

YDefault(extraarg=None)[source]

Copy default Y range axis to active view

addPersistantItem(item)[source]
addWidget(widget)[source]
checkPersistantItems()[source]
clearCustomWidgets()[source]
clearPushed()[source]

Clear display

colorPrompt(enabled)[source]

Prompt user to set colours

dataChanged = <PySide.QtCore.Signal object at 0x07BF7220>
passTrace(trace, startoffset=0, ghostTrace=False, pen=None)[source]

Plot a new trace, where X-Axis is simply ‘sample number’ (e.g. integer counting 0,1,2,...N-1).

Parameters:
  • startoffset (int) – Offset of X-Axis, such that zero point is marked as this number
  • ghostTrace (bool) – By default the last plotted trace is stored for use with stuff such as an overlay that selects data off the graph. If ghostTrace is set to ‘true’ the passed data is NOT stored.
setColorInt(colorint, numcolors=16)[source]
setDefaultYRange(lower, upper)[source]

Set default Y-Axis range, for when user clicks default button

setDefaults()[source]
setLabels(top=None, xaxis=None, yaxis=None)[source]
setPersistance(enabled)[source]

Enable Persistance mode, which means display NOT cleared before new traces added

setXRange(lower, upper)[source]

Set the X Axis to extend from lower to upper

setYRange(lower, upper)[source]

Set the Y Axis to extend from lower to upper

staticMetaObject = <PySide.QtCore.QMetaObject object at 0x07BE8580>
xAutoScale(enabled)[source]

Auto-fit X axis to data

xLocked(enabled)[source]

Lock X axis, such it doesn’t change with new data

xRange()[source]

Returns the X-Range

xRangeChanged = <PySide.QtCore.Signal object at 0x07BF7040>
yAutoScale(enabled)[source]

Auto-fit Y axis to data

yLocked(enabled)[source]

Lock Y axis, such it doesn’t change with new data

9.1.3.6. chipwhisperer.common.KeyScheduleWidget module

9.1.3.7. chipwhisperer.common.MainChip module

class chipwhisperer.common.MainChip.MainChip(name='Demo', icon='cwicon')[source]

Bases: PySide.QtGui.QMainWindow

This is the base GUI class, used for both the Analyzer and Capture software. It defines a number of useful features such as the ability to add docks, setting windows, consoles for logging errors, etc. You can run a demo which shows the basic features, which would look like this:

_images/mainchip-demo.png
MaxRecentFiles = 4
aboutdialog()[source]

Tells the User

addConsole(name='Debug Logging', visible=True, redirectStdOut=True)[source]

Add a QTextBrowser, used as a console/debug window

addDock(dockWidget, name='Settings', area=PySide.QtCore.Qt.DockWidgetArea.LeftDockWidgetArea, allowedAreas=<DockWidgetAreas object at 0x07EF5410>, visible=True, addToWindows=True)[source]

Add a dockwidget to the main window, which also adds it to the ‘Windows’ menu

addPythonConsole(name='Python Console', visible=False)[source]

Add a python console, inside which you can access the Python interpreter

addSettings(tree, name)[source]

Adds a dockwidget designed to store a ParameterTree, also adds to ‘Windows’ menu

addTraceDock(name)[source]

Add a new GraphWidget in a dock, you can get the GW with .widget() property of returned QDockWidget

addWindowMenuAction(action, section)[source]

When you add a dock, this function also adds an option to show/hide it form the ‘Window’ menu

Parameters:
  • action (QAction) – Action to take when clicking item form ‘Window’ menu
  • section (str) – Name of section used to group together
clearAllSettings()[source]

Clear all saved QSettings(), such as window location etc

closeEvent(event)[source]

Called when window is closed, attempts to save state/geometry

createFileActions()[source]

Add the file actions (open/save/new)

createMenus()[source]

Create all menus (File, Window, etc)

dockifySettings()[source]
enforceMenuOrder()[source]

Makes sure menus appear in correct order, required as they get reordered when we add a new item to one

helpdialog()[source]

Helps the User

initUI(icon='cwicon')[source]

Setup the UI, creating statusbar, setting title, menus, etc

listModules()[source]

Should return a list of all possible imports, used to test which modules are missing

listModulesShow()[source]

Opens the Dialog which shows loaded/unloaded modules

macWorkArounds()[source]
newFile = <PySide.QtCore.Signal object at 0x0862DB60>
okToContinue()[source]
openFile = <PySide.QtCore.Signal object at 0x0862DB20>
openRecentFile()[source]
project()[source]
projectChanged = <PySide.QtCore.Signal object at 0x0862DB80>
restoreDockGeometry()[source]

Call after any class-specific setup (e.g. making docks), as this will then restore everything using saved QSettings()

saveFile = <PySide.QtCore.Signal object at 0x0862DB40>
setCurrentFile(fname)[source]

Set current project filename, adds it to recent file list

setParameter(parameter, echo=False)[source]

Sets a parameter based on a list, used for scripting in combination with showScriptParameter

setProject(proj)[source]
settings_docks = []
showScriptParameter(param, changes, topParam)[source]

This function is used to tell the user what they should pass to setParameter in order to recreate a system. This will automatically be called if the module has done the following:

When calling ExtendedParameter.setupParameter(), have passed a reference to ‘self’ like this:

ExtendedParameter.setupExtended(self.params, self)

Have a function called paramTreeChanged in the class which calls showScriptParameter (this function). Typically done like the following, where self.showScriptParameter is setup in the setupExtended() call. You might need to pass the reference to this instance down to lower modules.:

def paramTreeChanged(self, param, changes):
    if self.showScriptParameter is not None:
        self.showScriptParameter(param, changes, self.params)                
staticMetaObject = <PySide.QtCore.QMetaObject object>
strippedName(fullFileName)[source]
updateRecentFileActions()[source]

Update & Load the list of recent files

updateTitleBar()[source]

Update filename shown in title bar

class chipwhisperer.common.MainChip.ModuleListDialog(lmFunc)[source]

Bases: PySide.QtGui.QDialog

staticMetaObject = <PySide.QtCore.QMetaObject object at 0x086326C0>
class chipwhisperer.common.MainChip.OutLog(edit, out=None, color=None, origStdout=None)[source]
write(m)[source]
chipwhisperer.common.MainChip.main()[source]
class chipwhisperer.common.MainChip.saveProjectDialog(parent=None)[source]

Bases: PySide.QtGui.QDialog

setValue(but)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object>
value()[source]

9.1.3.8. chipwhisperer.common.ParameterTypesCustom module

class chipwhisperer.common.ParameterTypesCustom.FilelistItem(param, depth)[source]

Bases: pyqtgraph.parametertree.parameterTypes.WidgetParameterItem

WidgetParameterItem subclass providing list of files with copy/add/remove

addFile()[source]
addFileToList(desc, filename, fixedName=False)[source]
copyFile()[source]
editFile()[source]
limitsChanged(param, limits)[source]

Called when the parameter’s limits have changed

makeLayout()[source]
makeWidget()[source]
removeFile()[source]
setDefault(rnum=None)[source]
setRows(rows)[source]
setValue(val)[source]
svChangedEmit()[source]
svChangingEmit(val)[source]
value()[source]
class chipwhisperer.common.ParameterTypesCustom.FilelistParameter(**opts)[source]

Bases: pyqtgraph.parametertree.Parameter.Parameter

itemClass

alias of FilelistItem

setLimits(limits)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x1045D5A8>
class chipwhisperer.common.ParameterTypesCustom.RangeParameter(**opts)[source]

Bases: pyqtgraph.parametertree.Parameter.Parameter

itemClass

alias of RangeParameterItem

staticMetaObject = <PySide.QtCore.QMetaObject object at 0x1045D670>
class chipwhisperer.common.ParameterTypesCustom.RangeParameterGraph(**opts)[source]

Bases: pyqtgraph.parametertree.Parameter.Parameter

itemClass

alias of RangeParameterGraphItem

staticMetaObject = <PySide.QtCore.QMetaObject object at 0x1045D4B8>
class chipwhisperer.common.ParameterTypesCustom.RangeParameterGraphItem(param, depth)[source]

Bases: chipwhisperer.common.ParameterTypesCustom.RangeParameterItem

buttonPressed(status)[source]
hideEditor()[source]
limitsChanged(param, limits)[source]

Called when the parameter’s limits have changed

lriChanged()[source]
makeWidget()[source]
sbChanged()[source]
showEditor()[source]
class chipwhisperer.common.ParameterTypesCustom.RangeParameterItem(param, depth)[source]

Bases: pyqtgraph.parametertree.parameterTypes.WidgetParameterItem

WidgetParameterItem subclass providing two int selection for range

limitsChanged(param, limits)[source]

Called when the parameter’s limits have changed

makeLayout()[source]
makeWidget()[source]
setValue(val)[source]
svChangedEmit()[source]
svChangingEmit(val)[source]
svHighChanging()[source]
svLowChanging()[source]
validateLimits(change=0)[source]
value()[source]
class chipwhisperer.common.ParameterTypesCustom.SigStuff[source]

Bases: PySide.QtGui.QWidget

sigValueChanged = <PySide.QtCore.Signal object>
sigValueChanging = <PySide.QtCore.Signal object>
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x07D01328>
class chipwhisperer.common.ParameterTypesCustom.SpinBoxWithSet(**opts)[source]

Bases: pyqtgraph.parametertree.Parameter.Parameter

itemClass

alias of SpinBoxWithSetItem

staticMetaObject = <PySide.QtCore.QMetaObject object at 0x1045D508>
class chipwhisperer.common.ParameterTypesCustom.SpinBoxWithSetItem(*args, **kwargs)[source]

Bases: pyqtgraph.parametertree.parameterTypes.WidgetParameterItem

makeWidget()[source]

Copy of SpinBox from PyQtGraph 0.9.10 & later, which adds special parameters we hack on

updateDefaultBtn()[source]

9.1.3.9. chipwhisperer.common.ProjectFormat module

class chipwhisperer.common.ProjectFormat.ConfigObjProj(callback=None, *args, **kwargs)[source]

Bases: configobj.ConfigObj

Extends ConfigObj to add a callback feature when something is written, used to determine when the project file becomes ‘dirty’.

setCallback(cb)[source]
class chipwhisperer.common.ProjectFormat.ProjectDiffWidget(parent=None, project=None)[source]

Bases: PySide.QtGui.QWidget

Widget that displays differences between versions of the project file

checkDiff(ignored=None, updateGUI=False)[source]

Check if there is a difference - returns True if so, and False if no changes present. Also updates widget with overview of the differences if requested with updateGUI

setProject(proj)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x07CFE850>
updateParamTree(paramTree, changelist, name)[source]
class chipwhisperer.common.ProjectFormat.ProjectFormat(parent=None)[source]

Bases: PySide.QtCore.QObject

addDataConfig(settings=None, sectionName='Aux Data', subsectionName=None)[source]
addParamTree(pt)[source]
addWave(configfile)[source]
checkDataConfig(config, requiredSettings)[source]

Check a configuration section for various settings

checkDataDirectory()[source]
configObjChanged(key)[source]
convertDataFilepathAbs(relativepath)[source]
fileChangedOnDisk = <PySide.QtCore.Signal object at 0x07D0F760>
filenameChanged = <PySide.QtCore.Signal object at 0x07D0F4E0>
getDataConfig(sectionName='Aux Data', subsectionName=None, requiredSettings=None)[source]

Get all configuration sections of data type given in __init__() call, and also matching the given sectionName. e.g. if dataName=’Aux Data’ and sectionName=’Frequency’, this would return a list of all sections of the type ‘Aux Data NNNN - Frequency’.

getDataFilepath(filename, subdirectory='analysis')[source]
hasFilename()[source]
load(f=None)[source]
save()[source]
saveTraceManager()[source]
setAuthor(author)[source]
setFileVersion(ver)[source]
setFilename(f)[source]
setProgramName(name)[source]
setProgramVersion(ver)[source]
setProjectName(name)[source]
setTraceManager(manager)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x07CFE3C8>
valueChanged = <PySide.QtCore.Signal object at 0x07D0FFA0>
chipwhisperer.common.ProjectFormat.convert_to_str(data)[source]

Converts all dictionary elements to string type - similar to what ConfigObj will be doing when it saves and loads the data.

chipwhisperer.common.ProjectFormat.delete_keys_from_dict(dict_del, lst_keys)[source]
chipwhisperer.common.ProjectFormat.delete_objects_from_dict(d)[source]

9.1.3.10. chipwhisperer.common.PythonConsole module

9.1.3.10.1. PySideKick.Console: a simple embeddable python shell

This module provides the call QPythonConsole, a python shell that can be embedded in your GUI.

class chipwhisperer.common.PythonConsole.QPythonConsole(parent=None, locals=None)[source]

Bases: PySide.QtGui.QWidget

A simple python console to embed in your GUI.

This widget provides a simple interactive python console that you can embed in your GUI (e.g. for debugging purposes). Use it like so:

self.debug_window.layout().addWidget(QPythonConsole())

You can customize the variables that are available in the shell by passing a dict as the “locals” argument.

eventFilter(obj, event)[source]
go_history(offset)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x07E26760>

9.1.3.11. chipwhisperer.common.aes_cipher module

AES Block Cipher.

Performs single block cipher decipher operations on a 16 element list of integers. These integers represent 8 bit bytes in a 128 bit block. The result of cipher or decipher operations is the transformed 16 element list of integers.

Running this file as __main__ will result in a self-test of the algorithm.

Algorithm per NIST FIPS-197 http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf

Thanks to serprex for many optimizations in this code. For even more, see his github fork of this project.

Copyright (c) 2010, Adam Newman http://www.caller9.com/ Demur Rumed https://github.com/serprex Licensed under the MIT license http://www.opensource.org/licenses/mit-license.php

class chipwhisperer.common.aes_cipher.AESCipher(expanded_key)[source]

Perform single block AES cipher/decipher

cipher_block(state)[source]

Perform AES block cipher on input

decipher_block(state)[source]

Perform AES block decipher on input

9.1.3.12. chipwhisperer.common.pysidegraph module

class chipwhisperer.common.pysidegraph.TestClass[source]

Bases: PySide.QtGui.QMainWindow

initUI()[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x10E7A170>
chipwhisperer.common.pysidegraph.main()[source]
class chipwhisperer.common.pysidegraph.pysideGraph(name='', xmin=0, xmax=1, ymin=-1.0, ymax=1.0, xfigsize=600, yfigsize=600, showNav=True, showExtraSettings=False)[source]
getWidget()[source]
redraw()[source]
updateAxis()[source]
updateData(data=None, holdOn=False, updateAxis=True, redraw=True)[source]

9.1.3.13. chipwhisperer.common.qrc_resources module

chipwhisperer.common.qrc_resources.qCleanupResources()[source]
chipwhisperer.common.qrc_resources.qInitResources()[source]

9.1.3.14. chipwhisperer.common.utils module

chipwhisperer.common.utils.hexstr2list(data)[source]

Convert a string with hex numbers into a list of numbers

chipwhisperer.common.utils.list2hexstr(data, delim='', prefix='')[source]

Convert a list of integers to a hex string, with optional deliminators/prefix

delim is inserted between each list item

prefix is inserted infront of each item (including first item)

9.1.3.15. chipwhisperer.common.ValidationDialog module

class chipwhisperer.common.ValidationDialog.ValidationDialog(parent=None, onlyOkButton=False)[source]

Bases: PySide.QtGui.QDialog

addMessage(level, module, note, fix, uuid)[source]
clearDefaultErrorLevels()[source]
demoteItem(uuid)[source]

Demote item with given UUID to Info

numWarnings()[source]
promoteItem(uuid)[source]

Promote item with given UUID to Warning

reloadTables()[source]
setupLayout(onlyOkButton=False)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x10F13260>

9.1.3.16. Module contents