Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
# Create the Qt Application
app = makeApplication("Capture")
Parameter.usePyQtGraph = True
# Create and show the GUI
window = CWCaptureGUI(CWCoreAPI())
window.show()
# Run the main Qt loop
app.exec_()
def __init__(self, traceSource=None, name=None):
#TODO: Where is project file?
self.trace_cache_file = CWCoreAPI.CWCoreAPI.getInstance().project().getDataFilepath("tempcache.npy")['abs']
self.tracehash_cache_file = CWCoreAPI.CWCoreAPI.getInstance().project().getDataFilepath("tempcachehash.npy")['abs']
self.cache_shape = (-1, -1)
PreprocessingBase.__init__(self, traceSource, name=name)
self.updateScript()
# chipwhisperer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with chipwhisperer. If not, see .
#=================================================
import importlib
from datetime import *
from chipwhisperer.common.utils import util
from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI
from chipwhisperer.capture.api.AcquisitionController import AcquisitionController, AcqKeyTextPattern_Basic, AcqKeyTextPattern_CRITTest
class CWCaptureAPI(CWCoreAPI):
"""This is the manager class"""
class Signals(CWCoreAPI.Signals):
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()
def __init__(self, api):
self._attackSettings = AttackSettings()
self._preprocessSettings = PreprocessingSettings(api)
super(CWAnalyzerGUI, self).__init__(api, name="ChipWhisperer" + u"\u2122" + " Analyzer " + CWCoreAPI.__version__ + "[*]", icon="cwiconA")
#self.addExampleScripts(pluginmanager.getPluginsInDictFromPackage("chipwhisperer.analyzer.scripts", False, False, self))
CWAnalyzerGUI.instance = self
if bf:
brange_df = [0]
brange_bf = brange
else:
brange_bf = [0]
brange_df = brange
#H = np.load('channelinfo-masked.npy')
#H = np.load('csi-masked-newkey.npy')
#H = np.load('channelinfo.npy')
#mio = sio.loadmat('equalizer.mat')
#H = mio['equaltotal']
# H = np.load('equalization.npy')
# self.project() ?
project = CWCoreAPI.getInstance().project()
section = project.getDataConfig("Template Data", "Equalization Matrix")
# section = project.getDataConfig("Template Data", "AOF Matrix")
fname = project.convertDataFilepathAbs(section[0]["filename"])
H = np.load(fname)
#for j in range(0, 16):
#4 = 500-800
#test = H.copy()
#for i in range(0, 5):
# threshold = max(abs(test[j]))
# test[j, abs(test[j,:]) >= threshold ] = 0
#print "%f %d"%(threshold, (abs(H[j,:]) > threshold).sum())
#H[j, abs(H[j,:]) < threshold] = 0
def main():
# Create the Qt Application
app = makeApplication("Capture")
Parameter.usePyQtGraph = True
# Create and show the GUI
window = CWCaptureGUI(CWCoreAPI())
window.show()
# Run the main Qt loop
app.exec_()
# chipwhisperer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with chipwhisperer. If not, see .
#=================================================
__author__ = "Colin O'Flynn"
import importlib
from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI
from chipwhisperer.common.utils import util
class CWAnalizerAPI(CWCoreAPI):
class Signals(CWCoreAPI.Signals):
def __init__(self):
super(CWAnalizerAPI.Signals, self).__init__()
self.reloadAttackParamList = util.Signal()
self.attackChanged = util.Signal()
def __init__(self):
super(CWAnalizerAPI, self).__init__()
self.da = None
self.numTraces = 100
self.traceLimits = 0
self.pointLimits = 0
self.results = None
def getAttack(self):
self.api.setParameter(['Generic Settings', 'Acquisition Settings', 'Number of Traces', 50])
# Throw away first few
self.api.capture1()
self.api.capture1()
# Capture a set of traces and save the project
# self.api.captureM()
# self.api.saveProject("../../../projects/test.cwp")
if __name__ == '__main__':
import chipwhisperer.capture.ui.CWCaptureGUI as cwc # Import the ChipWhispererCapture GUI
from chipwhisperer.common.utils.parameter import Parameter # Comment this line if you don't want to use the GUI
Parameter.usePyQtGraph = True # Comment this line if you don't want to use the GUI
api = CWCoreAPI() # Instantiate the API
app = cwc.makeApplication("Capture") # Change the name if you want a different settings scope
gui = cwc.CWCaptureGUI(api) # Comment this line if you don't want to use the GUI
gui.show() # Comment this line if you don't want to use the GUI
api.runScriptClass(UserScript) # Run the User Script (executes "run()" by default)
app.exec_() # Comment this line if you don't want to use the GUI
def main():
# Create the Qt Application
app = makeApplication("Analyzer")
# Create and show the GUI
Parameter.usePyQtGraph = True
window = CWAnalyzerGUI(CWCoreAPI())
window.show()
# Run the main Qt loop
app.exec_()
self.api.setParameter(['Generic Settings', 'Acquisition Settings', 'Number of Traces', 50])
# Throw away first few
self.api.capture1()
self.api.capture1()
# Capture a set of traces and save the project
# self.api.captureM()
# self.api.saveProject("../../../projects/test.cwp")
if __name__ == '__main__':
import chipwhisperer.capture.ui.CWCaptureGUI as cwc # Import the ChipWhispererCapture GUI
from chipwhisperer.common.utils.parameter import Parameter # Comment this line if you don't want to use the GUI
Parameter.usePyQtGraph = True # Comment this line if you don't want to use the GUI
api = CWCoreAPI() # Instantiate the API
app = cwc.makeApplication("Capture") # Change the name if you want a different settings scope
gui = cwc.CWCaptureGUI(api) # Comment this line if you don't want to use the GUI
gui.show() # Comment this line if you don't want to use the GUI
api.runScriptClass(UserScript) # Run the User Script (executes "run()" by default)
app.exec_() # Comment this line if you don't want to use the GUI