def TraceExplorerDialog_PartitionDisplay_displayPartitionStats(self): self.cwagui = CWAnalyzerGUI.getInstance() ted = self.cwagui.attackScriptGen.utilList[0].exampleScripts[0] ted.setTraceSource(self.traces) progressBar = ted.parent.getProgressIndicator() ted.partObject.setPartMethod(PartitionHWIntermediate) partData = ted.partObject.generatePartitions(saveFile=True, loadFile=False) partStats = ted.generatePartitionStats(partitionData={ "partclass": PartitionHWIntermediate, "partdata": partData }, saveFile=True, progressBar=progressBar) partDiffs = ted.generatePartitionDiffs(DifferenceModeSAD, statsInfo={ "partclass": PartitionHWIntermediate, "stats": partStats }, saveFile=True, loadFile=False, progressBar=progressBar) ted.displayPartitions(differences={ "partclass": PartitionHWIntermediate, "diffs": partDiffs }) ted.poi.setDifferences(partDiffs)
def updateScript(self, _=None): #self.addFunction('init', 'setReportingInterval', '%d' % self.findParam('reportinterval').getValue()) try: ted = CWAnalyzerGUI.getInstance().traceExplorerDialog.exampleScripts[0] except AttributeError: print("INFO: Delaying script for template attack until TraceExplorer exists...") return self.addFunction('generateTemplates', 'initPreprocessing', '', obj='UserScript') self.addFunction('generateTemplates', 'initAnalysis', '', obj='UserScript') self.addVariable('generateTemplates', 'tRange', '(%d, %d)' % (self.findParam(["Generate New Template",'tgenstart']).getValue(), self.findParam(["Generate New Template",'tgenstop']).getValue())) if self.findParam(["Generate New Template",'poimode']).getValue() == 0: self.addVariable('generateTemplates', 'poiList', '%s' % ted.poi.poiArray) self.addVariable('generateTemplates', 'partMethod', '%s()' % ted.partObject.partMethod.__class__.__name__) self.importsAppend("from chipwhisperer.analyzer.utils.Partition import %s" % ted.partObject.partMethod.__class__.__name__) else: poidata = self.loadPOIs()[-1] self.addVariable('generateTemplates', 'poiList', '%s' % poidata["poi"]) self.addVariable('generateTemplates', 'partMethod', '%s()' % poidata["partitiontype"]) self.importsAppend("from chipwhisperer.analyzer.utils.Partition import %s" % poidata["partitiontype"]) self.addFunction('generateTemplates', 'profiling.generate', 'tRange, poiList, partMethod', 'templatedata') #Save template data to project self.addFunction('generateTemplates', 'saveTemplatesToProject', 'tRange, templatedata', 'tfname') self.scriptsUpdated.emit()
def updateScript(self, _=None): try: ted = CWAnalyzerGUI.getInstance( ).traceExplorerDialog.exampleScripts[0] except AttributeError: logging.debug( 'Delaying script for template attack until TraceExplorer exists...' ) return self.addFunction('generateTemplates', 'initPreprocessing', '', obj='UserScript') self.addFunction('generateTemplates', 'initAnalysis', '', obj='UserScript') self.addVariable( 'generateTemplates', 'tRange', '(%d, %d)' % (self.findParam(["Generate New Template", 'tgenstart']).getValue(), self.findParam(["Generate New Template", 'tgenstop']).getValue())) if self.findParam(["Generate New Template", 'poimode']).getValue() == 0: self.addVariable('generateTemplates', 'poiList', '%s' % ted.poi.poiArray) self.addVariable( 'generateTemplates', 'partMethod', '%s()' % ted.partObject.partMethod.__class__.__name__) self.importsAppend( "from chipwhisperer.analyzer.utils.Partition import %s" % ted.partObject.partMethod.__class__.__name__) else: poidata = self.loadPOIs()[-1] self.addVariable('generateTemplates', 'poiList', '%s' % poidata["poi"]) self.addVariable('generateTemplates', 'partMethod', '%s()' % poidata["partitiontype"]) self.importsAppend( "from chipwhisperer.analyzer.utils.Partition import %s" % poidata["partitiontype"]) profilingPath = sys.modules[ self.profiling.__module__].__name__ + '.' + self.profiling.__name__ self.addFunction('generateTemplates', profilingPath + '.generate', 'self.getTraceSource(), tRange, poiList, partMethod', 'templatedata', "") #Save template data to project self.addFunction('generateTemplates', 'saveTemplatesToProject', 'tRange, templatedata', 'tfname') self.scriptsUpdated.emit()
def TraceExplorerDialog_PartitionDisplay_displayPartitionStats(self): self.cwagui = CWAnalyzerGUI.getInstance() ted = self.cwagui.attackScriptGen.utilList[0].exampleScripts[0] ted.setTraceSource(self.traces) progressBar = ted.parent.getProgressIndicator() ted.partObject.setPartMethod(PartitionHWIntermediate) partData = ted.partObject.generatePartitions(saveFile=True, loadFile=False) partStats = ted.generatePartitionStats(partitionData={"partclass":PartitionHWIntermediate, "partdata":partData}, saveFile=True, progressBar=progressBar) partDiffs = ted.generatePartitionDiffs(DifferenceModeSAD, statsInfo={"partclass":PartitionHWIntermediate, "stats":partStats}, saveFile=True, loadFile=False, progressBar=progressBar) ted.displayPartitions(differences={"partclass":PartitionHWIntermediate, "diffs":partDiffs}) ted.poi.setDifferences(partDiffs)
def updateScript(self, _=None): try: ted = CWAnalyzerGUI.getInstance( ).traceExplorerDialog.exampleScripts[0] except AttributeError: logging.debug( 'Delaying script for template attack until TraceExplorer exists...' ) return if self.findParam(["Generate New Template", 'poimode']).getValue() == 0: pass else: poidata = self.loadPOIs()[-1] profilingPath = sys.modules[ self.profiling.__module__].__name__ + '.' + self.profiling.__name__ #Save template data to project self.scriptsUpdated.emit()
def TraceExplorerDialog_PartitionDisplay_findPOI(self): # Calculate the POIs self.cwagui = CWAnalyzerGUI.getInstance() ted = self.cwagui.attackScriptGen.utilList[0].exampleScripts[0] return ted.poi.calcPOI(numMax=3, pointRange=(0, 3000), minSpace=5)['poi']