Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self):
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
CWCoreAPI.instance = self
self.sigNewProject = util.Signal()
self.sigConnectStatus = util.Signal()
self.sigAttackChanged = util.Signal()
self.sigNewInputData = util.Signal()
self.sigNewTextResponse = util.Signal()
self.sigTraceDone = util.Signal()
self.sigCampaignStart = util.Signal()
self.sigCampaignDone = util.Signal()
self.executingScripts = util.Observable(False)
self.valid_scopes = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.scopes", True, True)
self.valid_targets = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.targets", True, True)
self.valid_traces = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.common.traces", True, True)
self.valid_aux = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.auxiliary", True, True)
self.valid_acqPatterns = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.acq_patterns", True, False)
self.settings = Settings()
# Initialize default values
self._project = self._scope = self._target = self._traceFormat = self._acqPattern = self._attack = None
self._acqPattern = self.valid_acqPatterns["Basic"]
self._auxList = AuxList()
self._numTraces = 50
self._numTraceSets = 1
def __init__(self):
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
CWCoreAPI.instance = self
self.sigNewProject = util.Signal()
self.sigConnectStatus = util.Signal()
self.sigAttackChanged = util.Signal()
self.sigNewInputData = util.Signal()
self.sigNewTextResponse = util.Signal()
self.sigTraceDone = util.Signal()
self.sigCampaignStart = util.Signal()
self.sigCampaignDone = util.Signal()
self.executingScripts = util.Observable(False)
self.valid_scopes = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.scopes", True, True)
self.valid_targets = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.targets", True, True)
self.valid_traces = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.common.traces", True, True)
self.valid_aux = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.auxiliary", True, True)
self.valid_acqPatterns = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.acq_patterns", True, False)
self.settings = Settings()
def __init__(self):
super(CWCaptureAPI.Signals, self).__init__()
self.paramListUpdated = util.Signal()
self.scopeChanged = util.Signal()
self.targetChanged = util.Signal()
self.auxChanged = util.Signal()
self.acqPatternChanged = util.Signal()
self.connectStatus = util.Signal()
self.newInputData = util.Signal()
self.newTextResponse = util.Signal()
self.traceDone = util.Signal()
self.campaignStart = util.Signal()
self.campaignDone = util.Signal()
self.abortCapture = util.Signal()
def __init__(self, scope, target=None, writer=None, aux=None, keyTextPattern=None):
# TODO: use project objects instead of writers?
self.sigTraceDone = util.Signal()
self.sigNewTextResponse = util.Signal()
self.currentTrace = 0
self.maxtraces = 0
self.key = [0]
self.textin = [0]
self.textout = [0]
self._target = target
self._scope = scope
self._writer = writer
self._aux_dict = aux
self._pattern = keyTextPattern
self._pattern.setTarget(target)
self._pattern.initPair(self.maxtraces)
def __init__(self):
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
CWCoreAPI.instance = self
self.sigNewProject = util.Signal()
self.sigConnectStatus = util.Signal()
self.sigAttackChanged = util.Signal()
self.sigNewInputData = util.Signal()
self.sigNewTextResponse = util.Signal()
self.sigTraceDone = util.Signal()
self.sigCampaignStart = util.Signal()
self.sigCampaignDone = util.Signal()
self.executingScripts = util.Observable(False)
self.valid_scopes = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.scopes", True, True)
self.valid_targets = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.targets", True, True)
self.valid_traces = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.common.traces", True, True)
self.valid_aux = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.auxiliary", True, True)
self.valid_acqPatterns = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.capture.acq_patterns", True, False)
self.settings = Settings()
# Initialize default values
def __init__(self):
super(CWCaptureAPI.Signals, self).__init__()
self.paramListUpdated = util.Signal()
self.scopeChanged = util.Signal()
self.targetChanged = util.Signal()
self.auxChanged = util.Signal()
self.acqPatternChanged = util.Signal()
self.connectStatus = util.Signal()
self.newInputData = util.Signal()
self.newTextResponse = util.Signal()
self.traceDone = util.Signal()
self.campaignStart = util.Signal()
self.campaignDone = util.Signal()
self.abortCapture = util.Signal()
def __init__(self, prog_name="ChipWhisperer", prog_ver=""):
self.valid_traces = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.common.traces", True, True)
self._trace_format = None
self.params = Parameter(name="Project Settings", type="group")
self.params.addChildren([
{'name': 'Trace Format', 'type': 'list', 'values': self.valid_traces, 'get': self.get_trace_format, 'set': self.set_trace_format},
])
self.findParam("Trace Format").setValue(TraceContainerNative(project=self), addToList=True)
#self.traceParam = Parameter(name="Trace Settings", type='group', addLoadSave=True).register()
#self.params.getChild('Trace Format').stealDynamicParameters(self.traceParam)
self.sigFilenameChanged = util.Signal()
self.sigStatusChanged = util.Signal()
self.dirty = util.Observable(True)
self.settingsDict = {'Project Name':"Untitled", 'Project File Version':"1.00", 'Project Author':"Unknown"}
self.datadirectory = ""
self.config = ConfigObjProj(callback=self.configObjChanged)
self._traceManager = TraceManager().register()
self._traceManager.dirty.connect(self.__dirtyCallback)
self.setFilename(Project.untitledFileName)
self.setProgramName(prog_name)
self.setProgramVersion(prog_ver)
self._segments = Segments(self)
self._traces = Traces(self)
self._keys = IndividualIterable(self._traceManager.get_known_key, self._traceManager.num_traces)
self._textins = IndividualIterable(self._traceManager.get_textin, self._traceManager.num_traces)
def __init__(self):
super(CWAnalizerAPI.Signals, self).__init__()
self.reloadAttackParamList = util.Signal()
self.attackChanged = util.Signal()
import numpy as np
from chipwhisperer.common.api.autoscript import AutoScript
from chipwhisperer.common.utils import util
from chipwhisperer.common.utils.tracesource import PassiveTraceObserver
try:
from scipy.stats import multivariate_normal
except ImportError:
multivariate_normal = None
class TemplateBasic(AutoScript, PassiveTraceObserver):
"""
Template using Multivariate Stats (mean + covariance matrix)
"""
scriptsUpdated = util.Signal()
def __init__(self):
AutoScript.__init__(self)
PassiveTraceObserver.__init__(self)
self.getParams().getChild("Input").hide()
def setProject(self, proj):
self._project = proj
def project(self):
return self._project
def generate(self, trange, poiList, partMethod, progressBar=None):
"""Generate templates for all partitions over entire trace range"""
# Number of subkeys