示例#1
0
    def __init__(self):
        self.maxSubKeys = 32
        AutoScript.__init__(self)
        self.useAbs = True

        #TODO: Where to get this from?
        self.numsubkeys = 16

        self.allPointsSame = True
        self.startPoint = [0]*self.numsubkeys
        self.endPoint = [0]*self.numsubkeys
        self.traceMax = 0

        self.traceLimitsChanged = util.Signal()

        self.setupTraceParam()
        self.setupPointsParam()
        self.getParams().addChildren([
            {'name':'Hardware Model', 'type':'group', 'children':[
                {'name':'Crypto Algorithm', 'key':'hw_algo', 'type':'list', 'values':{'AES-128 (8-bit)':models_AES128_8bit}, 'value':models_AES128_8bit, 'action':self.updateScript},
                {'name':'Leakage Model', 'key':'hw_leak', 'type':'list', 'values':models_AES128_8bit.leakagemodels, 'value':'LEAK_HW_SBOXOUT_FIRSTROUND', 'action':self.updateScript},
            ]},
            {'name':'Take Absolute', 'type':'bool', 'get':self.getAbsoluteMode, 'set':self.setAbsoluteMode},
           #TODO: Should be called from the AES module to figure out # of bytes
            {'name':'Attacked Bytes', 'type':'group', 'children': self.getByteList()},
        ])
        self.params.append(self.pointsParams)
        self.params.append(self.traceParams)

        self.updateBytesVisible()
    def __init__(self, targetModel, leakageFunction):
        AutoScript.__init__(self)
        self.config = {}

        self.getParams().addChildren([
            {'name': '', 'type': 'label', 'value':\
                                                  "Attacks encoder MSB individually in rounds 496..432.\n"\
                                                  "Demo: cipherSUM round528=301 width=3", 'readonly': True},
            {'name':'Utilize round timing', 'key':'roundtiming', 'type':'bool', 'value':False, 'action':self.updateScript,
                         'help': "Utilize round timing:\n"\
                                 "---------------------\n\n"\
                                 "Utilize round 528 position and width to predict where each round is.\n"\
                                 "\n"\
                                 "**Enabled:** The algorithm accepts correlation peaks only where they are expected, "\
                                 "according to the timing information that you have supplied.\n"\
                                 "\n"\
                                 "**Disabled:** The whole point-range (or trace) is examined for correlation peaks.\n"\
                                 "\n"\
                                 "This option should always be enabled, unless the timing is unknown. "\
                                 "The timing information can be extracted from traces using the Data Bits partition mode.\n"
                         },
        ])

        self.model = targetModel
        self.leakage = leakageFunction
        self.sr = None
        self.stats = DataTypeDiffs()
        self.updateScript()
示例#3
0
    def __init__(self, traceSource=None):
        self.enabled = False
        ActiveTraceObserver.__init__(self)
        TraceSource.__init__(self, self.getName())
        AutoScript.__init__(self)
        self.setTraceSource(traceSource, blockSignal=True)
        if traceSource:
            traceSource.sigTracesChanged.connect(
                self.sigTracesChanged.emit
            )  # Forwards the traceChanged signal to the next observer in the chain
        self.getParams().addChildren([{
            'name': 'Enabled',
            'key': 'enabled',
            'type': 'bool',
            'default': self.getEnabled(),
            'get': self.getEnabled,
            'set': self.setEnabled
        }])
        self.findParam('input').hide()

        self.register()
        if __debug__: logging.debug('Created: ' + str(self))

        #Old attribute dict
        self._attrdict = None
    def __init__(self):
        self.maxSubKeys = 32
        AutoScript.__init__(self)
        self.useAbs = True

        #TODO: Where to get this from?
        self.numsubkeys = 16

        self.allPointsSame = True
        self.startPoint = [0]*self.numsubkeys
        self.endPoint = [0]*self.numsubkeys
        self.traceMax = 0

        self.traceLimitsChanged = util.Signal()

        self.setupTraceParam()
        self.setupPointsParam()
        self.getParams().addChildren([
            {'name':'Hardware Model', 'type':'group', 'children':[
                {'name':'Crypto Algorithm', 'key':'hw_algo', 'type':'list', 'values':{'AES-128 (8-bit)':models_AES128_8bit}, 'value':models_AES128_8bit, 'action':lambda _:self.updateScript()},
                {'name':'Leakage Model', 'key':'hw_leak', 'type':'list', 'values':models_AES128_8bit.leakagemodels, 'value':'LEAK_HW_SBOXOUT_FIRSTROUND', 'action':lambda _:self.updateScript()},
            ]},
            {'name':'Take Absolute', 'type':'bool', 'get':self.getAbsoluteMode, 'set':self.setAbsoluteMode},
           #TODO: Should be called from the AES module to figure out # of bytes
            {'name':'Attacked Bytes', 'type':'group', 'children': self.getByteList()},
        ])
        self.params.append(self.pointsParams)
        self.params.append(self.traceParams)

        self.updateBytesVisible()
