How to use the chipwhisperer.common.results.base.ResultsBase function in chipwhisperer

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 / analyzer / utils / attackscriptgen.py View on Github external
lastOutput = instname
        mse.append("self.traces = %s" % lastOutput)

        # Get init from analysis
        mse.append("def initAnalysis(self):", 1)
        if self.attack:
            mse.append('self.attack = %s()' % type(self.attack).__name__)
            for s in self.attack.getStatements('init'):
                mse.append(s.replace("self.", "self.attack.").replace("UserScript.", "self."))
        else:
            mse.append('pass')

        # Get init from reporting
        mse.append("def initReporting(self):", 1)
        mse.append("# Configures the attack observers (usually a set of GUI widgets)")
        if len(ResultsBase.registeredObjects)>0:
            for k, v in ResultsBase.registeredObjects.iteritems():
                if hasattr(v,"setTraceSource"):
                    mse.append("self.api.getResults(\"%s\").setTraceSource(self.traces)" % k)
                if hasattr(v,"setAnalysisSource"):
                    mse.append("self.api.getResults(\"%s\").setAnalysisSource(self.attack)" % k)
        else:
            mse.append("pass")

        # Do the attack
        mse.append("def run(self):", 1)
        mse.append("self.attack.processTraces()")

        # Get other commands from attack module
        if self.attack:
            for k in self.attack._smartstatements:
                if k == 'init' or k == 'go' or k == 'done':
github newaetech / chipwhisperer / software / chipwhisperer / capture / ui / CWCaptureGUI.py View on Github external
def addSettingsDocks(self):
        self.settingsGeneralDock = self.addSettings(self.api.params)
        self.settingsResultsDock = self.addSettings(ResultsBase.getClassParameter())
        self.settingsScopeDock = self.addSettings(self.api.scopeParam)
        self.settingsTargetDock = self.addSettings(self.api.targetParam)
        # self.settingsTraceDock = self.addSettings(self.api.traceParam)
        self.settingsAuxDock = self.addSettings(self.api.auxParam)

        # Load all ActiveTraceObservers
        self.windowMenu.addSeparator()
        for k, v in ResultsBase.getClasses().items():
            if issubclass(v, ActiveTraceObserver):
                ResultsBase.createNew(k)

        self.tabifyDocks([self.settingsGeneralDock, self.settingsResultsDock, self.settingsScopeDock, self.settingsTargetDock,
                          # self.settingsTraceDock,
                          self.settingsAuxDock])
github newaetech / chipwhisperer / software / chipwhisperer / analyzer / preprocessing / resync_sad.py View on Github external
def __init__(self, traceSource=None, connectTracePlot=True, name=None):
        PreprocessingBase.__init__(self, traceSource, name=name)
        self._rtrace = None
        self._debugReturnSad = False
        self._wdStart = 0
        self._wdEnd = 1
        self._maxshift = 1

        if connectTracePlot:
            traceplot = ResultsBase.registeredObjects["Trace Output Plot"]
        else:
            traceplot = None

        self.params.addChildren([
            {'name':'Ref Trace', 'key':'reftrace', 'type':'int', 'get':self._getRefTrace, 'set':self._setRefTrace},
            {'name':'Max Shift +/-', 'key':'maxshift', 'type':'int', 'get':self._getMaxShift, 'set':self._setMaxShift},
            {'name':'Target Window', 'key':'windowpt', 'type':'rangegraph', 'graphwidget':traceplot, 'get':self._getWindow, 'set':self._setWindow},
        ])
        self.updateLimits()
        self.sigTracesChanged.connect(self.updateLimits)
        self._init_not_done = True
github newaetech / chipwhisperer / software / chipwhisperer / capture / ui / CWCaptureGUI.py View on Github external
def addSettingsDocks(self):
        self.settingsGeneralDock = self.addSettings(self.api.params)
        self.settingsResultsDock = self.addSettings(ResultsBase.getClassParameter())
        self.settingsScopeDock = self.addSettings(self.api.scopeParam)
        self.settingsTargetDock = self.addSettings(self.api.targetParam)
        # self.settingsTraceDock = self.addSettings(self.api.traceParam)
        self.settingsAuxDock = self.addSettings(self.api.auxParam)

        # Load all ActiveTraceObservers
        self.windowMenu.addSeparator()
        for k, v in ResultsBase.getClasses().items():
            if issubclass(v, ActiveTraceObserver):
                ResultsBase.createNew(k)

        self.tabifyDocks([self.settingsGeneralDock, self.settingsResultsDock, self.settingsScopeDock, self.settingsTargetDock,
                          # self.settingsTraceDock,
                          self.settingsAuxDock])
