How to use chipwhisperer - 10 common examples

To help you get started, we’ve selected a few chipwhisperer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github newaetech / chipwhisperer / software / chipwhisperer / capture / api / CWCaptureAPI.py View on Github external
def setScope(self, driver):
        self._scope = driver

        util.active_scope = self._scope
        self.signals.scopeChanged.emit()
github newaetech / chipwhisperer / software / chipwhisperer / analyzer / attacks / models / base.py View on Github external
    @setupSetParam("Hardware Model")
    def setHwModel(self, model, kwargs=None):
        self.model = model
        self.model_kwargs = kwargs
        self._updateHwModel()
        self.sigParametersChanged.emit()
github newaetech / chipwhisperer / software / chipwhisperer / common / api / TraceManager.py View on Github external
"""Save the trace segments information to a project file."""
        config[self.name].clear()
        for indx, t in enumerate(self.traceSegments):
            starttime = datetime.now()
            prefix = starttime.strftime('%Y.%m.%d-%H.%M.%S') + "_"
            t.config.setConfigFilename(os.path.splitext(configfilename)[0] + "_data" + "/traces/config_" + prefix + ".cfg")
            t.config.setAttr("prefix", prefix)
            t.config.setAttr("date", starttime.strftime('%Y-%m-%d %H:%M:%S'))
            config[self.name]['tracefile%d' % indx] = os.path.normpath(os.path.relpath(t.config.configFilename(), os.path.split(configfilename)[0]))
            config[self.name]['enabled%d' % indx] = str(t.enabled)

            t.saveAllTraces(os.path.dirname(t.config.configFilename()), prefix)
        self.dirty.setValue(False)
        self.saved = True

    saveProject = util.camel_case_deprecated(save_project)

    def loadProject(self, configfilename):
        """Load the trace segments information from a project file."""
        config = configparser.RawConfigParser()
        config.read(configfilename)
        alltraces = config.items(self.name)
        self.newProject()

        fdir = os.path.split(configfilename)[0] + "/"

        for t in alltraces:
            if t[0].startswith("tracefile"):
                fname = fdir + t[1]
                fname = os.path.normpath(fname.replace("\\", "/"))
                # print "Opening %s"%fname
                ti = TraceContainerNative()
github newaetech / chipwhisperer / software / chipwhisperer / common / utils / tracesource.py View on Github external
if TraceSource.registeredObjects.pop(self.name, None):
                    TraceSource.sigRegisteredObjectsChanged.emit()
        except KeyError:
            pass

    @classmethod
    def deregisterObject(cls, name, uuid = None):
        """Deregister the TraceSource and emit a signal to inform this event"""
        try:
            if (uuid is None) or (cls.registeredObjects[name].uuid == uuid):
                if cls.registeredObjects.pop(name, None):
                    cls.sigRegisteredObjectsChanged.emit()
        except KeyError:
            pass

class PassiveTraceObserver(Parameterized):
    """Processes data from a TraceSource when requested """

    def __init__(self):
        self._traceSource = None
        self.getParams().addChildren([
            {'name':'Input', 'key':'input', 'type':'list', 'values':TraceSource.registeredObjects, 'default':None, 'get':self.getTraceSource, 'set':self.setTraceSource}
        ])

    @setupSetParam('Input')
    def set_trace_source(self, traceSource):
        if self._traceSource:
            self._traceSource.sigTracesChanged.disconnect(self.tracesUpdated)
        if traceSource:
            traceSource.sigTracesChanged.connect(self.tracesUpdated)
        self._traceSource = traceSource
        self.tracesUpdated()
github newaetech / chipwhisperer / software / chipwhisperer / analyzer / utils / TraceExplorerScripts / PartitionDisplay.py View on Github external
maxarray.append(mloc + startPoint)

                # set to -INF data within +/- the minspace
                mstart = max(0, mloc - minSpace)
                while extendDownhill and mstart>0 and data[mstart-1] <= data[mstart]:
                    mstart-=1
                mend = min(mloc + minSpace, len(data))
                while extendDownhill and mend
github newaetech / chipwhisperer / software / chipwhisperer / capture / ui / EncryptionStatusMonitor.py View on Github external
def __init__(self, parent):
        super(EncryptionStatusMonitor, self).__init__(parent)

        self.dLayout = QVBoxLayout()

        self.textResultsLayout = QGridLayout()
        self.textInLine = QtFixes.QLineEdit()
        self.textOutLine = QtFixes.QLineEdit()
        self.textResultsLayout.addWidget(QLabel("Text In "), 0, 0)
        self.textInLine.setReadOnly(True)
        self.textResultsLayout.addWidget(self.textInLine, 0, 1)
        self.textResultsLayout.addWidget(QLabel("Text Out"), 1, 0)
        self.textOutLine.setReadOnly(True)
        self.textResultsLayout.addWidget(self.textOutLine, 1, 1)
        self.textResultsLayout.addWidget(QLabel("Expected"), 2, 0)
        self.textOutExpected = QtFixes.QLineEdit()
        self.textOutExpected.setReadOnly(True)
        self.textResultsLayout.addWidget(self.textOutExpected, 2, 1)

        self.textResultsLayout.addWidget(QLabel("Enc. Key"), 3, 0)
        self.textEncKey = QtFixes.QLineEdit()
        self.textEncKey.setReadOnly(True)
        self.textResultsLayout.addWidget(self.textEncKey, 3, 1)