示例#5
0
    def __init__(self, targetModel, leakageFunction):
        AutoScript.__init__(self)

        self.getParams().addChildren([
            {
                'name': 'Iteration Mode',
                'key': 'itmode',
                'type': 'list',
                'values': {
                    'Depth-First': 'df',
                    'Breadth-First': 'bf'
                },
                'value': 'bf'
            },
            {
                'name': 'Skip when PGE=0',
                'key': 'checkpge',
                'type': 'bool',
                'value': False
            },
        ])

        self.model = targetModel
        self.leakage = leakageFunction
        self.sr = None
        self.stats = DataTypeDiffs()
        self.updateScript()
示例#6
0
    def __init__(self, traceSource=None):
        self.enabled = False
        ActiveTraceObserver.__init__(self)
        TraceSource.__init__(self, self.getName())
        AutoScript.__init__(self)
        self.setTraceSource(traceSource, blockSignal=True)
        if traceSource:
            traceSource.sigTracesChanged.connect(
                self.sigTracesChanged.emit
            )  # Forwards the traceChanged signal to the next observer in the chain
        self.getParams().addChildren(
            [
                {
                    "name": "Enabled",
                    "key": "enabled",
                    "type": "bool",
                    "default": self.getEnabled(),
                    "get": self.getEnabled,
                    "set": self.setEnabled,
                }
            ]
        )
        self.findParam("input").hide()

        self.register()
        if __debug__:
            logging.debug("Created: " + str(self))
    def __init__(self, parent):
        AutoScript.__init__(self)
        PassiveTraceObserver.__init__(self)
        self.getParams().getChild("Input").hide()
        self._project = None

        self.params.addChildren([
            {
                'name': 'Load Template',
                'type': 'group',
                'children': []
            },
            {
                'name':
                'Generate New Template',
                'type':
                'group',
                'children': [{
                    'name': 'Trace Start',
                    'key': 'tgenstart',
                    'value': 0,
                    'type': 'int',
                    'action': self.updateScript
                }, {
                    'name': 'Trace End',
                    'key': 'tgenstop',
                    'value': parent.traceMax,
                    'type': 'int',
                    'action': self.updateScript
                }, {
                    'name': 'POI Selection',
                    'key': 'poimode',
                    'type': 'list',
                    'values': {
                        'TraceExplorer Table': 0,
                        'Read from Project File': 1
                    },
                    'value': 0,
                    'action': self.updateScript
                }, {
                    'name': 'Read POI',
                    'type': 'action',
                    'action': self.updateScript
                }, {
                    'name':
                    'Generate Templates',
                    'type':
                    'action',
                    'action':
                    util.Command(self.runScriptFunction.emit,
                                 "generateTemplates")
                }]
            },
        ])

        self.addGroup("generateTemplates")

        self.sr = None
        self.stats = DataTypeDiffs()
        self.setProfileAlgorithm(TemplateBasic)
