Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, parent=None):
super(XMEGAProgrammerDialog, self).__init__(parent)
# self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)
self.xmega = XMEGAProgrammer()
self.setWindowTitle("ChipWhisperer-Lite XMEGA Programmer")
layout = QVBoxLayout()
layoutFW = QHBoxLayout()
self.flashLocation = QtFixes.QLineEdit()
flashFileButton = QPushButton("Find")
flashFileButton.clicked.connect(self.findFlash)
layoutFW.addWidget(QLabel("FLASH File"))
layoutFW.addWidget(self.flashLocation)
layoutFW.addWidget(flashFileButton)
layout.addLayout(layoutFW)
self.flashLocation.setText(QSettings().value("xmega-flash-location"))
# Add buttons
readSigBut = QPushButton("Check Signature")
readSigBut.clicked.connect(self.readSignature)
verifyFlashBut = QPushButton("Verify FLASH")
verifyFlashBut.clicked.connect(self.verifyFlash)
verifyFlashBut.setEnabled(False)
progFlashBut = QPushButton("Erase/Program/Verify FLASH")
# along with chipwhisperer. If not, see .
#=================================================
import os.path
import time
from datetime import datetime
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtGui import QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QPlainTextEdit, QFileDialog
from chipwhisperer.common.ui.CWMainGUI import CWMainGUI
from chipwhisperer.capture.api.programmers import AVRProgrammer, XMEGAProgrammer, STM32FProgrammer
from chipwhisperer.common.utils import qt_tweaks as QtFixes
class AVRProgrammerDialog(QtFixes.QDialog):
def __init__(self):
super(AVRProgrammerDialog, self).__init__(CWMainGUI.getInstance())
# self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)
self.avr = AVRProgrammer()
self.setWindowTitle("ChipWhisperer-Lite AVR Programmer")
layout = QVBoxLayout()
layoutFW = QHBoxLayout()
self.flashLocation = QtFixes.QLineEdit()
flashFileButton = QPushButton("Find")
flashFileButton.clicked.connect(self.findFlash)
layoutFW.addWidget(QLabel("FLASH File"))
layoutFW.addWidget(self.flashLocation)
layoutFW.addWidget(flashFileButton)
totalrndstr = ''
for r in range(0, rnds+1):
result = self.model.keyScheduleRounds(key, inpround, r)
str = ["%02x" % t for t in result]
str = (delim[1] + delim[0]).join(str)
str = delim[0] + str
totalrndstr += "%2d: " % r
totalrndstr += str + "\n"
self.keysched.setText(totalrndstr)
except ValueError:
self.outkey.setText("ERR in HEX: %s" % data)
class DesKeyScheduleDialog(QtFixes.QDialog):
def __init__(self, parent=None):
super(DesKeyScheduleDialog, self).__init__(parent)
self.model = DES()
layout = QVBoxLayout()
self.setLayout(layout)
self.indata = QtFixes.QLineEdit("")
self.indata.setFont(QFont("Courier"))
self.keysched = QTextEdit("")
self.keysched.setFont(QFont("Courier"))
self.inprnd = QComboBox()
self.inprnd.currentIndexChanged.connect(self.inTextChanged)
radioBuiltin = QRadioButton("Builtin")
radioRelease = QRadioButton("External (.zip)")
radioDebug = QRadioButton("Debug - no partial reconfig (.bit)")
layoutGB = QHBoxLayout()
layoutGB.addWidget(radioBuiltin)
layoutGB.addWidget(radioRelease)
layoutGB.addWidget(radioDebug)
layoutGB.addStretch(1)
gbFPGAMode.setLayout(layoutGB)
layout.addWidget(gbFPGAMode)
radioBuiltin.clicked.connect(lambda: self.setFPGAMode("builtin"))
radioRelease.clicked.connect(lambda: self.setFPGAMode("zipfile"))
radioDebug.clicked.connect(lambda: self.setFPGAMode("debug"))
layoutFW = QHBoxLayout()
self.firmwareLocation = QtFixes.QLineEdit()
firmwareButton = QPushButton("Find")
firmwareButton.clicked.connect(self.findFirmware)
layoutFW.addWidget(QLabel("USB Firmware"))
layoutFW.addWidget(self.firmwareLocation)
layoutFW.addWidget(firmwareButton)
if hasattr(self.fwLoaderConfig.loader, 'loadFirmware'):
layout.addLayout(layoutFW)
layoutBitZip = QHBoxLayout()
self.bitZipLocation = QtFixes.QLineEdit()
bitZipButton = QPushButton("Find")
bitZipButton.clicked.connect(self.findZipBitstream)
layoutBitZip.addWidget(QLabel("FPGA .zip (Release)"))
layoutBitZip.addWidget(self.bitZipLocation)
layoutBitZip.addWidget(bitZipButton)
self.outmode = QComboBox()
self.outmode.addItem("AABBCC...EEFF", ["", ""])
self.outmode.addItem("AA:BB:CC...EE:FF", ["", ":"])
self.outmode.addItem("AA BB CC...EE FF", ["", " "])
self.outmode.addItem("AA,BB,CC...EE,FF", ["", ","])
self.outmode.addItem("0xAA, 0xBB, 0xCC... 0xEE, 0xFF", ["0x", ", "])
self.outmode.currentIndexChanged.connect(self.inTextChanged)
self.indata = QtFixes.QLineEdit("")
self.indata.setFont(QFont("Courier"))
self.keysched = QTextEdit("")
self.keysched.setFont(QFont("Courier"))
self.outkey = QtFixes.QLineEdit("")
self.outkey.setReadOnly(True)
self.outkey.setFont(QFont("Courier"))
outmodeL = QHBoxLayout()
outmodeL.addWidget(QLabel("Format:"))
outmodeL.addWidget(self.outmode)
outmodeL.addStretch()
self.inprnd = QComboBox()
self.inprnd.currentIndexChanged.connect(self.inTextChanged)
self.setKeyLength(128)
indataL = QHBoxLayout()
indataL.addWidget(QLabel("Key:"))
indataL.addWidget(self.indata)
indataL.addWidget(self.inprnd)
def __init__(self, parent=None):
super(DesKeyScheduleDialog, self).__init__(parent)
self.model = DES()
layout = QVBoxLayout()
self.setLayout(layout)
self.indata = QtFixes.QLineEdit("")
self.indata.setFont(QFont("Courier"))
self.keysched = QTextEdit("")
self.keysched.setFont(QFont("Courier"))
self.inprnd = QComboBox()
self.inprnd.currentIndexChanged.connect(self.inTextChanged)
indataL = QHBoxLayout()
indataL.addWidget(QLabel("Key:"))
indataL.addWidget(self.indata)
indataL.addWidget(QLabel("Round:"))
indataL.addWidget(self.inprnd)
self.indata.textChanged.connect(self.inTextChanged)
gbIndata = QGroupBox("Round Key/Subkey")
def __init__(self):
super(XMEGAProgrammerDialog, self).__init__(CWMainGUI.getInstance())
# self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)
self.xmega = XMEGAProgrammer()
self.setWindowTitle("ChipWhisperer-Lite XMEGA Programmer")
layout = QVBoxLayout()
layoutFW = QHBoxLayout()
self.flashLocation = QtFixes.QLineEdit()
flashFileButton = QPushButton("Find")
flashFileButton.clicked.connect(self.findFlash)
layoutFW.addWidget(QLabel("FLASH File"))
layoutFW.addWidget(self.flashLocation)
layoutFW.addWidget(flashFileButton)
layout.addLayout(layoutFW)
self.flashLocation.setText(QSettings().value("xmega-flash-location"))
# Add buttons
readSigBut = QPushButton("Check Signature")
readSigBut.clicked.connect(self.readSignature)
verifyFlashBut = QPushButton("Verify FLASH")
verifyFlashBut.clicked.connect(self.verifyFlash)
verifyFlashBut.setEnabled(False)
progFlashBut = QPushButton("Erase/Program/Verify FLASH")
for s in settings:
settingsfile.write("%s\n"%s)
settingsfile.close()
def saveAllTraces(self):
self.writeInfo()
def closeAll(self, clearTrace=True, clearText=True, clearKeys=True):
self.saveAllTraces()
self.inf.close()
self.outf.close()
self.wavef.close()
self.keyf.close()
class ImportDPAv3Dialog(QtFixes.QDialog):
def __init__(self, parent=None):
super(ImportDPAv3Dialog, self).__init__(parent)
self.parent = parent
self.setWindowTitle("DPA Contest v3 Trace Format Importer")
layout = QVBoxLayout()
self.setLayout(layout)
### Selection of info.xml to import
fileL = QHBoxLayout()
fileL.addWidget(QLabel("info.xml file:"))
self.fileLE = QtFixes.QLineEdit()
#self.fileLE.setEnabled(False)
fileL.addWidget(self.fileLE)
filePB = QPushButton("Select info.xml")
#
# 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 .
from PySide.QtGui import *
from pyqtgraph.parametertree import ParameterTree
import chipwhisperer.common.utils.qt_tweaks as QtFixes
from chipwhisperer.common.utils.parameter import Parameterized
class CWPreferencesDialog(QtFixes.QDialog):
def __init__(self, parent, settings):
super(CWPreferencesDialog, self).__init__(parent)
self.setWindowTitle("ChipWhisperer Preferences")
self.setMinimumWidth((400 * self.logicalDpiX())//100)
self.setMinimumHeight((350 * self.logicalDpiY())//100)
self._generalTab = GeneralTab(self, settings)
self._windowsTab = WindowTab(self)
self._clearSettingsTab = ClearSettingsTab(self)
tabWidget = QTabWidget()
tabWidget.addTab(self._generalTab, "General")
tabWidget.addTab(self._windowsTab, "Window Layout")
tabWidget.addTab(self._clearSettingsTab, "Clear Settings")
# 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 logging
from PySide.QtCore import *
from PySide.QtGui import *
import chipwhisperer.common.utils.qt_tweaks as QtFixes
import pyqtgraph as pg
class ColorDialog(QtFixes.QDialog):
"""
Simple dialog to pick colours for the trace data.
"""
def __init__(self, colorInt=None, auto=None):
super(ColorDialog, self).__init__()
layout = QVBoxLayout()
self.setLayout(layout)
if colorInt is None:
colorInt = 0
if auto is None:
auto = True
self.cbAuto = QCheckBox("Auto-Increment Persistent Colours")
self.cbAuto.setChecked(auto)