github newaetech / chipwhisperer / software / chipwhisperer / capture / utils / SerialTerminalDialog.py View on Github external
def __init__(self, parent, cwAPI):
        super(SerialTerminalDialog, self).__init__(parent)
        self.cwAPI = cwAPI
        self.mainLayout = QVBoxLayout()

        ### Layout for text boxes
        self.textLayouts = QGridLayout()

        self.textOut = QTextEdit()
        self.textIn = QtFixes.QLineEdit()
        self.textIn.returnPressed.connect(self.returnPressedIn)

        self.textInSend = QPushButton("Send")
        self.textInSend.clicked.connect(self.returnPressedIn)

        self.textClear = QPushButton("Clear")
        self.textClear.clicked.connect(self.textOut.clear)

        # 3 = rowSpan
        self.textLayouts.addWidget(self.textOut, 0, 0)
        self.textLayouts.addWidget(self.textIn, 1, 0)
        self.textLayouts.addWidget(self.textInSend, 1, 1)
        self.textLayouts.addWidget(self.textClear, 0, 1)

        self.textOut.setReadOnly(True)
github newaetech / chipwhisperer / software / chipwhisperer / capture / ui / programmers_dialog.py View on Github external
progFlashBut.clicked.connect(self.writeFlash)

        layoutBut = QHBoxLayout()
        layoutBut.addWidget(readSigBut)
        layoutBut.addWidget(verifyFlashBut)
        layoutBut.addWidget(progFlashBut)
        layout.addLayout(layoutBut)

        layoutFuse = QHBoxLayout()

        readFuseBut = QPushButton("Read Fuses")
        readFuseBut.clicked.connect(self.readFuses)
        writeFuseBut = QPushButton("Write Fuses")
        writeFuseBut.clicked.connect(self.writeFuses)

        self.lowfuseLine = QtFixes.QLineEdit("?")
        self.lowfuseLine.setMaxLength(2)
        self.lowfuseLine.setFixedWidth(25)
        self.highfuseLine = QtFixes.QLineEdit("?")
        self.highfuseLine.setMaxLength(2)
        self.highfuseLine.setFixedWidth(25)
        self.extfuseLine = QtFixes.QLineEdit("?")
        self.extfuseLine.setMaxLength(2)
        self.extfuseLine.setFixedWidth(25)

        # Don't allow use to change these fuses
        self.highfuseLine.setReadOnly(True)
        self.extfuseLine.setReadOnly(True)

        layoutFuse.addWidget(readFuseBut)
        layoutFuse.addWidget(QLabel("LOW:"))
        layoutFuse.addWidget(self.lowfuseLine)
github newaetech / chipwhisperer / software / chipwhisperer / common / traces / TraceContainerDPAv3.py View on Github external
fileL.addWidget(filePB)

        setupGB = QGroupBox("File Selection")
        setupGB.setLayout(fileL)
        layout.addWidget(setupGB)

        ### Settings found in info.xml, can be changed by user

        self.LETraces = QtFixes.QLineEdit()
        self.LETraces.setEnabled(False)

        self.LEPoints = QtFixes.QLineEdit()
        self.LEPoints.setEnabled(False)

        self.LEScope = QtFixes.QLineEdit()
        self.LETargetHW = QtFixes.QLineEdit()
        self.LETargetSW = QtFixes.QLineEdit()
        self.LEDate = QtFixes.QLineEdit()

        self.LENotes = QtFixes.QLineEdit()

        settingsL = QGridLayout()
        settingsL.addWidget(QLabel("Traces:"), 0, 0)
        settingsL.addWidget(self.LETraces, 0, 1)

        settingsL.addWidget(QLabel("Points:"), 0, 2)
        settingsL.addWidget(self.LEPoints, 0, 3)

        settingsL.addWidget(QLabel("Date:"), 1, 0)
        settingsL.addWidget(self.LEDate, 1, 1)

        settingsL.addWidget(QLabel("TargetHW:"), 2, 0)
github newaetech / chipwhisperer / software / chipwhisperer / capture / ui / programmers_dialog.py View on Github external
layoutBut.addWidget(readSigBut)
        layoutBut.addWidget(verifyFlashBut)
        layoutBut.addWidget(progFlashBut)
        layout.addLayout(layoutBut)

        layoutFuse = QHBoxLayout()

        readFuseBut = QPushButton("Read Fuses")
        readFuseBut.clicked.connect(self.readFuses)
        writeFuseBut = QPushButton("Write Fuses")
        writeFuseBut.clicked.connect(self.writeFuses)

        self.lowfuseLine = QtFixes.QLineEdit("?")
        self.lowfuseLine.setMaxLength(2)
        self.lowfuseLine.setFixedWidth(25)
        self.highfuseLine = QtFixes.QLineEdit("?")
        self.highfuseLine.setMaxLength(2)
        self.highfuseLine.setFixedWidth(25)
        self.extfuseLine = QtFixes.QLineEdit("?")
        self.extfuseLine.setMaxLength(2)
        self.extfuseLine.setFixedWidth(25)

        # Don't allow use to change these fuses
        self.highfuseLine.setReadOnly(True)
        self.extfuseLine.setReadOnly(True)

        layoutFuse.addWidget(readFuseBut)
        layoutFuse.addWidget(QLabel("LOW:"))
        layoutFuse.addWidget(self.lowfuseLine)
        layoutFuse.addWidget(QLabel("HIGH:"))
        layoutFuse.addWidget(self.highfuseLine)
        layoutFuse.addWidget(QLabel("EXT:"))