示例#8
0
    def __init__(self):
        self.enabled = False
        AutoScript.__init__(self)
        #        self.getParams().addChildren([
        #                 {'name':'Enabled', 'key':'enabled', 'type':'bool', 'default':self.getEnabled(), 'get':self.getEnabled, 'set':self.setEnabled}
        #        ])
        #        self.findParam('input').hide()

        if __debug__: logging.debug('Created: ' + str(self))
示例#9
0
 def __init__(self, parentParam=None, traceSource=None):
     self.enabled = False
     ActiveTraceObserver.__init__(self, parentParam=parentParam)
     TraceSource.__init__(self, self.getName())
     AutoScript.__init__(self)
     self.setTraceSource(traceSource, blockSignal=True)
     if traceSource:
         traceSource.sigTracesChanged.connect(self.sigTracesChanged.emit)  # Forwards the traceChanged signal to the next observer in the chain
     self.getParams().addChildren([
              {'name':'Enabled', 'key':'enabled', 'type':'bool', 'default':self.getEnabled(), 'get':self.getEnabled, 'set':self.setEnabled}
     ])
     self.findParam('input').hide()
    def __init__(self, parent):
        AutoScript.__init__(self)
        self.enabled = False
        self.autoScriptInit()

        # Add example scripts to this list
        self.exampleScripts = [PartitionDisplay(self), TextDisplay(self)]

        # Add Scripts
        self.setupCommonScripts()

        self.progressBar = ProgressBar(show=False)
    def __init__(self, parent):
        AutoScript.__init__(self)
        self.enabled = False
        self.autoScriptInit()

        # Add example scripts to this list
        self.exampleScripts = [PartitionDisplay(self), TextDisplay(self)]

        # Add Scripts
        self.setupCommonScripts()

        self.progressBar = ProgressBar(show=False)
    def __init__(self, parentParam, targetModel, leakageFunction):
        AutoScript.__init__(self)

        self.getParams().addChildren([
            {'name':'Iteration Mode', 'key':'itmode', 'type':'list', 'values':{'Depth-First':'df', 'Breadth-First':'bf'}, 'value':'bf'},
            {'name':'Skip when PGE=0', 'key':'checkpge', 'type':'bool', 'value':False},
        ])

        self.model = targetModel
        self.leakage = leakageFunction
        self.sr = None
        self.stats = DataTypeDiffs()
        self.updateScript()
示例#13
0
    def __init__(self, parent):
        AutoScript.__init__(self)
        self._autoscript_init = False
        self.parent = parent
        self.poi = POI(self)
        self.poiDock = CWMainGUI.getInstance().addDock(self.poi, "Partition Comparison POI Table", area=Qt.TopDockWidgetArea)
        self.poiDock.hide()
        self.defineName()
        self._traces = None

        self.api = CWCoreAPI.getInstance()
        self.graph = GraphWidget()
        self.bselection = QToolBar()
        self.graph.addWidget(self.bselection)
        self.graphDock = CWMainGUI.getInstance().addDock(self.graph, "Partition Comparison Graph", area=Qt.TopDockWidgetArea)
        self.graphDock.hide()
示例#14
0
    def __init__(self, parent):
        AutoScript.__init__(self)
        self.parent = parent
        self.getParams().addChildren([
             {'name':'Update/Display Table', 'type':'action', 'action':lambda _:self.updateTable()},
        ])


        self.tablewid = QTableWidget()
        self.tablewid.setRowCount(0)
        self.tablewid.setColumnCount(4)
        self.tablewid.setHorizontalHeaderLabels(["Text In", "Text Out", "Key", "Trace Data"])
        #self.tablewid.verticalHeader().hide()
        #self.tablewid.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)

        self.dock = CWMainGUI.getInstance().addDock(self.tablewid, "Text Display Table", area=Qt.TopDockWidgetArea)
        self.dock.hide()
    def __init__(self, parent):
        AutoScript.__init__(self)
        self._autoscript_init = False
        self.parent = parent
        self.poi = POI(self)
        self.poiDock = CWMainGUI.getInstance().addDock(
            self.poi,
            "Partition Comparison POI Table",
            area=Qt.TopDockWidgetArea)
        self.poiDock.hide()
        self.defineName()
        self._traces = None

        self.api = CWCoreAPI.getInstance()
        self.graph = GraphWidget()
        self.bselection = QToolBar()
        self.graph.addWidget(self.bselection)
        self.graphDock = CWMainGUI.getInstance().addDock(
            self.graph,
            "Partition Comparison Graph",
            area=Qt.TopDockWidgetArea)
        self.graphDock.hide()