github newaetech / chipwhisperer / software / chipwhisperer / analyzer / preprocessing / resync_cross_correlation.py View on Github external
def __init__(self, traceSource=None, name=None):
        PreprocessingBase.__init__(self, traceSource, name=name)
        self._rtrace = 0
        self._debugReturnCorr = False
        self._ccStart = 0
        self._ccEnd = 0

        self.params.addChildren([
            {'name':'Ref Trace', 'key':'reftrace', 'type':'int', 'get':self._getRefTrace, 'set':self._setRefTrace},
            {'name':'Window', 'key':'rwindow', 'type':'rangegraph', 'graphwidget':ResultsBase.registeredObjects["Trace Output Plot"], 'get':self._getWindow, 'set':self._setWindow},
            # {'name':'Output Correlation (DEBUG)', 'type':'bool', 'value':False, 'set':self.setOutputCorr}
        ])
        self._calculateRef()
github newaetech / chipwhisperer / software / chipwhisperer / capture / ui / CWCaptureGUI.py View on Github external
def addSettingsDocks(self):
        self.settingsGeneralDock = self.addSettings(self.api.params)
        self.settingsResultsDock = self.addSettings(ResultsBase.getClassParameter())
        self.settingsScopeDock = self.addSettings(self.api.scopeParam)
        self.settingsTargetDock = self.addSettings(self.api.targetParam)
        # self.settingsTraceDock = self.addSettings(self.api.traceParam)
        self.settingsAuxDock = self.addSettings(self.api.auxParam)

        # Load all ActiveTraceObservers
        self.windowMenu.addSeparator()
        for k, v in ResultsBase.getClasses().iteritems():
            if issubclass(v, ActiveTraceObserver):
                ResultsBase.createNew(k)

        self.tabifyDocks([self.settingsGeneralDock, self.settingsResultsDock, self.settingsScopeDock, self.settingsTargetDock,
                          # self.settingsTraceDock,
                          self.settingsAuxDock])
github newaetech / chipwhisperer / software / chipwhisperer / capture / ui / GlitchExplorerDialog.py View on Github external
def openPlotWidget(self, _):
        if "Glitch Explorer" not in ResultsBase.registeredObjects:
            ResultsBase.createNew("Scatter Plot", "Glitch Explorer")
        widget = ResultsBase.registeredObjects["Glitch Explorer"]
        widget.raise_()
        widget.yLocked(False)
        self.clearPlotWidget()
github newaetech / chipwhisperer / software / chipwhisperer / common / api / CWCoreAPI.py View on Github external
def connectScope(self):
        """Connect to the selected scope"""
        try:
            if self.getScope():
                self.getScope().con()
                try:
                    # Sets the Plot Widget input (if it exists) to the last added TraceSource
                    ResultsBase.registeredObjects["Trace Output Plot"].setTraceSource(
                        TraceSource.registeredObjects[next(reversed(TraceSource.registeredObjects))])
                except KeyError:
                    pass

        except Warning:
            sys.excepthook(*sys.exc_info())
            return False
        return True
github newaetech / chipwhisperer / software / chipwhisperer / analyzer / preprocessing / resync_peak_detect.py View on Github external
def __init__(self, traceSource=None, name=None):
        PreprocessingBase.__init__(self, traceSource, name=name)
        self._rtrace = 0
        self._ccStart = 0
        self._ccEnd = 0
        self._limit = 0
        self._type = "max"

        self.params.addChildren([
            {'name':'Ref Trace', 'key':'reftrace', 'type':'int', 'get':self._getRefTrace, 'set':self._setRefTrace},
            {'name':'Peak Type', 'key':'peaktype', 'type':'list', 'values':['max', 'min'], 'get':self._getType, 'set':self._setType},
            {'name':'Point Range', 'key':'ptrange', 'type':'rangegraph', 'graphwidget':ResultsBase.registeredObjects["Trace Output Plot"], 'get':self._getWindow, 'set':self._setWindow},
            {'name':'Valid Limit', 'key':'vlimit', 'type':'float', 'step':0.1, 'limits':(0, 10), 'set':self._setLimit, 'get':self._getLimit},
        ])
        self._calculateRef()
github newaetech / chipwhisperer / software / chipwhisperer / capture / ui / GlitchExplorerDialog.py View on Github external
def clearPlotWidget(self):
        widget = ResultsBase.registeredObjects.get("Glitch Explorer", None)
        if widget is not None:
            widget.clearPushed()
            widget.setLabels(top="Glitch Map", xaxis=list(self.tune_parameter_list.keys())[0] if len(self.tune_parameter_list)>0 else "",
                             yaxis=list(self.tune_parameter_list.keys())[1] if len(self.tune_parameter_list)>1 else "")