Class: Firmware
- Inherits:
-
Object
- Object
- Firmware
- Defined in:
- lib/class/Firmware.rb
Overview
Hardsploit GUI - By Opale Security
www.opale-security.com || www.hardsploit.io
License: GNU General Public License v3
License URI: http://www.gnu.org/licenses/gpl.txt
Instance Method Summary collapse
-
#initialize(firmware) ⇒ Firmware
constructor
A new instance of Firmware.
Constructor Details
#initialize(firmware) ⇒ Firmware
Returns a new instance of Firmware.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/class/Firmware.rb', line 9 def initialize(firmware) unless $currentFirmware == firmware unless $currentFirmware == 'uC' $pgb = .new("Upload firmware :") $pgb.show end base_path = File.(File.dirname(__FILE__)) + '/../Firmwares/FPGA/' case firmware when 'I2C' firmware_path = base_path + 'I2C/I2C_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_I2C_INTERACT.rpd' HardsploitAPI.instance.uploadFirmware(pathFirmware: firmware_path, checkFirmware: false) when 'SPI' firmware_path = base_path + 'SPI/SPI_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SPI_INTERACT.rpd' HardsploitAPI.instance.uploadFirmware(pathFirmware: firmware_path, checkFirmware: false) when 'SPI_SNIFFER' firmware_path = base_path + 'SPI/SPI_SNIFFER/HARDSPLOIT_FIRMWARE_FPGA_SPI_SNIFFER.rpd' HardsploitAPI.instance.uploadFirmware(pathFirmware: firmware_path, checkFirmware: false) when 'PARALLEL' firmware_path = base_path + 'PARALLEL/NO_MUX_PARALLEL_MEMORY/HARDSPLOIT_FIRMWARE_FPGA_NO_MUX_PARALLEL_MEMORY.rpd' HardsploitAPI.instance.uploadFirmware(pathFirmware: firmware_path, checkFirmware: false) when 'SWD' firmware_path = base_path + 'SWD/SWD_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SWD_INTERACT.rpd' HardsploitAPI.instance.uploadFirmware(pathFirmware: firmware_path, checkFirmware: false) when 'UART' firmware_path = base_path + 'UART/UART_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_UART_INTERACT.rpd' HardsploitAPI.instance.uploadFirmware(pathFirmware: firmware_path, checkFirmware: false) when 'uC' msg = Qt::MessageBox.new msg.setWindowTitle("Microcontroller update") msg.setText("Hardsploit must be in bootloader mode and dfu-util package must be installed in order to continue. Proceed ?") msg.setIcon(Qt::MessageBox::Question) msg.setStandardButtons(Qt::MessageBox::Cancel | Qt::MessageBox::Ok) msg.setDefaultButton(Qt::MessageBox::Cancel) if msg.exec == Qt::MessageBox::Ok system("dfu-util -D 0483:df11 -a 0 -s 0x08000000 -R --download #{File.expand_path(File.dirname(__FILE__))}'/../Firmwares/UC/HARDSPLOIT_FIRMWARE_UC.bin'") end end $currentFirmware = firmware unless firmware == 'uC' firmware = "SPI" if firmware == "SPI_SNIFFER" $pgb.close sleep(2) end case firmware when 'PARALLEL', 'SWD', 'UART', 'I2C', 'SPI' # CrossWiring crossvalue = [] for i in 0..63 crossvalue.push i end pin_group = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] Bus.find_by(name: firmware).signalls.each do |s| hardsploit_pin_number = pin_group.index(s.pin[0]) * 8 + s.pin[1].to_i crossvalue[hardsploit_pin_number] = HardsploitAPI.getSignalId(signal: s.name) crossvalue[HardsploitAPI.getSignalId(signal: s.name)] = hardsploit_pin_number end HardsploitAPI.instance.setCrossWiring(value: crossvalue) end rescue Exception => msg ErrorMsg.new.unknown(msg) end |