示例#16
0
    def __init__(self, parent):
        AutoScript.__init__(self)
        PassiveTraceObserver.__init__(self)
        self.getParams().getChild("Input").hide()
        self._project = None

        self.params.addChildren([
            {'name':'Load Template', 'type':'group', 'children':[]},
            {'name':'Generate New Template', 'type':'group', 'children':[
                {'name':'Trace Start', 'key':'tgenstart', 'value':0, 'type':'int', 'action':self.updateScript},
                {'name':'Trace End', 'key':'tgenstop', 'value':parent.traceMax, 'type':'int', 'action':self.updateScript},
                {'name':'POI Selection', 'key':'poimode', 'type':'list', 'values':{'TraceExplorer Table':0, 'Read from Project File':1}, 'value':0, 'action':self.updateScript},
                {'name':'Read POI', 'type':'action', 'action':self.updateScript},
                {'name':'Generate Templates', 'type':'action', 'action':util.Command(self.runScriptFunction.emit, "generateTemplates")}
            ]},
        ])

        self.addGroup("generateTemplates")

        self.sr = None
        self.stats = DataTypeDiffs()
        self.setProfileAlgorithm(TemplateBasic)
示例#17
0
    def __init__(self):
        AutoScript.__init__(self)
        AnalysisSource.__init__(self)
        PassiveTraceObserver.__init__(self)
        self.getParams().getChild("Input").hide()
        self._traceStart = 0
        self._iterations = 1
        self._tracePerAttack = 1
        self._reportingInterval = 10
        self._pointRange = (0,0)
        self._targetSubkeys = []
        self._project = None
        self.useAbs = True
        self.attack = None

        self.getParams().addChildren([
            {'name':'Attack Algorithm', 'type':'list',  'values':self._algos, 'get':self.getAlgorithm, 'set':self.setAlgorithm, 'action':self.updateScript, 'childmode': 'parent'}
        ])
        models = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.analyzer.attacks.models", True, False)
        self.getParams().addChildren([
            {'name':'Crypto Algorithm', 'type':'list', 'values':models, 'value':models['AES 128'], 'action':self.refreshByteList, 'childmode':'child'},
            {'name':'Points Range', 'key':'prange', 'type':'range', 'get':self.getPointRange, 'set':self.setPointRange, 'action':self.updateScript},
        ])
        for m in models.itervalues():
            m.sigParametersChanged.connect(self.updateScript)

        self.getParams().addChildren([
            {'name':'Starting Trace', 'key':'strace', 'type':'int', 'get':self.getTraceStart, 'set':self.setTraceStart, 'action':self.updateScript},
            {'name':'Traces per Attack', 'key':'atraces', 'type':'int', 'limits':(1, 1E6), 'get':self.getTracesPerAttack, 'set':self.setTracesPerAttack, 'action':self.updateScript},
            {'name':'Iterations', 'key':'runs', 'type':'int', 'limits':(1, 1E6), 'get':self.getIterations, 'set':self.setIterations, 'action':self.updateScript},
            {'name':'Reporting Interval', 'key':'reportinterval', 'type':'int', 'get':self.getReportingInterval, 'set':self.setReportingInterval, 'action':self.updateScript},
        ])
        self.getParams().init()

        self.setAlgorithm(self._analysisAlgorithm)
        self.refreshByteList()
        self.updateScript()
        if __debug__: logging.debug('Created: ' + str(self))
