def setupParameters(self):
     self.hdev = HIDSPI()
     ssParams = [{'name':'Jump to Bootloader', 'type':'action', 'action':self.hdev.jumpBootloader}
                 ]
     self.params = Parameter.create(name='Target Connection', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
     self.keylength = 16
Example #2
0
    def __init__(self,console=None,showScriptParameter=None):
        super(VisaScope, self).__init__()
        self.showScriptParameter = showScriptParameter
        self.console = console
        self.visaInst = None

        scopeParams = [
                      {'name':'X-Scale', 'key':'xscale', 'type':'list', 'values':self.xScales},
                      {'name':'Y-Scale', 'key':'yscale', 'type':'list', 'values':self.yScales},
                      {'name':'Y-Offset', 'key':'yoffset', 'type':'float', 'step':1E-3, 'siPrefix': True, 'suffix': 'V'},
                      {'name':'X-Offset', 'key':'xoffset', 'type':'float', 'step':1E-6, 'siPrefix': True, 'suffix': 'S'},
                      {'name':'Download Offset', 'key':'xdisporigin', 'type':'int',  'limits':(0,1E9)},
                      {'name':'Download Size', 'key':'xdisprange', 'type':'int', 'limits':(0,1E9)},
                  ]




        for t in self.getAdditionalParams():
            scopeParams.append(t)



        self.params = Parameter.create(name='Scope Settings', type='group', children=scopeParams)
        ExtendedParameter.setupExtended(self.params, self)
 def setupParameters(self):
     """Setup parameters specific to preprocessing module"""
     ssParams = [{'name':'Enabled', 'type':'bool', 'value':True, 'set':self.setEnabled},
                 # PUT YOUR PARAMETERS HERE
                 {'name':'Desc', 'type':'text', 'value':self.descrString}]
     self.params = Parameter.create(name='Name of Module', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
Example #4
0
    def setupParameters(self):
        profalgos = {'Basic': ProfilingTemplate}

        attackParams = [
            {
                'name': 'Algorithm',
                'key': 'Prof_algo',
                'type': 'list',
                'values': profalgos,
                'value': ProfilingTemplate,
                'set': self.updateAlgorithm
            },

            #TODO: Should be called from the AES module to figure out # of bytes
            {
                'name': 'Attacked Bytes',
                'type': 'group',
                'children': self.getByteList()
            },
        ]
        self.params = Parameter.create(name='Attack',
                                       type='group',
                                       children=attackParams)
        ExtendedParameter.setupExtended(self.params, self)

        self.updateAlgorithm(self.findParam('Prof_algo').value())
        self.updateBytesVisible()

        self.traceManagerChanged.connect(self.attack.setTraceManager)
        self.projectChanged.connect(self.attack.setProject)

        self.setAbsoluteMode(False)
Example #5
0
    def setupParameters(self):
        cpaalgos = {'Progressive':CPAProgressive,
                    'Simple':CPASimpleLoop}

        #if CPACython is not None:
        #    cpaalgos['Progressive-Cython'] = CPACython.AttackCPA_Progressive

        if CPAProgressive_CAccel is not None:
            cpaalgos['Progressive-C Accel'] = CPAProgressive_CAccel

        attackParams = [{'name':'CPA Algorithm', 'key':'CPA_algo', 'type':'list', 'values':cpaalgos, 'value':CPAProgressive, 'set':self.updateAlgorithm},
                        {'name':'Hardware Model', 'type':'group', 'children':[
                        {'name':'Crypto Algorithm', 'key':'hw_algo', 'type':'list', 'values':{'AES-128 (8-bit)':models_AES128_8bit}, 'value':'AES-128', 'set':self.updateScript},
                        {'name':'Leakage Model', 'key':'hw_leak', 'type':'list', 'values':models_AES128_8bit.leakagemodels, 'value':1, 'set':self.updateScript},
                        ]},

                       #TODO: Should be called from the AES module to figure out # of bytes
                       {'name':'Attacked Bytes', 'type':'group', 'children':
                         self.getByteList()
                        },
                      ]

        self.params = Parameter.create(name='Attack', type='group', children=attackParams)
        ExtendedParameter.setupExtended(self.params, self)

        self.setAnalysisAlgorithm(CPAProgressive, None, None)
        self.updateBytesVisible()
        self.updateScript()
    def __init__(self, subkeys=16, permPerSubkey=256):
        super(ResultsPlotData, self).__init__()

        self.numKeys = subkeys
        self.numPerms = permPerSubkey
        self._knownkey = None
        self.enabledbytes = [False]*subkeys
        self.doRedraw = True
        self.orfunction = None

        self.byteNumAct = []
        for i in range(0,self.numKeys):
            self.byteNumAct.append(QAction('%d'%i, self))
            self.byteNumAct[i].triggered[bool].connect(partial(self.setBytePlot, i))
            self.byteNumAct[i].setCheckable(True)

        byteNumAllOn = QAction('All On', self)
        byteNumAllOff = QAction('All Off', self)
        byteNumAllOn.triggered.connect(partial(self.setByteAll, False))
        byteNumAllOff.triggered.connect(partial(self.setByteAll, True))

        self.bselection = QToolBar()

        for i in range(0, self.numKeys):
            self.bselection.addAction(self.byteNumAct[i])
        self.bselection.addAction(byteNumAllOn)
        self.bselection.addAction(byteNumAllOff)
        self.layout().addWidget(self.bselection)

        self.highlightTop = True

        resultsParams = [{'name':'Show', 'type':'bool', 'key':'show', 'value':False, 'set':self.showDockSignal.emit},
                      ]
        self.params = Parameter.create(name=self.name, type='group', children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
Example #7
0
    def __init__(self, subkeys=16, permPerSubkey=256):
        super(ResultsPlotData, self).__init__()

        self.numKeys = subkeys
        self.numPerms = permPerSubkey
        self._knownkey = None
        self.enabledbytes = [False]*subkeys
        self.doRedraw = True
        self.orfunction = None

        self.byteNumAct = []
        for i in range(0,self.numKeys):
            self.byteNumAct.append(QAction('%d'%i, self))
            self.byteNumAct[i].triggered[bool].connect(partial(self.setBytePlot, i))
            self.byteNumAct[i].setCheckable(True)

        byteNumAllOn = QAction('All On', self)
        byteNumAllOff = QAction('All Off', self)
        byteNumAllOn.triggered.connect(partial(self.setByteAll, False))
        byteNumAllOff.triggered.connect(partial(self.setByteAll, True))

        self.bselection = QToolBar()

        for i in range(0, self.numKeys):
            self.bselection.addAction(self.byteNumAct[i])
        self.bselection.addAction(byteNumAllOn)
        self.bselection.addAction(byteNumAllOff)
        self.layout().addWidget(self.bselection)

        self.highlightTop = True

        resultsParams = self.genericParameters()
        self.params = Parameter.create(name=self.name, type='group', children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
Example #8
0
 def setupParameters(self):
     ssParams = [{'name':'STK500.exe Path', 'type':'str', 'key':'stk500path', 'value':r'C:\Program Files (x86)\Atmel\AVR Tools\STK500\Stk500.exe'},
                 {'name':'AVR Part', 'type':'list', 'key':'part', 'values':['atmega328p'], 'value':'atmega328p'},
                 {'name':'Test Reset', 'type':'action', 'action':self.testReset}
                 ]
     self.params = Parameter.create(name='Reset AVR via STK500', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
Example #9
0
 def setupParameters(self):
     ssParams = [{'name':'Interface', 'type':'list', 'key':'target', 'values':['xmega (PDI)', 'avr (ISP)'], 'value':'xmega (PDI)'},
                 {'name':'Post-Reset Delay', 'type':'int', 'key':'toggledelay', 'limits':(0, 10E3), 'value':0, 'suffix':'mS'},
                 {'name':'Test Reset', 'type':'action', 'action':self.testReset}
                 ]
     self.params = Parameter.create(name='Reset AVR/XMEGA via CW-Lite', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
Example #10
0
 def setupParameters(self):
     self.oa=None
     self.driver = None
     
     supported_readers = dicttype()
     supported_readers["Select Reader"] = None
     supported_readers["ChipWhisperer-SER"] = ReaderChipWhispererSER()
     supported_readers["ChipWhisperer-USI"] = ReaderChipWhispererUSI()
     supported_readers["ChipWhisperer-SCARD"] = ReaderChipWhispererSCard()
     supported_readers["System Serial (SASEBO-W)"] = ReaderSystemSER()
     try:
         supported_readers["PC/SC Reader"] = ReaderPCSC()
     except ImportError:
         pass
     
     ssParams = [{'name':'Reader Hardware', 'type':'list', 'values':supported_readers, 'value':None, 'set':self.setConnection},
                 #"BasicCard v7.5 (INCOMPLETE"):None, 
                 #"Custom (INCOMPLETE)":None, "DPAContestv4 (INCOMPLETE)":None
                 {'name':'SmartCard Protocol', 'type':'list', 'values':{"SASEBO-W SmartCard OS":ProtocolSASEBOWCardOS(),
                                                                        "ChipWhisperer-Dumb":None,
                                                                        "JCard Test":ProtocolJCardTest(),
                                                                        "DPA Contest 4.2":ProtocolDPAv42(),
                                                                        }, 'value':None, 'set':self.setProtocol}
                 ]        
     self.params = Parameter.create(name='Target Connection', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
Example #11
0
    def __init__(self, parent=None, console=None, showScriptParameter=None):
        super(PicoScopeInterface, self).__init__(parent)
        self.parent = parent
        self.scopetype = None
        self.datapoints = []

        scope_cons = {}

        scope_cons["PS6000"] = ps6000.PS6000(connect=False)
        scope_cons["PS5000a"] = ps5000a.PS5000a(connect=False)
        scope_cons["PS2000"] = ps2000.PS2000(connect=False)
        defscope = scope_cons["PS5000a"]

        self.advancedSettings = None

        scopeParams = [
            {
                'name': 'Scope Type',
                'type': 'list',
                'values': scope_cons,
                'value': defscope,
                'set': self.setCurrentScope
            },
        ]

        self.params = Parameter.create(name='PicoScope Interface',
                                       type='group',
                                       children=scopeParams)
        ExtendedParameter.setupExtended(self.params, self)
        self.showScriptParameter = showScriptParameter
        self.setCurrentScope(defscope)
Example #12
0
 def setupParameters(self):
     ssParams = [{
         'name': 'Enabled',
         'type': 'bool',
         'key': 'enabled',
         'value': True,
         'set': self.updateScript
     }, {
         'name': 'Max Jitter (+/- cycles)',
         'key': 'jitter',
         'type': 'int',
         'value': 0,
         'limits': (0, 1000),
         'set': self.updateScript
     }, {
         'name': 'Desc',
         'type': 'text',
         'value': self.descrString
     }]
     self.params = Parameter.create(name='Add Random Jitter',
                                    type='group',
                                    children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
     self.maxJitter = 0
     self.updateScript()
    def __init__(self, parent, showScriptParameter=None, tmanager=None, console=None):
        super(ProfilingTemplate, self).__init__()
        if console:
            self.console = console
        self.setParent(parent)
        self._tmanager = None
        self._project = None

        resultsParams = [{'name':'Load Template', 'type':'group', 'children':[
                            ]},
                         {'name':'Generate New Template', 'type':'group', 'children':[
                            {'name':'Trace Start', 'key':'tgenstart', 'value':0, 'type':'int', 'set':self.updateScript},
                            {'name':'Trace End', 'key':'tgenstop', 'value':self.parent().traceMax, 'type':'int', 'set':self.updateScript},
                            {'name':'POI Selection', 'key':'poimode', 'type':'list', 'values':{'TraceExplorer Table':0, 'Read from Project File':1}, 'value':0, 'set':self.updateScript},
                            {'name':'Read POI', 'type':'action', 'action':self.updateScript},
                            {'name':'Generate Templates', 'type':'action', 'action': lambda:self.runScriptFunction.emit("generateTemplates")}
                            ]},
                         ]
        self.params = Parameter.create(name='Template Attack', type='group', children=resultsParams)
        if showScriptParameter is not None:
            self.showScriptParameter = showScriptParameter
            # print self.showScriptParameter
        ExtendedParameter.setupExtended(self.params, self)

        self.addGroup("generateTemplates")

        self.sr = None

        self.stats = DataTypeDiffs()
        self.setProfileAlgorithm(TemplateBasic)
Example #14
0
    def setupParameters(self):
        cpaalgos = {'Progressive':CPAProgressive,
                    'Simple':CPASimpleLoop}

        #if CPACython is not None:
        #    cpaalgos['Progressive-Cython'] = CPACython.AttackCPA_Progressive

        attackParams = [{'name':'CPA Algorithm', 'key':'CPA_algo', 'type':'list', 'values':cpaalgos, 'value':CPAProgressive, 'set':self.updateAlgorithm},
                        {'name':'Hardware Model', 'type':'group', 'children':[
                        {'name':'Crypto Algorithm', 'key':'hw_algo', 'type':'list', 'values':{'AES-128 (8-bit)':models_AES128_8bit, 'AES-256 (8-bit)':models_AES256_8bit}, 'value':'AES-128', 'set':self.updateScript},
                        {'name':'Key Round', 'key':'hw_round', 'type':'list', 'values':{'first':0, 'last':-1}, 'value':0, 'set':self.updateScript},
                        {'name':'Power Model', 'key':'hw_pwrmodel', 'type':'list', 'values':{'Hamming Weight':'HypHW', 'Hamming Distance':'HypHD'}, 'value':'Hamming Weight', 'set':self.updateScript},
                        {'name':'Direction', 'key':'aes_dir', 'type':'list', 'values':{'Encryption (PT=Input)':'enc', 'Decryption (PT=Input)':'dec'}, 'value':'enc', 'set':self.updateScript},
                        ]},

                       #TODO: Should be called from the AES module to figure out # of bytes
                       {'name':'Attacked Bytes', 'type':'group', 'children':
                         self.getByteList()
                        },
                      ]

        self.params = Parameter.create(name='Attack', type='group', children=attackParams)
        ExtendedParameter.setupExtended(self.params, self)

        self.setAnalysisAlgorithm(CPAProgressive, None, None)
        self.updateBytesVisible()
        self.updateScript()
Example #15
0
 def setupParameters(self):
     ssParams = [{
         'name': 'Enabled',
         'key': 'enabled',
         'type': 'bool',
         'value': True,
         'set': self.updateScript
     }, {
         'name': 'Noise Std-Dev',
         'key': 'noisestddev',
         'type': 'float',
         'value': 0.000001,
         'limits': (0, 1.0),
         'set': self.updateScript
     }, {
         'name': 'Desc',
         'type': 'text',
         'value': self.descrString
     }]
     self.params = Parameter.create(name='Add Random Noise',
                                    type='group',
                                    children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
     self._maxNoise = 0
     self.updateScript()
Example #16
0
    def setupParameters(self):
        ssParams = [{'name':'connection', 'type':'list', 'key':'con', 'values':{"System Serial Port":SimpleSerial_serial(showScriptParameter=self.showScriptParameter),
                                                                                "ChipWhisperer":SimpleSerial_ChipWhisperer(showScriptParameter=self.showScriptParameter),
                                                                                "ChipWhisperer-Lite":SimpleSerial_ChipWhispererLite(showScriptParameter=self.showScriptParameter)},
                                                                                'value':"System Serial Port", 'set':self.setConnection},
                    {'name':'Key Length', 'type':'list', 'values':[128, 256], 'value':128, 'set':self.setKeyLen},
                 #   {'name':'Plaintext Command', 'key':'ptcmd', 'type':'list', 'values':['p', 'h'], 'value':'p'},
                    {'name':'Init Command', 'key':'cmdinit', 'type':'str', 'value':''},
                    {'name':'Load Key Command', 'key':'cmdkey', 'type':'str', 'value':'k$KEY$\\n'},
                    {'name':'Load Input Command', 'key':'cmdinput', 'type':'str', 'value':''},
                    {'name':'Go Command','key':'cmdgo', 'type':'str', 'value':'p$TEXT$\\n'},
                    {'name':'Output Format', 'key':'cmdout', 'type':'str', 'value':'r$RESPONSE$\\n'},
                    #{'name':'Data Format', 'key':'datafmt', 'type':'list', 'values':{'DEADBEEF':'',
                    #                                                                 'DE AD BE EF':' ',
                    #                                                                 'DE:AD:BE:EF':':',
                    #                                                                 'DE-AD-BE-EF':'-'}, 'value':''},
                    ]
        self.params = Parameter.create(name='Target Connection', type='group', children=ssParams)
        ExtendedParameter.setupExtended(self.params, self)
        self.ser = None
        self.keylength = 16
        self.input = ""

        self.oa = None
        self.setConnection(self.findParam('con').value())
Example #17
0
    def setupParameters(self):
        ssParams = [{'name':'baud', 'type':'int', 'key':'baud', 'value':38400, 'limits':(500, 2000000), 'get':self.baud, 'set':self.setBaud}]

        self.params = Parameter.create(name='Serial Port Settings', type='group', children=ssParams)
        ExtendedParameter.setupExtended(self.params, self)
        self.cwlite_usart = None
        self.oa = None
Example #18
0
 def __init__(self, openMode=False):
     self.fmt = None
     traceParams = [{
         'name':
         'Trace Configuration',
         'type':
         'group',
         'children': [
             {
                 'name': 'Config File',
                 'key': 'cfgfile',
                 'type': 'str',
                 'readonly': True,
                 'value': ''
             },
             {
                 'name': 'Format',
                 'key': 'format',
                 'type': 'str',
                 'readonly': True,
                 'value': ''
             },
         ]
     }]
     self.params = Parameter.create(name='Trace Configuration',
                                    type='group',
                                    children=traceParams)
     self.traceParams = traceParams
     ExtendedParameter.setupExtended(self.params, self)
    def __init__(self, showScriptParameter=None, CWMainWindow=None):

        self.cwAdv = CWAdvTrigger()   
        

        paramSS = [
                 {'name':'Serial Settings', 'type':'group', 'children':[
                      {'name':'Baud', 'key':'baud', 'type':'int', 'limits':(100, 500000), 'value':38400, 'step':100, 'set':self.updateSampleRate},
                      {'name':'Start Bits', 'key':'startbits', 'type':'int', 'limits':(1, 10), 'value':1},
                      {'name':'Stop Bits', 'key':'stopbits', 'type':'int', 'limits':(1, 10), 'value':1},
                      {'name':'Parity', 'key':'parity', 'type':'list', 'values':['none', 'even'], 'value':'none'},
                    ]},

                 # TODO: Need to confirm oversample rate stuff
                 {'name':'Oversample Rate', 'key':'osrate', 'type':'int', 'limits':(2, 5), 'value':3, 'set':self.updateSampleRate},
                 {'name':'Calculated Clkdiv', 'key':'calcclkdiv', 'type':'int', 'readonly':True},
                 {'name':'Calculated Error', 'key':'calcerror', 'type':'int', 'suffix':'%', 'readonly':True},
                 {'name':'Trigger Character', 'key':'trigpatt', 'type':'str', 'value':'""', 'set':self.setPattern},
                 {'name':'Binary Pattern', 'key':'binarypatt', 'type':'str', 'value':''},
                 {'name':'Reset Module', 'type':'action', 'action':self.reset},
                 
                {'name':'Advanced Settings', 'type':'group', 'children':[
                 {'name':'Threshold', 'key':'threshold', 'type':'int', 'value':1, 'limits':(1, 10), 'set':self.reset},
                 {'name':'Initial Bit Correction', 'key':'initialcorrect', 'type':'int', 'value':3, 'limits':(0, 10), 'set':self.reset},
                 ]}
                ]
            
        self.oa = None
        self.params = Parameter.create(name='Digital Pattern Trigger Module', type='group', children=paramSS)
        ExtendedParameter.setupExtended(self.params, self)
        self.showScriptParameter = showScriptParameter
Example #20
0
    def setupParameters(self):
        ssParams = [{
            'name': 'Baud',
            'key': 'baud',
            'type': 'list',
            'values': {
                '38400': 38400,
                '19200': 19200
            },
            'value': 38400
        }, {
            'name': 'Port',
            'key': 'port',
            'type': 'list',
            'values': ['Hit Refresh'],
            'value': 'Hit Refresh'
        }, {
            'name': 'Refresh',
            'type': 'action',
            'action': self.updateSerial
        }]
        self.params = Parameter.create(name='Serial Port Settings',
                                       type='group',
                                       children=ssParams)

        ExtendedParameter.setupExtended(self.params, self)
        self.ser = None
Example #21
0
    def __init__(self):
        super(ResultsPlotting, self).__init__()

        self.override = None

        #ResultsTable manages class
        self.table = ResultsTable()
        self.table.setKeyOverride(self.processKnownKey)

        self.graphoutput = OutputVsTime()
        self.GraphOutputDock = QDockWidget(self.graphoutput.name)
        self.GraphOutputDock.setObjectName(self.graphoutput.name)
        self.GraphOutputDock.setAllowedAreas(Qt.BottomDockWidgetArea | Qt.RightDockWidgetArea| Qt.LeftDockWidgetArea)
        self.GraphOutputDock.setWidget(self.graphoutput)
        self.graphoutput.setDock(self.GraphOutputDock)
        self.graphoutput.setKeyOverride(self.processKnownKey)

        self.pgegraph = PGEVsTrace()
        self.PGEGraphDock = QDockWidget(self.pgegraph.name)
        self.PGEGraphDock.setObjectName(self.pgegraph.name)
        self.PGEGraphDock.setAllowedAreas(Qt.BottomDockWidgetArea | Qt.RightDockWidgetArea| Qt.LeftDockWidgetArea)
        self.PGEGraphDock.setWidget(self.pgegraph)
        self.pgegraph.setDock(self.PGEGraphDock)
        self.pgegraph.setKeyOverride(self.processKnownKey)

        self.saveresults = ResultsSave()

        resultsParams = [{'name':'Knownkey Source', 'type':'list', 'values':{'Attack Module':'attack', 'GUI Override':'gui'},
                                                    'value':'attack', 'set':self.setKnownKeySrc},

                         {'name':'Override Key', 'type':'str', 'key':'knownkey', 'value':'', 'set':self.setKnownKeyStr, 'readonly':True},
                         {'name':'Save Raw Results', 'type':'bool', 'value':False, 'set':self.saveresults.setEnabled}
                      ]
        self.params = Parameter.create(name="General Parameters", type='group', children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
Example #22
0
    def setupCommonScripts(self):
        # Setup parameter tree

        self.commonScriptParams = []

        for example in self.exampleScripts:
            self.commonScriptParams.append({
                'name': example.name,
                'type': 'group',
                'children': example.params
            })
            example.scriptsUpdated.connect(self.updateScripts)
            example.runScriptFunction.connect(self.runScriptFunction.emit)

        self.paramCommonScripts = Parameter.create(
            name='Common Scripts',
            type='group',
            children=self.commonScriptParams)
        ExtendedParameter.setupExtended(self.paramCommonScripts, self)
        self.paramTreeCommonScripts = ParameterTree()
        self.paramTreeCommonScripts.setParameters(self.paramCommonScripts,
                                                  showTop=False)

        self.commonScriptsDock = self.addDock(self.paramTreeCommonScripts,
                                              "Common Scripts")

        self.params = self.paramCommonScripts

        self.updateScripts()
    def __init__(self, subkeys=16, permPerSubkey=256):
        super(ResultsPlotData, self).__init__()

        self.numKeys = subkeys
        self.numPerms = permPerSubkey
        self._knownkey = None
        self.enabledbytes = [False] * subkeys
        self.doRedraw = True
        self.orfunction = None

        self.byteNumAct = []
        for i in range(0, self.numKeys):
            self.byteNumAct.append(QAction("%d" % i, self))
            self.byteNumAct[i].triggered[bool].connect(partial(self.setBytePlot, i))
            self.byteNumAct[i].setCheckable(True)

        byteNumAllOn = QAction("All On", self)
        byteNumAllOff = QAction("All Off", self)
        byteNumAllOn.triggered.connect(partial(self.setByteAll, False))
        byteNumAllOff.triggered.connect(partial(self.setByteAll, True))

        self.bselection = QToolBar()

        for i in range(0, self.numKeys):
            self.bselection.addAction(self.byteNumAct[i])
        self.bselection.addAction(byteNumAllOn)
        self.bselection.addAction(byteNumAllOff)
        self.layout().addWidget(self.bselection)

        self.highlightTop = True

        resultsParams = self.genericParameters()
        self.params = Parameter.create(name=self.name, type="group", children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
Example #24
0
    def __init__(self, parent, showScriptParameter=None, tmanager=None, console=None):
        super(ProfilingTemplate, self).__init__()
        if console:
            self.console = console
        self.setParent(parent)
        self._tmanager = None
        self._project = None

        resultsParams = [{'name':'Load Template', 'type':'group', 'children':[
                            ]},
                         {'name':'Generate New Template', 'type':'group', 'children':[
                            {'name':'Trace Start', 'key':'tgenstart', 'value':0, 'type':'int', 'set':self.updateScript},
                            {'name':'Trace End', 'key':'tgenstop', 'value':self.parent().traceMax, 'type':'int', 'set':self.updateScript},
                            {'name':'POI Selection', 'key':'poimode', 'type':'list', 'values':{'TraceExplorer Table':0, 'Read from Project File':1}, 'value':0, 'set':self.updateScript},
                            {'name':'Read POI', 'type':'action', 'action':self.updateScript},
                            {'name':'Generate Templates', 'type':'action', 'action': lambda:self.runScriptFunction.emit("generateTemplates")}
                            ]},
                         ]
        self.params = Parameter.create(name='Template Attack', type='group', children=resultsParams)
        if showScriptParameter is not None:
            self.showScriptParameter = showScriptParameter
            # print self.showScriptParameter
        ExtendedParameter.setupExtended(self.params, self)

        self.addGroup("generateTemplates")

        self.sr = None

        self.stats = DataTypeDiffs()
        self.setProfileAlgorithm(TemplateBasic)
Example #25
0
    def setupParameters(self):

        resultsParams = [
            {
                'name': 'Enabled',
                'key': 'enabled',
                'type': 'bool',
                'value': True,
                'set': self.updateScript
            },
            {
                'name': 'Decimation = N:1',
                'key': 'decfactor',
                'type': 'int',
                'value': 1,
                'limit': (1, 1000),
                'set': self.updateScript
            },
            # {'name':'Decimation Type', 'values':''}
        ]

        self.params = Parameter.create(name='Fixed Decimation',
                                       type='group',
                                       children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
        self.setDecimationFactor(1)
        self.updateScript()
Example #26
0
    def setupParameters(self):
        ssParams = [{
            'name': 'Enabled',
            'key': 'enabled',
            'type': 'bool',
            'value': True,
            'set': self.updateScript
        }, {
            'name': 'Form',
            'key': 'form',
            'type': 'list',
            'values': {
                "Butterworth": "sp.signal.butter"
            },
            'set': self.updateScript
        }, {
            'name': 'Type',
            'key': 'type',
            'type': 'list',
            'values': ["low", "high", "bandpass"],
            'value': 'low',
            'set': self.updateScript
        }, {
            'name': 'Critical Freq #1 (0-1)',
            'key': 'freq1',
            'type': 'float',
            'limits': (0, 1),
            'step': 0.05,
            'value': 0.1,
            'set': self.updateScript
        }, {
            'name': 'Critical Freq #2 (0-1)',
            'key': 'freq2',
            'type': 'float',
            'limits': (0, 1),
            'step': 0.05,
            'value': 0.8,
            'set': self.updateScript
        }, {
            'name': 'Order',
            'key': 'order',
            'type': 'int',
            'limits': (1, 32),
            'value': 5,
            'set': self.updateScript
        }, {
            'name': 'Desc',
            'type': 'text',
            'value': self.descrString
        }]
        self.params = Parameter.create(name='Filter',
                                       type='group',
                                       children=ssParams)
        ExtendedParameter.setupExtended(self.params, self)

        self.updateScript()

        # Setup imports required
        self.importsAppend("import scipy as sp")
Example #27
0
 def setupParameters(self):         
     ssParams = [  {'name':'Get ATR (Reset Card)', 'type':'action', 'action':self.reset},
                   {'name':'ATR', 'key':'atr', 'type':'str'},                              
                   ]
     self.params = Parameter.create(name='Target Connection', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
     
     self.protocol = 0            
Example #28
0
 def setupParameters(self):
     ssParams = [{'name':'Card Present', 'key':'statusStr', 'type':'bool', 'value':False, 'readonly':True},
                 {'name':'Update Status', 'type':'action', 'action':self.statusUpdate},
                 {'name':'Answer To Reset (ATR)', 'key':'atr', 'type':'str', 'value':'', 'readonly':True},
                 {'name':'Reset Card', 'type':'action', 'action':self.reset},                                                        
                 ]        
     self.params = Parameter.create(name='Target Connection', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)       
Example #29
0
    def __init__(self, subkeys=16, permPerSubkey=256, useAbs=True):
        super(ResultsTable, self).__init__()

        self.orfunction = None

        self.table = QTableWidget(permPerSubkey+1, subkeys)
        self.table.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)

        self.pgeBrush = QBrush(QColor(253,255,205))
        pgehdr = QTableWidgetItem("PGE")
        self.table.setVerticalHeaderItem(0,pgehdr)
        for i in range(1,permPerSubkey+1):
            self.table.setVerticalHeaderItem(i, QTableWidgetItem("%d"%(i-1)))

        for i in range(0,subkeys):
            fi = QTableWidgetItem("")
            fi.setBackground(self.pgeBrush)
            self.table.setItem(0,i,fi)

        for i in range(0,subkeys):
            self.table.setHorizontalHeaderItem(i, QTableWidgetItem("%d"%i))

        self.table.resizeColumnsToContents()

        fullTable = QWidget()
        fullLayout = QVBoxLayout()
        fullTable.setLayout(fullLayout)

        fullLayout.addWidget(self.table)

        self.ResultsTable = QDockWidget("Results Table")
        self.ResultsTable.setObjectName("Results Table")
        self.ResultsTable.setAllowedAreas(Qt.BottomDockWidgetArea | Qt.RightDockWidgetArea| Qt.LeftDockWidgetArea)
        self.ResultsTable.setWidget(fullTable)
        self.ResultsTable.setVisible(False)
        self.ResultsTable.visibilityChanged.connect(self.visibleChanged)

        self.numKeys = subkeys
        self.numPerms = permPerSubkey
        self.setBytesEnabled([])
        self.useAbs = useAbs
        self._knownkey = None
        self.useSingle = False

        resultsParams = [
                         {'name':'Show', 'type':'bool', 'key':'show', 'value':False, 'set':self.ResultsTable.setVisible},
                         {'name':'Use Absolute Value for Rank', 'type':'bool', 'value':True, 'set':self.setAbsoluteMode},
                         {'name':'Use single point for Rank', 'type':'bool', 'value':False, 'set':self.setSingleMode},
                         {'name':'Update Mode', 'key':'updateMode', 'type':'list', 'values':{'Entire Table (Slow)':'all', 'PGE Only (faster)':'pge'}, 'set':self.setUpdateMode},
                      ]

        self.params = Parameter.create(name='Ranked Table', type='group', children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)

        self.updateMode = self.findParam('updateMode').value()

        #Update parameter tree
        self.visibleChanged()
Example #30
0
    def __init__(self, subkeys=16, permPerSubkey=256, useAbs=True):
        super(ResultsTable, self).__init__()

        self.orfunction = None

        self.table = QTableWidget(permPerSubkey+1, subkeys)
        self.table.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)

        self.pgeBrush = QBrush(QColor(253,255,205))
        pgehdr = QTableWidgetItem("PGE")
        self.table.setVerticalHeaderItem(0,pgehdr)
        for i in range(1,permPerSubkey+1):
            self.table.setVerticalHeaderItem(i, QTableWidgetItem("%d"%(i-1)))

        for i in range(0,subkeys):
            fi = QTableWidgetItem("")
            fi.setBackground(self.pgeBrush)
            self.table.setItem(0,i,fi)

        for i in range(0,subkeys):
            self.table.setHorizontalHeaderItem(i, QTableWidgetItem("%d"%i))

        self.table.resizeColumnsToContents()

        fullTable = QWidget()
        fullLayout = QVBoxLayout()
        fullTable.setLayout(fullLayout)

        fullLayout.addWidget(self.table)

        self.ResultsTable = QDockWidget("Results Table")
        self.ResultsTable.setObjectName("Results Table")
        self.ResultsTable.setAllowedAreas(Qt.BottomDockWidgetArea | Qt.RightDockWidgetArea| Qt.LeftDockWidgetArea)
        self.ResultsTable.setWidget(fullTable)
        self.ResultsTable.setVisible(False)
        self.ResultsTable.visibilityChanged.connect(self.visibleChanged)

        self.numKeys = subkeys
        self.numPerms = permPerSubkey
        self.setBytesEnabled([])
        self.useAbs = useAbs
        self._knownkey = None
        self.useSingle = False

        resultsParams = [
                         {'name':'Show', 'type':'bool', 'key':'show', 'value':False, 'set':self.ResultsTable.setVisible},
                         {'name':'Use Absolute Value for Rank', 'type':'bool', 'value':True, 'set':self.setAbsoluteMode},
                         {'name':'Use single point for Rank', 'type':'bool', 'value':False, 'set':self.setSingleMode},
                         {'name':'Update Mode', 'key':'updateMode', 'type':'list', 'values':{'Entire Table (Slow)':'all', 'PGE Only (faster)':'pge'}, 'set':self.setUpdateMode},
                      ]

        self.params = Parameter.create(name='Ranked Table', type='group', children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)

        self.updateMode = self.findParam('updateMode').value()

        #Update parameter tree
        self.visibleChanged()
    def __init__(self, parent, showScriptParameter=None):
        super(GlitchExplorerDialog, self).__init__(parent)

        self.showScriptParameter = showScriptParameter

        self.setWindowTitle("Glitch Explorer")

        self.mainLayout = QVBoxLayout()
        self.mainSplitter = QSplitter(self)
        self.mainSplitter.setOrientation(Qt.Vertical)

        self.tableList = []
        self.tuneParamList = []

        #Add default table
        self.table = QTableWidget(1,1)
        # self.table.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.mainSplitter.addWidget(self.table)

        self.glitchParams =[{'name':'Clear Output Table', 'type':'action', 'action':self.clearTable},
                            {'name':'Tuning Parameters', 'key':'numtune', 'type':'int', 'value':0, 'limits':(0, 4), 'set':self.updateParameters},
                            {'name':'Traces Required', 'key':'tracesreq', 'type':'int', 'value':1, 'limits':(1, 1E99), 'readonly':True},
                            {'name':'Normal Response', 'type':'str', 'key':'normalresp', 'value':'s.startswith("Bad")'},
                            {'name':'Successful Response', 'type':'str', 'key':'successresp', 'value':'s.startswith("Welcome")'},

                            {'name':'Recordings', 'type':'group', 'expanded':False, 'children':[
                                # {'name':'Autosave Multi-Capture Results', 'type':'bool', 'key':'saveresults', 'value':True},
                                {'name':'Last autosave Filename', 'type':'str', 'key':'savefilename', 'value':''},
                                {'name':'Notes', 'type':'text', 'key':'savenotes'},
                                {'name':'Write notes to last autosave file', 'type':'action'}
                            ]},
                            ]


        self.params = Parameter.create(name='Glitch Explorer', type='group', children=self.glitchParams)
        ExtendedParameter.setupExtended(self.params, self)
        self.paramTree = ParameterTree()

        self.reloadParameters()

        self.mainSplitter.addWidget(self.paramTree)

        self.statusLabel = QLabel("")

        self.mainSplitter.addWidget(self.statusLabel)

        # self.mainSplitter.setHandleWidth(100)

        self.mainLayout.addWidget(self.mainSplitter)
        self.setLayout(self.mainLayout)
        self.hide()

        #Do an update
        self.table.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
        self.table.horizontalHeader().setResizeMode(QHeaderView.Interactive)  # setStretchLastSection(True)
        self.clearTable()

        self._campaignRunning = False
Example #32
0
 def setupParameters(self):
     self.ser = None     
     ssParams = [{'name':'Port', 'key':'port', 'type':'list', 'values':['Hit Refresh'], 'value':'Hit Refresh'},
                              {'name':'Refresh', 'type':'action', 'action':self.updateSerial},
                             {'name':'Get ATR (Reset Card)', 'type':'action', 'action':self.reset},
                             {'name':'ATR', 'key':'atr', 'type':'str'}                                
                             ]
     self.params = Parameter.create(name='Target Connection', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)      
    def __init__(self):
        super(ResultsPlotting, self).__init__()

        self.override = None

        # ResultsTable manages class
        self.table = ResultsTable()
        self.table.setKeyOverride(self.processKnownKey)

        self.graphoutput = OutputVsTime()
        self.GraphOutputDock = QDockWidget(self.graphoutput.name)
        self.GraphOutputDock.setObjectName(self.graphoutput.name)
        self.GraphOutputDock.setAllowedAreas(Qt.BottomDockWidgetArea | Qt.RightDockWidgetArea | Qt.LeftDockWidgetArea)
        self.GraphOutputDock.setWidget(self.graphoutput)
        self.graphoutput.setDock(self.GraphOutputDock)
        self.graphoutput.setKeyOverride(self.processKnownKey)

        self.pgegraph = PGEVsTrace()
        self.PGEGraphDock = QDockWidget(self.pgegraph.name)
        self.PGEGraphDock.setObjectName(self.pgegraph.name)
        self.PGEGraphDock.setAllowedAreas(Qt.BottomDockWidgetArea | Qt.RightDockWidgetArea | Qt.LeftDockWidgetArea)
        self.PGEGraphDock.setWidget(self.pgegraph)
        self.pgegraph.setDock(self.PGEGraphDock)
        self.pgegraph.setKeyOverride(self.processKnownKey)

        self.corrgraph = CorrelationVsTrace()
        self.CorrelationOutputDock = QDockWidget(self.corrgraph.name)
        self.CorrelationOutputDock.setObjectName(self.corrgraph.name)
        self.CorrelationOutputDock.setAllowedAreas(
            Qt.BottomDockWidgetArea | Qt.RightDockWidgetArea | Qt.LeftDockWidgetArea
        )
        self.CorrelationOutputDock.setWidget(self.corrgraph)
        self.corrgraph.setDock(self.CorrelationOutputDock)
        self.corrgraph.setKeyOverride(self.processKnownKey)

        self.saveresults = ResultsSave()

        resultsParams = [
            {
                "name": "Knownkey Source",
                "type": "list",
                "values": {"Attack Module": "attack", "GUI Override": "gui"},
                "value": "attack",
                "set": self.setKnownKeySrc,
            },
            {
                "name": "Override Key",
                "type": "str",
                "key": "knownkey",
                "value": "",
                "set": self.setKnownKeyStr,
                "readonly": True,
            },
            {"name": "Save Raw Results", "type": "bool", "value": False, "set": self.saveresults.setEnabled},
        ]
        self.params = Parameter.create(name="General Parameters", type="group", children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
Example #34
0
 def setupParameters(self):
     ssParams = [{'name':'Enabled', 'type':'bool', 'key':'enabled', 'value':True, 'set':self.updateScript},
                      {'name':'Max Jitter (+/- cycles)', 'key':'jitter', 'type':'int', 'value':0, 'limits':(0, 1000), 'set':self.updateScript},
                      {'name':'Desc', 'type':'text', 'value':self.descrString}
                   ]
     self.params = Parameter.create(name='Add Random Jitter', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
     self.maxJitter = 0
     self.updateScript()
Example #35
0
    def setupParameters(self):
        ssParams = [{'name':'Baud', 'key':'baud', 'type':'list', 'values':{'38400':38400, '19200':19200}, 'value':38400},
                    {'name':'Port', 'key':'port', 'type':'list', 'values':['Hit Refresh'], 'value':'Hit Refresh'},
                    {'name':'Refresh', 'type':'action', 'action':self.updateSerial}
                    ]
        self.params = Parameter.create(name='Serial Port Settings', type='group', children=ssParams)

        ExtendedParameter.setupExtended(self.params, self)
        self.ser = None
Example #36
0
    def setupParameters(self):
        scopes = {"None":None}
        if ps5000a is not None:
            scopes["PicoScope 5000A"] = ps5000a.PS5000a(connect=False)


        ssParams = [{'name':'Device', 'type':'list', 'key':'device', 'values':scopes, 'value':"None", 'set':self.setConnection}]
        self.params = Parameter.create(name='Frequency Measurement', type='group', children=ssParams)
        ExtendedParameter.setupExtended(self.params, self)
Example #37
0
    def __init__(self, showScriptParameter=None, CWMainWindow=None):

        self.waveformDock = CWMainWindow.waveformDock
        self.waveformDock.widget().dataChanged.connect(self.dataChanged)

        paramSS = [
            # {'name':'Open SAD Viewer', 'type':'action'},
            {
                'name':
                'SAD Ref From Captured',
                'type':
                'group',
                'children': [
                    {
                        'name': 'Point Range',
                        'key': 'pointrng',
                        'type': 'rangegraph',
                        'limits': (0, 0),
                        'value': (0, 0),
                        'graphwidget': self.waveformDock.widget(),
                        'set': self.updateSADTraceRef,
                        'fixedsize': 128
                    },
                    {
                        'name': 'Set SAD Reference from Current Trace',
                        'key': 'docopyfromcapture',
                        'type': 'action',
                        'action': self.copyFromCaptureTrace
                    },
                    {
                        'name': 'SAD Reference vs. Cursor',
                        'key': 'sadrefcur',
                        'type': 'int',
                        'limits': (-1, 100E6),
                        'readonly': True
                    },
                ]
            },
            {
                'name': 'SAD Threshold',
                'type': 'int',
                'limits': (0, 100000),
                'value': 0,
                'set': self.setThreshold,
                'get': self.getThreshold
            }
        ]

        self.oldlow = None
        self.oldhigh = None
        self.oa = None
        self.sadref = [0]
        self.params = Parameter.create(name='SAD Trigger Module',
                                       type='group',
                                       children=paramSS)
        ExtendedParameter.setupExtended(self.params, self)
        self.showScriptParameter = showScriptParameter
Example #38
0
 def setupParameters(self):
     ssParams = [{'name':'Enabled', 'key':'enabled', 'type':'bool', 'value':True, 'set':self.updateScript},
                      {'name':'Noise Std-Dev', 'key':'noisestddev', 'type':'float', 'value':0.000001, 'limits':(0, 1.0), 'set':self.updateScript},
                      {'name':'Desc', 'type':'text', 'value':self.descrString}
                   ]
     self.params = Parameter.create(name='Add Random Noise', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
     self._maxNoise = 0
     self.updateScript()
 def __init__(self, console=None, showScriptParameter=None, target=None):
     super(AcqKeyTextPattern_Base, self).__init__()
     self.showScriptParameter = showScriptParameter
     self.console = console
     basicParams = self.setupParams()
     self.params = Parameter.create(name='Key/Text Pattern', type='group', children=basicParams)
     ExtendedParameter.setupExtended(self.params, self)
     self._target = target
     self._initPattern()
Example #40
0
 def __init__(self, openMode=False):
     self.fmt = None
     traceParams = [{'name':'Trace Configuration', 'type':'group', 'children':[
                     {'name':'Config File', 'key':'cfgfile', 'type':'str', 'readonly':True, 'value':''},
                     {'name':'Format', 'key':'format', 'type':'str', 'readonly':True, 'value':''},
                   ]}]
     self.params = Parameter.create(name='Trace Configuration', type='group', children=traceParams)
     self.traceParams = traceParams
     ExtendedParameter.setupExtended(self.params, self)
Example #41
0
    def __init__(self, console=None, showScriptParameter=None):
        super(VisaScope, self).__init__()
        self.showScriptParameter = showScriptParameter
        self.console = console
        self.visaInst = None

        scopeParams = [
            {
                'name': 'X-Scale',
                'key': 'xscale',
                'type': 'list',
                'values': self.xScales
            },
            {
                'name': 'Y-Scale',
                'key': 'yscale',
                'type': 'list',
                'values': self.yScales
            },
            {
                'name': 'Y-Offset',
                'key': 'yoffset',
                'type': 'float',
                'step': 1E-3,
                'siPrefix': True,
                'suffix': 'V'
            },
            {
                'name': 'X-Offset',
                'key': 'xoffset',
                'type': 'float',
                'step': 1E-6,
                'siPrefix': True,
                'suffix': 'S'
            },
            {
                'name': 'Download Offset',
                'key': 'xdisporigin',
                'type': 'int',
                'limits': (0, 1E9)
            },
            {
                'name': 'Download Size',
                'key': 'xdisprange',
                'type': 'int',
                'limits': (0, 1E9)
            },
        ]

        for t in self.getAdditionalParams():
            scopeParams.append(t)

        self.params = Parameter.create(name='Scope Settings',
                                       type='group',
                                       children=scopeParams)
        ExtendedParameter.setupExtended(self.params, self)
Example #42
0
 def setupParameters(self):
     ssParams = [{'name':'Keep-Alive Interval (off=0)', 'type':'int', 'value':2, 'set':self.setKeepalive}                                                            
                 ]        
     self.params = Parameter.create(name='Target Connection', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)    
     
     
     self.timeoutTimer = QTimer()  
     self.timeoutTimer.timeout.connect(self.timeoutFired)
     self.timeoutTimer.setInterval(2000)
Example #43
0
 def __init__(self, console=None, showScriptParameter=None, target=None):
     super(AcqKeyTextPattern_Base, self).__init__()
     self.showScriptParameter = showScriptParameter
     self.console = console
     basicParams = self.setupParams()
     self.params = Parameter.create(name='Key/Text Pattern',
                                    type='group',
                                    children=basicParams)
     ExtendedParameter.setupExtended(self.params, self)
     self._target = target
     self._initPattern()
Example #44
0
 def setupParameters(self):
     ssParams = [{'name':'TX Baud', 'key':'txbaud', 'type':'int', 'limits':(0, 1E6), 'value':38400, 'get':self.txBaud, 'set':self.setTxBaud},
                 {'name':'RX Baud', 'key':'rxbaud', 'type':'int', 'limits':(0, 1E6), 'value':38400, 'get':self.rxBaud, 'set':self.setRxBaud},
                 {'name':'Stop-Bits', 'key':'stopbits', 'type':'list', 'values':{'1':1, '2':2}, 'value':0, 'get':self.stopBits,
                                 'set':self.setStopBits, 'readonly':True},
                 {'name':'Parity', 'key':'parity', 'type':'list', 'values':{'None':'n', 'Even':'e'}, 'value':0, 'get':self.parity,
                                 'set':self.setParity, 'readonly':True},
                 ]
     self.params = Parameter.create(name='Serial Port Settings', type='group', children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
     self._regVer = 0
Example #45
0
    def __init__(self, subkeys=16, permPerSubkey=256):
        super(CorrelationVsTrace, self).__init__()
        
        self.setLabels(self.name, "Traces", "Max Correlation Output for Subkey")

        self.numKeys = subkeys
        self.numPerms = permPerSubkey

        resultsParams = self.genericParameters()
        self.params = Parameter.create(name=self.name, type='group', children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
    def __init__(self, showScriptParameter=None):
        #self.cwADV = CWAdvTrigger()
        self.cwEXTRA = CWExtraSettings()
        self.params = Parameter.create(name='CW Extra', type='group', children=self.cwEXTRA.param)
        ExtendedParameter.setupExtended(self.params, self)
        self.showScriptParameter = showScriptParameter

        self.enableGlitch = True

        if self.enableGlitch:
            self.glitch = ChipWhispererGlitch.ChipWhispererGlitch(showScriptParameter)
Example #47
0
 def setupParameters(self):
     """You should overload this. Copy/Paste into your class."""
     ssParams = [{
         'name': 'Example Parameter',
         'type': 'int',
         'value': 5
     }]  # 'set':self.someFunction
     self.params = Parameter.create(name='Smartcard Reader',
                                    type='group',
                                    children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
Example #48
0
    def setupParameters(self):

        self.rtrace = 0
        self.debugReturnSad = False
        resultsParams = [
            {
                'name': 'Enabled',
                'key': 'enabled',
                'type': 'bool',
                'value': True,
                'set': self.updateScript
            },
            {
                'name': 'Ref Trace',
                'key': 'reftrace',
                'type': 'int',
                'value': 0,
                'set': self.updateScript
            },
            {
                'name': 'Reference Points',
                'key': 'refpts',
                'type': 'rangegraph',
                'graphwidget': self.parent.waveformDock.widget(),
                'set': self.updateScript
            },
            {
                'name': 'Input Window',
                'key': 'windowpt',
                'type': 'rangegraph',
                'graphwidget': self.parent.waveformDock.widget(),
                'set': self.updateScript
            },
            # {'name':'Valid Limit', 'type':'float', 'value':0, 'step':0.1, 'limits':(0, 10), 'set':self.setValidLimit},
            # {'name':'Output SAD (DEBUG)', 'type':'bool', 'value':False, 'set':self.setOutputSad},
            {
                'name': 'Desc',
                'type': 'text',
                'value': self.descrString
            }
        ]

        self.params = Parameter.create(
            name='Minimize Sum of Absolute Difference',
            type='group',
            children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
        self.ccStart = 0
        self.ccEnd = 1
        self.wdStart = 0
        self.wdEnd = 1

        self.updateScript()
Example #49
0
 def setupParameters(self):
     self.hdev = HIDSPI()
     ssParams = [{
         'name': 'Jump to Bootloader',
         'type': 'action',
         'action': self.hdev.jumpBootloader
     }]
     self.params = Parameter.create(name='Target Connection',
                                    type='group',
                                    children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
     self.keylength = 16
Example #50
0
 def setupParameters(self):
     ssParams = [
         {
             'name': 'TX Baud',
             'key': 'txbaud',
             'type': 'int',
             'limits': (0, 1E6),
             'value': 38400,
             'get': self.txBaud,
             'set': self.setTxBaud
         },
         {
             'name': 'RX Baud',
             'key': 'rxbaud',
             'type': 'int',
             'limits': (0, 1E6),
             'value': 38400,
             'get': self.rxBaud,
             'set': self.setRxBaud
         },
         {
             'name': 'Stop-Bits',
             'key': 'stopbits',
             'type': 'list',
             'values': {
                 '1': 1,
                 '2': 2
             },
             'value': 0,
             'get': self.stopBits,
             'set': self.setStopBits,
             'readonly': True
         },
         {
             'name': 'Parity',
             'key': 'parity',
             'type': 'list',
             'values': {
                 'None': 'n',
                 'Even': 'e'
             },
             'value': 0,
             'get': self.parity,
             'set': self.setParity,
             'readonly': True
         },
     ]
     self.params = Parameter.create(name='Serial Port Settings',
                                    type='group',
                                    children=ssParams)
     ExtendedParameter.setupExtended(self.params, self)
     self._regVer = 0
Example #51
0
    def setupParameters(self):
        self.rtrace = 0
        self.debugReturnCorr = False
        resultsParams = [{
            'name': 'Enabled',
            'key': 'enabled',
            'type': 'bool',
            'value': True,
            'set': self.updateScript
        }, {
            'name': 'Ref Trace #',
            'key': 'reftrace',
            'type': 'int',
            'value': 0,
            'set': self.updateScript
        }, {
            'name': 'Peak Type',
            'key': 'peaktype',
            'type': 'list',
            'value': 'Max',
            'values': ['Max', 'Min'],
            'set': self.updateScript
        }, {
            'name': 'Point Range',
            'key': 'ptrange',
            'type': 'rangegraph',
            'graphwidget': self.parent.waveformDock.widget(),
            'set': self.updateScript
        }, {
            'name': 'Valid Limit',
            'key': 'vlimit',
            'type': 'float',
            'value': 0,
            'step': 0.1,
            'limits': (-10, 10),
            'set': self.updateScript
        }, {
            'name': 'Desc',
            'type': 'text',
            'value': self.descrString
        }]

        self.params = Parameter.create(name='Peak Detect',
                                       type='group',
                                       children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
        self.ccStart = 0
        self.ccEnd = 0
        self.limit = 0
        self.type = max
        self.updateScript()
Example #52
0
    def __init__(self, subkeys=16, permPerSubkey=256):
        super(PGEVsTrace, self).__init__()
        
        self.setLabels("Partial Guessing Entropy vs. Traces", "Traces", "Partial Guessing Entropy")

        self.numKeys = subkeys
        self.numPerms = permPerSubkey

        resultsParams = [{'name':'Show', 'type':'bool', 'key':'show', 'value':False, 'set':self.showDockSignal.emit},
                         {'name':'Copy PGE Data to Clipboard', 'type':'action', 'action':self.copyPGE},
                         {'name':'Clipboard Format', 'key':'fmt', 'type':'list', 'values':['CSV', 'MATLAB'], 'value':'CSV'},
                      ]
        self.params = Parameter.create(name=self.name, type='group', children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
Example #53
0
    def setupParameters(self):
        self.hw = None

        conntypes = dicttype()
        conntypes['Select Interface type...'] = None
        conntypes['CW Bitstream, with OpenADC'] = ChipWhispererComm(
            standalone=False)
        conntypes['CW Bitstream, no OpenADC'] = ChipWhispererComm(
            standalone=True)
        conntypes['Original Bitstream'] = FTDIComm()

        ssParams = [
            {
                'name': 'Connection via:',
                'key': 'conn',
                'type': 'list',
                'values': conntypes,
                'set': self.setConn,
                'value': None
            },
            {
                'name': 'Reset FPGA',
                'key': 'reset',
                'type': 'action',
                'action': self.reset,
                'visible': False
            },
            {
                'name': 'USB Serial #:',
                'key': 'serno',
                'type': 'list',
                'values': ['Press Refresh'],
                'visible': False
            },
            {
                'name': 'Enumerate Attached Devices',
                'key': 'pushsno',
                'type': 'action',
                'action': self.refreshSerial,
                'visible': False
            },
        ]
        self.params = Parameter.create(name='Target Connection',
                                       type='group',
                                       children=ssParams)
        ExtendedParameter.setupExtended(self.params, self)
        self.oa = None
        self.fixedStart = True
        self.hw = self.findParam('conn').value()
Example #54
0
    def __init__(self, subkeys=16, permPerSubkey=256):
        super(OutputVsTime, self).__init__()

        self.setLabels("Attack Output vs. Sample for Subkey Guesses", "Sample Number", "Attack Output")

        self.numKeys = subkeys
        self.numPerms = permPerSubkey

        # resultsParams = [{'name':'Show', 'type':'bool', 'key':'show', 'value':False, 'set':self.showDockSignal.emit},
        #                 {'name':'Fast Draw', 'type':'bool', 'key':'fast', 'value':True},
        #                 {'name':'Hide during Redraw', 'type':'bool', 'key':'hide', 'value':True}
        #              ]
        resultsParams = self.genericParameters()
        self.params = Parameter.create(name=self.name, type='group', children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)
    def setupTraceParam(self):
        self.traceParams = Parameter.create(name='Trace Setup',
                                            type='group',
                                            children=[
                                                {
                                                    'name': 'Starting Trace',
                                                    'key': 'strace',
                                                    'type': 'int',
                                                    'set':
                                                    self.updateGenericScript
                                                },
                                                {
                                                    'name':
                                                    'Traces per Attack',
                                                    'key': 'atraces',
                                                    'type': 'int',
                                                    'limits': (1, 1E6),
                                                    'value': 1,
                                                    'set':
                                                    self.updateGenericScript
                                                },
                                                {
                                                    'name': 'Attack Runs',
                                                    'key': 'runs',
                                                    'type': 'int',
                                                    'limits': (1, 1E6),
                                                    'value': 1,
                                                    'set':
                                                    self.updateGenericScript
                                                },
                                                {
                                                    'name':
                                                    'Reporting Interval',
                                                    'key': 'reportinterval',
                                                    'type': 'int',
                                                    'value': 10,
                                                    'set':
                                                    self.updateGenericScript
                                                },
                                            ])
        ExtendedParameter.setupExtended(self.traceParams, self)

        self.addFunction("init", "setTraceStart", "0")
        self.addFunction("init", "setTracesPerAttack", "1")
        self.addFunction("init", "setIterations", "1")
        self.addFunction("init", "setReportingInterval", "10")

        self.singleEmit = True
    def setupParameters(self):
        self.rtrace = 0
        self.debugReturnCorr = False
        resultsParams = [{'name':'Enabled', 'key':'enabled', 'type':'bool', 'value':True, 'set':self.updateScript},
                         {'name':'Ref Trace', 'key':'reftrace', 'type':'int', 'value':0, 'set':self.updateScript},
                         {'name':'Window', 'key':'rwindow', 'type':'rangegraph', 'graphwidget':self.parent.waveformDock.widget(), 'set':self.updateScript},
                         # {'name':'Output Correlation (DEBUG)', 'type':'bool', 'value':False, 'set':self.setOutputCorr},
                         {'name':'Desc', 'type':'text', 'value':self.descrString}
                      ]
        self.params = Parameter.create(name='Cross Correlation', type='group', children=resultsParams)
        ExtendedParameter.setupExtended(self.params, self)

        self.ccStart = 0
        self.ccEnd = 0
        
        self.updateScript()
Example #57
0
    def setupParameters(self):
        ssParams = [{
            'name': 'baud',
            'type': 'int',
            'key': 'baud',
            'value': 38400,
            'limits': (500, 2000000),
            'get': self.baud,
            'set': self.setBaud
        }]

        self.params = Parameter.create(name='Serial Port Settings',
                                       type='group',
                                       children=ssParams)
        ExtendedParameter.setupExtended(self.params, self)
        self.cwlite_usart = None
        self.oa = None