示例#18
0
    def __init__(self):
        AutoScript.__init__(self)
        AnalysisSource.__init__(self)
        PassiveTraceObserver.__init__(self)
        self.getParams().getChild("Input").hide()
        self._traceStart = 0
        self._iterations = 1
        self._tracePerAttack = 1
        self._reportingInterval = 10
        self._pointRange = (0,0)
        self._targetSubkeys = []
        self._project = None
        self.useAbs = True
        self.attack = None

        self.getParams().addChildren([
            {'name':'Attack Algorithm', 'type':'list',  'values':self._algos, 'get':self.getAlgorithm, 'set':self.setAlgorithm, 'action':self.updateScript, 'childmode': 'parent'}
        ])
        models = pluginmanager.getPluginsInDictFromPackage("chipwhisperer.analyzer.attacks.models", True, False)
        self.getParams().addChildren([
            {'name':'Crypto Algorithm', 'type':'list', 'values':models, 'value':models['AES 128'], 'action':self.refreshByteList, 'childmode':'child'},
            {'name':'Points Range', 'key':'prange', 'type':'range', 'get':self.getPointRange, 'set':self.setPointRange, 'action':self.updateScript},
        ])
        for m in models.itervalues():
            m.sigParametersChanged.connect(self.updateScript)

        self.getParams().addChildren([
            {'name':'Starting Trace', 'key':'strace', 'type':'int', 'get':self.getTraceStart, 'set':self.setTraceStart, 'action':self.updateScript},
            {'name':'Traces per Attack', 'key':'atraces', 'type':'int', 'limits':(1, 1E6), 'get':self.getTracesPerAttack, 'set':self.setTracesPerAttack, 'action':self.updateScript},
            {'name':'Iterations', 'key':'runs', 'type':'int', 'limits':(1, 1E6), 'get':self.getIterations, 'set':self.setIterations, 'action':self.updateScript},
            {'name':'Reporting Interval', 'key':'reportinterval', 'type':'int', 'get':self.getReportingInterval, 'set':self.setReportingInterval, 'action':self.updateScript},
        ])
        self.getParams().init()

        self.setAlgorithm(self._analysisAlgorithm)
        self.refreshByteList()
        self.updateScript()
        if __debug__: logging.debug('Created: ' + str(self))
示例#19
0
    def __init__(self, hasHardwareModel=True, hasMultipleRuns=True):

        self.hasHardwareModel = hasHardwareModel
        self.hasMultipleRuns  = hasMultipleRuns

        self.maxSubKeys = 32
        AutoScript.__init__(self)
        self.useAbs = True

        #TODO: Where to get this from?
        self.numsubkeys = 16

        self.allPointsSame = True
        self.startPoint = [0]*self.numsubkeys
        self.endPoint = [0]*self.numsubkeys
        self.traceMax = 0

        self.traceLimitsChanged = util.Signal()

        self.setupTraceParam()
        self.setupPointsParam()

        if self.hasHardwareModel:
            self.getParams().addChildren([
                {'name':'Hardware Model', 'type':'group', 'children':[
                    {'name':'Crypto Algorithm', 'key':'hw_algo', 'type':'list', 'values':{'Keeloq':models_keeloq}, 'value':models_keeloq, 'action':self.updateScript},
                    {'name':'Leakage Model', 'key':'hw_leak', 'type':'list', 'values':models_keeloq.leakagemodels, 'value':"LEAK_HW_CIPHERTEXT_BIT", 'action':self.updateScript},
                ]},
                {'name':'Take Absolute', 'type':'bool', 'get':self.getAbsoluteMode, 'set':self.setAbsoluteMode},
#               #TODO: Should be called from the AES module to figure out # of bytes
#                {'name':'Attacked Bytes', 'type':'group', 'children': self.getByteList()},
            ])

        #self.params.append(self.pointsParams)
        #self.params.append(self.traceParams)

        self.updateBytesVisible()
示例#20
0
 def __init__(self):
     AutoScript.__init__(self)
     self.sr = None
     self.stats = None
     self._project = None
示例#21
0
 def __init__(self):
     AutoScript.__init__(self)
     PassiveTraceObserver.__init__(self)
     self.getParams().getChild("Input").hide()
示例#22
0
 def __init__(self):
     AutoScript.__init__(self)
     PassiveTraceObserver.__init__(self)
     self.getParams().getChild("Input").hide()