hardsploit_gui 2.3 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +22 -22
 - data/Rakefile +1 -1
 - data/bin/hardsploit_gui +3 -3
 - data/lib/Firmwares/FPGA/I2C/I2C_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_I2C_INTERACT.rpd +0 -0
 - data/lib/Firmwares/FPGA/PARALLEL/NO_MUX_PARALLEL_MEMORY/HARDSPLOIT_FIRMWARE_FPGA_NO_MUX_PARALLEL_MEMORY.rpd +0 -0
 - data/lib/Firmwares/FPGA/SPI/SPI_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SPI_INTERACT.rpd +0 -0
 - data/lib/Firmwares/FPGA/SPI/SPI_SNIFFER/HARDSPLOIT_FIRMWARE_FPGA_SPI_SNIFFER.rpd +0 -0
 - data/lib/Firmwares/FPGA/SWD/SWD_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SWD_INTERACT.rpd +0 -0
 - data/lib/Firmwares/FPGA/UART/UART_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_UART_INTERACT.rpd +0 -0
 - data/lib/Firmwares/FPGA/VersionFPGA.rb +5 -5
 - data/lib/Firmwares/UC/VersionUC.rb +12 -12
 - data/lib/HardsploitAPI/Core/HardsploitAPI.rb +210 -210
 - data/lib/HardsploitAPI/Core/HardsploitAPI_CONSTANT.rb +150 -150
 - data/lib/HardsploitAPI/Core/HardsploitAPI_ERROR.rb +109 -109
 - data/lib/HardsploitAPI/Core/HardsploitAPI_FIRMWARE.rb +305 -305
 - data/lib/HardsploitAPI/Core/HardsploitAPI_PROGRESS.rb +28 -28
 - data/lib/HardsploitAPI/Core/HardsploitAPI_USB_COMMUNICATION.rb +166 -166
 - data/lib/HardsploitAPI/Modules/I2C/HardsploitAPI_I2C.rb +356 -356
 - data/lib/HardsploitAPI/Modules/NO_MUX_PARALLEL_MEMORY/HardsploitAPI_NO_MUX_PARALLEL_MEMORY.rb +206 -206
 - data/lib/HardsploitAPI/Modules/NRF24L01/HardsploitAPI_NRF24L01.rb +306 -306
 - data/lib/HardsploitAPI/Modules/SPI/HardsploitAPI_SPI.rb +340 -340
 - data/lib/HardsploitAPI/Modules/SPI_SNIFFER/HardsploitAPI_SPI_SNIFFER.rb +83 -83
 - data/lib/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD.rb +367 -367
 - data/lib/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD_DEBUG.rb +89 -89
 - data/lib/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD_MEM_AP.rb +61 -61
 - data/lib/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD_STM32.rb +121 -121
 - data/lib/HardsploitAPI/Modules/TEST/HardsploitAPI_TEST_INTERACT.rb +98 -98
 - data/lib/HardsploitAPI/Modules/UART/HardsploitAPI_UART.rb +196 -196
 - data/lib/Hardsploit_gui.rb +96 -96
 - data/lib/LICENSE.txt +674 -674
 - data/lib/README.md +22 -22
 - data/lib/TRADEMARK +2 -2
 - data/lib/class/Chip_editor.rb +304 -304
 - data/lib/class/Chip_management.rb +496 -496
 - data/lib/class/Command_editor.rb +216 -216
 - data/lib/class/Command_table.rb +233 -233
 - data/lib/class/Console.rb +26 -26
 - data/lib/class/ErrorMsg.rb +312 -312
 - data/lib/class/Export.rb +140 -140
 - data/lib/class/Export_manager.rb +124 -124
 - data/lib/class/Firmware.rb +70 -70
 - data/lib/class/Generic_commands.rb +260 -260
 - data/lib/class/{i2c → I2C}/I2c_command.rb +51 -51
 - data/lib/class/{i2c → I2C}/I2c_export.rb +95 -95
 - data/lib/class/{i2c → I2C}/I2c_import.rb +117 -117
 - data/lib/class/{i2c → I2C}/I2c_scanner.rb +114 -114
 - data/lib/class/{i2c → I2C}/I2c_settings.rb +148 -148
 - data/lib/class/Import.rb +193 -193
 - data/lib/class/{parallel → PARALLEL}/Parallel_export.rb +118 -118
 - data/lib/class/{parallel → PARALLEL}/Parallel_import.rb +113 -113
 - data/lib/class/{parallel → PARALLEL}/Parallel_settings.rb +81 -81
 - data/lib/class/Progress_bar.rb +32 -32
 - data/lib/class/{spi → SPI}/Spi_export.rb +108 -108
 - data/lib/class/{spi → SPI}/Spi_import.rb +159 -159
 - data/lib/class/{spi → SPI}/Spi_settings.rb +108 -108
 - data/lib/class/{spi → SPI}/Spi_sniffer.rb +101 -101
 - data/lib/class/Signal_mapper.rb +120 -120
 - data/lib/class/Wire_helper.rb +230 -230
 - data/lib/class/swd/Swd.rb +125 -125
 - data/lib/class/swd/Swd_scanner.rb +121 -121
 - data/lib/class/swd/Swd_settings.rb +76 -76
 - data/lib/class/uart/Uart_baudrate.rb +62 -62
 - data/lib/class/uart/Uart_console.rb +115 -115
 - data/lib/class/uart/Uart_settings.rb +102 -102
 - data/lib/db/associations.rb +138 -138
 - data/lib/db/database.rb +4 -4
 - data/lib/db/development.sqlite3 +0 -0
 - data/lib/db/migrate/004_create_manufacturers.rb +13 -13
 - data/lib/db/migrate/005_create_packages.rb +13 -13
 - data/lib/db/migrate/006_create_chip_types.rb +11 -11
 - data/lib/db/migrate/007_create_buses.rb +11 -11
 - data/lib/db/migrate/008_create_signals.rb +14 -14
 - data/lib/db/migrate/009_create_chips.rb +25 -25
 - data/lib/db/migrate/010_create_commands.rb +21 -21
 - data/lib/db/migrate/011_create_bytes.rb +19 -19
 - data/lib/db/migrate/012_create_i2c_settings.rb +21 -21
 - data/lib/db/migrate/013_create_spi_settings.rb +26 -26
 - data/lib/db/migrate/014_create_parallel_settings.rb +21 -21
 - data/lib/db/migrate/015_create_pins.rb +19 -19
 - data/lib/db/migrate/016_create_uses.rb +17 -17
 - data/lib/db/migrate/017_create_swd_settings.rb +19 -19
 - data/lib/db/migrate/018_create_uart_settings.rb +22 -22
 - data/lib/db/schema.rb +157 -157
 - data/lib/db/seeds.rb +161 -161
 - data/lib/gui/gui_chip_editor.rb +349 -349
 - data/lib/gui/gui_chip_management.rb +377 -377
 - data/lib/gui/gui_command_editor.rb +219 -219
 - data/lib/gui/gui_export.rb +132 -132
 - data/lib/gui/gui_export_manager.rb +93 -93
 - data/lib/gui/gui_generic_commands.rb +202 -202
 - data/lib/gui/gui_generic_export.rb +164 -164
 - data/lib/gui/gui_generic_import.rb +142 -142
 - data/lib/gui/gui_i2c_command.rb +116 -116
 - data/lib/gui/gui_i2c_settings.rb +230 -230
 - data/lib/gui/gui_import.rb +131 -131
 - data/lib/gui/gui_parallel_settings.rb +195 -195
 - data/lib/gui/gui_progress_bar.rb +85 -85
 - data/lib/gui/gui_signal_mapper.rb +121 -121
 - data/lib/gui/gui_signal_scanner.rb +146 -146
 - data/lib/gui/gui_spi_import.rb +126 -126
 - data/lib/gui/gui_spi_settings.rb +313 -313
 - data/lib/gui/gui_spi_sniffer.rb +112 -112
 - data/lib/gui/gui_swd_settings.rb +166 -166
 - data/lib/gui/gui_uart_baudrate.rb +114 -114
 - data/lib/gui/gui_uart_console.rb +164 -164
 - data/lib/gui/gui_uart_settings.rb +243 -243
 - data/lib/gui/gui_wire_helper.rb +99 -99
 - data/lib/gui_designer/gui_chip_editor.ui +549 -549
 - data/lib/gui_designer/gui_chip_management.ui +886 -886
 - data/lib/gui_designer/gui_command_editor.ui +350 -350
 - data/lib/gui_designer/gui_export.ui +171 -171
 - data/lib/gui_designer/gui_export_manager.ui +115 -115
 - data/lib/gui_designer/gui_generic_commands.ui +342 -342
 - data/lib/gui_designer/gui_generic_export.ui +202 -202
 - data/lib/gui_designer/gui_generic_import.ui +165 -165
 - data/lib/gui_designer/gui_i2c_command.ui +148 -148
 - data/lib/gui_designer/gui_i2c_settings.ui +292 -292
 - data/lib/gui_designer/gui_import.ui +168 -168
 - data/lib/gui_designer/gui_parallel_settings.ui +247 -247
 - data/lib/gui_designer/gui_progress_bar.ui +86 -86
 - data/lib/gui_designer/gui_signal_mapper.ui +179 -179
 - data/lib/gui_designer/gui_signal_scanner.ui +261 -261
 - data/lib/gui_designer/gui_spi_settings.ui +446 -446
 - data/lib/gui_designer/gui_spi_sniffer.ui +156 -156
 - data/lib/gui_designer/gui_swd_settings.ui +189 -189
 - data/lib/gui_designer/gui_uart_baudrate.ui +161 -161
 - data/lib/gui_designer/gui_uart_console.ui +284 -284
 - data/lib/gui_designer/gui_uart_settings.ui +280 -280
 - data/lib/gui_designer/gui_wire_helper.ui +117 -117
 - data/lib/images/search.png +0 -0
 - data/lib/logs/error.log +0 -63
 - data/lib/models/bus.rb +19 -19
 - data/lib/models/byte.rb +29 -29
 - data/lib/models/chip.rb +41 -41
 - data/lib/models/chip_type.rb +14 -14
 - data/lib/models/command.rb +20 -20
 - data/lib/models/i2c_setting.rb +41 -41
 - data/lib/models/manufacturer.rb +14 -14
 - data/lib/models/package.rb +26 -26
 - data/lib/models/parallel_setting.rb +37 -37
 - data/lib/models/pin.rb +14 -14
 - data/lib/models/signall.rb +20 -20
 - data/lib/models/spi_setting.rb +67 -67
 - data/lib/models/swd_setting.rb +25 -25
 - data/lib/models/uart_setting.rb +52 -52
 - data/lib/models/use.rb +6 -6
 - data/lib/startHardsploit.rb +10 -10
 - metadata +14 -14
 
| 
         @@ -1,76 +1,76 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #===================================================
         
     | 
| 
       2 
     | 
    
         
            -
            #  Hardsploit GUI - By Opale Security
         
     | 
| 
       3 
     | 
    
         
            -
            #  www.opale-security.com || www.hardsploit.io
         
     | 
| 
       4 
     | 
    
         
            -
            #  License: GNU General Public License v3
         
     | 
| 
       5 
     | 
    
         
            -
            #  License URI: http://www.gnu.org/licenses/gpl.txt
         
     | 
| 
       6 
     | 
    
         
            -
            #===================================================
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            require_relative '../../gui/gui_swd_settings'
         
     | 
| 
       9 
     | 
    
         
            -
            class Swd_settings < Qt::Widget
         
     | 
| 
       10 
     | 
    
         
            -
              slots 'save_settings()'
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              def initialize(chip)
         
     | 
| 
       13 
     | 
    
         
            -
                super()
         
     | 
| 
       14 
     | 
    
         
            -
                @view = Ui_Swd_settings.new
         
     | 
| 
       15 
     | 
    
         
            -
                centerWindow(self)
         
     | 
| 
       16 
     | 
    
         
            -
                @view.setupUi(self)
         
     | 
| 
       17 
     | 
    
         
            -
                @view.lbl_chip.setText(chip.reference)
         
     | 
| 
       18 
     | 
    
         
            -
                inputRestrict(@view.lie_cpu_id_address,     4)
         
     | 
| 
       19 
     | 
    
         
            -
                inputRestrict(@view.lie_device_id_address,  4)
         
     | 
| 
       20 
     | 
    
         
            -
                inputRestrict(@view.lie_size_address,       4)
         
     | 
| 
       21 
     | 
    
         
            -
                inputRestrict(@view.lie_start_address,      4)
         
     | 
| 
       22 
     | 
    
         
            -
                @chip = chip
         
     | 
| 
       23 
     | 
    
         
            -
                feed_settings_form unless chip.swd_setting.nil?
         
     | 
| 
       24 
     | 
    
         
            -
              end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
              def save_settings
         
     | 
| 
       27 
     | 
    
         
            -
                @chip.swd_setting.nil? ? create : update
         
     | 
| 
       28 
     | 
    
         
            -
                @chip.reload
         
     | 
| 
       29 
     | 
    
         
            -
              rescue Exception => msg
         
     | 
| 
       30 
     | 
    
         
            -
                ErrorMsg.new.unknown(msg)
         
     | 
| 
       31 
     | 
    
         
            -
              end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
              def feed_settings_form
         
     | 
| 
       34 
     | 
    
         
            -
                @view.lie_cpu_id_address.setText(@chip.swd_setting.cpu_id_address)
         
     | 
| 
       35 
     | 
    
         
            -
                @view.lie_device_id_address.setText(@chip.swd_setting.device_id_address)
         
     | 
| 
       36 
     | 
    
         
            -
                @view.lie_size_address.setText(@chip.swd_setting.memory_size_address)
         
     | 
| 
       37 
     | 
    
         
            -
                @view.lie_start_address.setText(@chip.swd_setting.memory_start_address)
         
     | 
| 
       38 
     | 
    
         
            -
              rescue Exception => msg
         
     | 
| 
       39 
     | 
    
         
            -
                ErrorMsg.new.unknown(msg)
         
     | 
| 
       40 
     | 
    
         
            -
              end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
              def create
         
     | 
| 
       43 
     | 
    
         
            -
                chip_settings = SwdSetting.create(
         
     | 
| 
       44 
     | 
    
         
            -
                  cpu_id_address:       @view.lie_cpu_id_address.text,
         
     | 
| 
       45 
     | 
    
         
            -
                  device_id_address:    @view.lie_device_id_address.text,
         
     | 
| 
       46 
     | 
    
         
            -
                  memory_size_address:  @view.lie_size_address.text,
         
     | 
| 
       47 
     | 
    
         
            -
                  memory_start_address: @view.lie_start_address.text,
         
     | 
| 
       48 
     | 
    
         
            -
                  chip_id:              @chip.id
         
     | 
| 
       49 
     | 
    
         
            -
                )
         
     | 
| 
       50 
     | 
    
         
            -
                unless check_for_errors(chip_settings)
         
     | 
| 
       51 
     | 
    
         
            -
                  Qt::MessageBox.new(
         
     | 
| 
       52 
     | 
    
         
            -
                    Qt::MessageBox::Information,
         
     | 
| 
       53 
     | 
    
         
            -
                    'Succes',
         
     | 
| 
       54 
     | 
    
         
            -
                    'SWD settings saved'
         
     | 
| 
       55 
     | 
    
         
            -
                  ).exec
         
     | 
| 
       56 
     | 
    
         
            -
                  close
         
     | 
| 
       57 
     | 
    
         
            -
                end
         
     | 
| 
       58 
     | 
    
         
            -
              end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
              def update
         
     | 
| 
       61 
     | 
    
         
            -
                @chip.swd_setting.update(
         
     | 
| 
       62 
     | 
    
         
            -
                  cpu_id_address:       @view.lie_cpu_id_address.text,
         
     | 
| 
       63 
     | 
    
         
            -
                  device_id_address:    @view.lie_device_id_address.text,
         
     | 
| 
       64 
     | 
    
         
            -
                  memory_size_address:  @view.lie_size_address.text,
         
     | 
| 
       65 
     | 
    
         
            -
                  memory_start_address: @view.lie_start_address.text,
         
     | 
| 
       66 
     | 
    
         
            -
                )
         
     | 
| 
       67 
     | 
    
         
            -
                unless check_for_errors(@chip.swd_setting)
         
     | 
| 
       68 
     | 
    
         
            -
                  Qt::MessageBox.new(
         
     | 
| 
       69 
     | 
    
         
            -
                    Qt::MessageBox::Information,
         
     | 
| 
       70 
     | 
    
         
            -
                    'Succes',
         
     | 
| 
       71 
     | 
    
         
            -
                    'SWD settings updated'
         
     | 
| 
       72 
     | 
    
         
            -
                  ).exec
         
     | 
| 
       73 
     | 
    
         
            -
                  close
         
     | 
| 
       74 
     | 
    
         
            -
                end
         
     | 
| 
       75 
     | 
    
         
            -
              end
         
     | 
| 
       76 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            #===================================================
         
     | 
| 
      
 2 
     | 
    
         
            +
            #  Hardsploit GUI - By Opale Security
         
     | 
| 
      
 3 
     | 
    
         
            +
            #  www.opale-security.com || www.hardsploit.io
         
     | 
| 
      
 4 
     | 
    
         
            +
            #  License: GNU General Public License v3
         
     | 
| 
      
 5 
     | 
    
         
            +
            #  License URI: http://www.gnu.org/licenses/gpl.txt
         
     | 
| 
      
 6 
     | 
    
         
            +
            #===================================================
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative '../../gui/gui_swd_settings'
         
     | 
| 
      
 9 
     | 
    
         
            +
            class Swd_settings < Qt::Widget
         
     | 
| 
      
 10 
     | 
    
         
            +
              slots 'save_settings()'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def initialize(chip)
         
     | 
| 
      
 13 
     | 
    
         
            +
                super()
         
     | 
| 
      
 14 
     | 
    
         
            +
                @view = Ui_Swd_settings.new
         
     | 
| 
      
 15 
     | 
    
         
            +
                centerWindow(self)
         
     | 
| 
      
 16 
     | 
    
         
            +
                @view.setupUi(self)
         
     | 
| 
      
 17 
     | 
    
         
            +
                @view.lbl_chip.setText(chip.reference)
         
     | 
| 
      
 18 
     | 
    
         
            +
                inputRestrict(@view.lie_cpu_id_address,     4)
         
     | 
| 
      
 19 
     | 
    
         
            +
                inputRestrict(@view.lie_device_id_address,  4)
         
     | 
| 
      
 20 
     | 
    
         
            +
                inputRestrict(@view.lie_size_address,       4)
         
     | 
| 
      
 21 
     | 
    
         
            +
                inputRestrict(@view.lie_start_address,      4)
         
     | 
| 
      
 22 
     | 
    
         
            +
                @chip = chip
         
     | 
| 
      
 23 
     | 
    
         
            +
                feed_settings_form unless chip.swd_setting.nil?
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def save_settings
         
     | 
| 
      
 27 
     | 
    
         
            +
                @chip.swd_setting.nil? ? create : update
         
     | 
| 
      
 28 
     | 
    
         
            +
                @chip.reload
         
     | 
| 
      
 29 
     | 
    
         
            +
              rescue Exception => msg
         
     | 
| 
      
 30 
     | 
    
         
            +
                ErrorMsg.new.unknown(msg)
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              def feed_settings_form
         
     | 
| 
      
 34 
     | 
    
         
            +
                @view.lie_cpu_id_address.setText(@chip.swd_setting.cpu_id_address)
         
     | 
| 
      
 35 
     | 
    
         
            +
                @view.lie_device_id_address.setText(@chip.swd_setting.device_id_address)
         
     | 
| 
      
 36 
     | 
    
         
            +
                @view.lie_size_address.setText(@chip.swd_setting.memory_size_address)
         
     | 
| 
      
 37 
     | 
    
         
            +
                @view.lie_start_address.setText(@chip.swd_setting.memory_start_address)
         
     | 
| 
      
 38 
     | 
    
         
            +
              rescue Exception => msg
         
     | 
| 
      
 39 
     | 
    
         
            +
                ErrorMsg.new.unknown(msg)
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              def create
         
     | 
| 
      
 43 
     | 
    
         
            +
                chip_settings = SwdSetting.create(
         
     | 
| 
      
 44 
     | 
    
         
            +
                  cpu_id_address:       @view.lie_cpu_id_address.text,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  device_id_address:    @view.lie_device_id_address.text,
         
     | 
| 
      
 46 
     | 
    
         
            +
                  memory_size_address:  @view.lie_size_address.text,
         
     | 
| 
      
 47 
     | 
    
         
            +
                  memory_start_address: @view.lie_start_address.text,
         
     | 
| 
      
 48 
     | 
    
         
            +
                  chip_id:              @chip.id
         
     | 
| 
      
 49 
     | 
    
         
            +
                )
         
     | 
| 
      
 50 
     | 
    
         
            +
                unless check_for_errors(chip_settings)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  Qt::MessageBox.new(
         
     | 
| 
      
 52 
     | 
    
         
            +
                    Qt::MessageBox::Information,
         
     | 
| 
      
 53 
     | 
    
         
            +
                    'Succes',
         
     | 
| 
      
 54 
     | 
    
         
            +
                    'SWD settings saved'
         
     | 
| 
      
 55 
     | 
    
         
            +
                  ).exec
         
     | 
| 
      
 56 
     | 
    
         
            +
                  close
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
              def update
         
     | 
| 
      
 61 
     | 
    
         
            +
                @chip.swd_setting.update(
         
     | 
| 
      
 62 
     | 
    
         
            +
                  cpu_id_address:       @view.lie_cpu_id_address.text,
         
     | 
| 
      
 63 
     | 
    
         
            +
                  device_id_address:    @view.lie_device_id_address.text,
         
     | 
| 
      
 64 
     | 
    
         
            +
                  memory_size_address:  @view.lie_size_address.text,
         
     | 
| 
      
 65 
     | 
    
         
            +
                  memory_start_address: @view.lie_start_address.text,
         
     | 
| 
      
 66 
     | 
    
         
            +
                )
         
     | 
| 
      
 67 
     | 
    
         
            +
                unless check_for_errors(@chip.swd_setting)
         
     | 
| 
      
 68 
     | 
    
         
            +
                  Qt::MessageBox.new(
         
     | 
| 
      
 69 
     | 
    
         
            +
                    Qt::MessageBox::Information,
         
     | 
| 
      
 70 
     | 
    
         
            +
                    'Succes',
         
     | 
| 
      
 71 
     | 
    
         
            +
                    'SWD settings updated'
         
     | 
| 
      
 72 
     | 
    
         
            +
                  ).exec
         
     | 
| 
      
 73 
     | 
    
         
            +
                  close
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
      
 75 
     | 
    
         
            +
              end
         
     | 
| 
      
 76 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,62 +1,62 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #===================================================
         
     | 
| 
       2 
     | 
    
         
            -
            #  Hardsploit GUI - By Opale Security
         
     | 
| 
       3 
     | 
    
         
            -
            #  www.opale-security.com || www.hardsploit.io
         
     | 
| 
       4 
     | 
    
         
            -
            #  License: GNU General Public License v3
         
     | 
| 
       5 
     | 
    
         
            -
            #  License URI: http://www.gnu.org/licenses/gpl.txt
         
     | 
| 
       6 
     | 
    
         
            -
            #===================================================
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            require_relative '../../gui/gui_uart_baudrate'
         
     | 
| 
       9 
     | 
    
         
            -
            require_relative '../../HardsploitAPI/Modules/UART/HardsploitAPI_UART'
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            class Uart_baudrate < Qt::Widget
         
     | 
| 
       12 
     | 
    
         
            -
              slots 'start_detect()'
         
     | 
| 
       13 
     | 
    
         
            -
              slots 'stop_detect()'
         
     | 
| 
       14 
     | 
    
         
            -
              slots 'copy()'
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              def initialize(parent_view)
         
     | 
| 
       17 
     | 
    
         
            -
                super()
         
     | 
| 
       18 
     | 
    
         
            -
                Firmware.new('UART')
         
     | 
| 
       19 
     | 
    
         
            -
                @view = Ui_Uart_baudrate.new
         
     | 
| 
       20 
     | 
    
         
            -
                centerWindow(self)
         
     | 
| 
       21 
     | 
    
         
            -
                @view.setupUi(self)
         
     | 
| 
       22 
     | 
    
         
            -
                @parent_view = parent_view
         
     | 
| 
       23 
     | 
    
         
            -
              end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              def start_detect
         
     | 
| 
       26 
     | 
    
         
            -
                @view.btn_start.setEnabled(false)
         
     | 
| 
       27 
     | 
    
         
            -
                $app.processEvents
         
     | 
| 
       28 
     | 
    
         
            -
                @uart = HardsploitAPI_UART.new(
         
     | 
| 
       29 
     | 
    
         
            -
                  baud_rate:        115200,
         
     | 
| 
       30 
     | 
    
         
            -
                  word_width:       8,
         
     | 
| 
       31 
     | 
    
         
            -
                  use_parity_bit:   0,
         
     | 
| 
       32 
     | 
    
         
            -
                  parity_type:      0,
         
     | 
| 
       33 
     | 
    
         
            -
                  nb_stop_bits:     1,
         
     | 
| 
       34 
     | 
    
         
            -
                  idle_line_level:  1
         
     | 
| 
       35 
     | 
    
         
            -
                )
         
     | 
| 
       36 
     | 
    
         
            -
                @uart.enableMeasureBaudRate
         
     | 
| 
       37 
     | 
    
         
            -
                @view.btn_stop.setEnabled(true)
         
     | 
| 
       38 
     | 
    
         
            -
              end
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
              def stop_detect
         
     | 
| 
       41 
     | 
    
         
            -
                @view.btn_stop.setEnabled(false)
         
     | 
| 
       42 
     | 
    
         
            -
                @baudrate = @uart.measureBaudRate
         
     | 
| 
       43 
     | 
    
         
            -
                @uart.disableMeasureBaudRate
         
     | 
| 
       44 
     | 
    
         
            -
                @view.btn_start.setEnabled(true)
         
     | 
| 
       45 
     | 
    
         
            -
                unless @baudrate.zero?
         
     | 
| 
       46 
     | 
    
         
            -
                  @view.lbl_baudrate.setText("Baud rate detected: #{@baudrate} Hz")
         
     | 
| 
       47 
     | 
    
         
            -
                else
         
     | 
| 
       48 
     | 
    
         
            -
                  @view.lbl_baudrate.setText("Baud rate detected: None.")
         
     | 
| 
       49 
     | 
    
         
            -
                end
         
     | 
| 
       50 
     | 
    
         
            -
              rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
         
     | 
| 
       51 
     | 
    
         
            -
            		ErrorMsg.new.hardsploit_not_found
         
     | 
| 
       52 
     | 
    
         
            -
              rescue HardsploitAPI::ERROR::USB_ERROR
         
     | 
| 
       53 
     | 
    
         
            -
            	  ErrorMsg.new.usb_error
         
     | 
| 
       54 
     | 
    
         
            -
              rescue Exception => msg
         
     | 
| 
       55 
     | 
    
         
            -
                ErrorMsg.new.unknown(msg)
         
     | 
| 
       56 
     | 
    
         
            -
              end
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
              def copy
         
     | 
| 
       59 
     | 
    
         
            -
                @parent_view.lie_baud_rate.setText(@baudrate.to_s)
         
     | 
| 
       60 
     | 
    
         
            -
                close
         
     | 
| 
       61 
     | 
    
         
            -
              end
         
     | 
| 
       62 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            #===================================================
         
     | 
| 
      
 2 
     | 
    
         
            +
            #  Hardsploit GUI - By Opale Security
         
     | 
| 
      
 3 
     | 
    
         
            +
            #  www.opale-security.com || www.hardsploit.io
         
     | 
| 
      
 4 
     | 
    
         
            +
            #  License: GNU General Public License v3
         
     | 
| 
      
 5 
     | 
    
         
            +
            #  License URI: http://www.gnu.org/licenses/gpl.txt
         
     | 
| 
      
 6 
     | 
    
         
            +
            #===================================================
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative '../../gui/gui_uart_baudrate'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_relative '../../HardsploitAPI/Modules/UART/HardsploitAPI_UART'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            class Uart_baudrate < Qt::Widget
         
     | 
| 
      
 12 
     | 
    
         
            +
              slots 'start_detect()'
         
     | 
| 
      
 13 
     | 
    
         
            +
              slots 'stop_detect()'
         
     | 
| 
      
 14 
     | 
    
         
            +
              slots 'copy()'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              def initialize(parent_view)
         
     | 
| 
      
 17 
     | 
    
         
            +
                super()
         
     | 
| 
      
 18 
     | 
    
         
            +
                Firmware.new('UART')
         
     | 
| 
      
 19 
     | 
    
         
            +
                @view = Ui_Uart_baudrate.new
         
     | 
| 
      
 20 
     | 
    
         
            +
                centerWindow(self)
         
     | 
| 
      
 21 
     | 
    
         
            +
                @view.setupUi(self)
         
     | 
| 
      
 22 
     | 
    
         
            +
                @parent_view = parent_view
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              def start_detect
         
     | 
| 
      
 26 
     | 
    
         
            +
                @view.btn_start.setEnabled(false)
         
     | 
| 
      
 27 
     | 
    
         
            +
                $app.processEvents
         
     | 
| 
      
 28 
     | 
    
         
            +
                @uart = HardsploitAPI_UART.new(
         
     | 
| 
      
 29 
     | 
    
         
            +
                  baud_rate:        115200,
         
     | 
| 
      
 30 
     | 
    
         
            +
                  word_width:       8,
         
     | 
| 
      
 31 
     | 
    
         
            +
                  use_parity_bit:   0,
         
     | 
| 
      
 32 
     | 
    
         
            +
                  parity_type:      0,
         
     | 
| 
      
 33 
     | 
    
         
            +
                  nb_stop_bits:     1,
         
     | 
| 
      
 34 
     | 
    
         
            +
                  idle_line_level:  1
         
     | 
| 
      
 35 
     | 
    
         
            +
                )
         
     | 
| 
      
 36 
     | 
    
         
            +
                @uart.enableMeasureBaudRate
         
     | 
| 
      
 37 
     | 
    
         
            +
                @view.btn_stop.setEnabled(true)
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              def stop_detect
         
     | 
| 
      
 41 
     | 
    
         
            +
                @view.btn_stop.setEnabled(false)
         
     | 
| 
      
 42 
     | 
    
         
            +
                @baudrate = @uart.measureBaudRate
         
     | 
| 
      
 43 
     | 
    
         
            +
                @uart.disableMeasureBaudRate
         
     | 
| 
      
 44 
     | 
    
         
            +
                @view.btn_start.setEnabled(true)
         
     | 
| 
      
 45 
     | 
    
         
            +
                unless @baudrate.zero?
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @view.lbl_baudrate.setText("Baud rate detected: #{@baudrate} Hz")
         
     | 
| 
      
 47 
     | 
    
         
            +
                else
         
     | 
| 
      
 48 
     | 
    
         
            +
                  @view.lbl_baudrate.setText("Baud rate detected: None.")
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
              rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
         
     | 
| 
      
 51 
     | 
    
         
            +
            		ErrorMsg.new.hardsploit_not_found
         
     | 
| 
      
 52 
     | 
    
         
            +
              rescue HardsploitAPI::ERROR::USB_ERROR
         
     | 
| 
      
 53 
     | 
    
         
            +
            	  ErrorMsg.new.usb_error
         
     | 
| 
      
 54 
     | 
    
         
            +
              rescue Exception => msg
         
     | 
| 
      
 55 
     | 
    
         
            +
                ErrorMsg.new.unknown(msg)
         
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              def copy
         
     | 
| 
      
 59 
     | 
    
         
            +
                @parent_view.lie_baud_rate.setText(@baudrate.to_s)
         
     | 
| 
      
 60 
     | 
    
         
            +
                close
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
      
 62 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,115 +1,115 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #===================================================
         
     | 
| 
       2 
     | 
    
         
            -
            #  Hardsploit API - By Opale Security
         
     | 
| 
       3 
     | 
    
         
            -
            #  www.opale-security.com || www.hardsploit.io
         
     | 
| 
       4 
     | 
    
         
            -
            #  License: GNU General Public License v3
         
     | 
| 
       5 
     | 
    
         
            -
            #  License URI: http://www.gnu.org/licenses/gpl.txt
         
     | 
| 
       6 
     | 
    
         
            -
            #===================================================
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            require_relative '../../gui/gui_uart_console'
         
     | 
| 
       9 
     | 
    
         
            -
            require_relative '../../gui/gui_uart_settings'
         
     | 
| 
       10 
     | 
    
         
            -
            require_relative '../../HardsploitAPI/Modules/UART/HardsploitAPI_UART'
         
     | 
| 
       11 
     | 
    
         
            -
            class Uart_console < Qt::Widget
         
     | 
| 
       12 
     | 
    
         
            -
              slots 'send()'
         
     | 
| 
       13 
     | 
    
         
            -
              slots 'update()'
         
     | 
| 
       14 
     | 
    
         
            -
              slots 'connect()'
         
     | 
| 
       15 
     | 
    
         
            -
              slots 'disconnect()'
         
     | 
| 
       16 
     | 
    
         
            -
              slots 'clear_console()'
         
     | 
| 
       17 
     | 
    
         
            -
              slots 'open_settings()'
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
              def initialize(chip)
         
     | 
| 
       20 
     | 
    
         
            -
                super()
         
     | 
| 
       21 
     | 
    
         
            -
                Firmware.new('UART')
         
     | 
| 
       22 
     | 
    
         
            -
                @view = Ui_Uart_console.new
         
     | 
| 
       23 
     | 
    
         
            -
                centerWindow(self)
         
     | 
| 
       24 
     | 
    
         
            -
                @view.setupUi(self)
         
     | 
| 
       25 
     | 
    
         
            -
                @view.lbl_chip.setText(chip.reference)
         
     | 
| 
       26 
     | 
    
         
            -
                @chip = chip
         
     | 
| 
       27 
     | 
    
         
            -
                @data = ''
         
     | 
| 
       28 
     | 
    
         
            -
              end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              def closeEvent(event)
         
     | 
| 
       31 
     | 
    
         
            -
                @timer.killTimer(@timer.timerId) unless @timer.nil?
         
     | 
| 
       32 
     | 
    
         
            -
              end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
              def keyPressEvent(event)
         
     | 
| 
       35 
     | 
    
         
            -
                send if event.key() == Qt::Key_Enter or event.key() == Qt::Key_Return
         
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
              def connect
         
     | 
| 
       39 
     | 
    
         
            -
                @uart = HardsploitAPI_UART.new(
         
     | 
| 
       40 
     | 
    
         
            -
                  baud_rate:        @chip.uart_setting.baud_rate,
         
     | 
| 
       41 
     | 
    
         
            -
                  word_width:       @chip.uart_setting.word_size,
         
     | 
| 
       42 
     | 
    
         
            -
                  use_parity_bit:   @chip.uart_setting.parity_bit,
         
     | 
| 
       43 
     | 
    
         
            -
                  parity_type:      @chip.uart_setting.parity_type,
         
     | 
| 
       44 
     | 
    
         
            -
                  nb_stop_bits:     @chip.uart_setting.stop_bits_nbr,
         
     | 
| 
       45 
     | 
    
         
            -
                  idle_line_level:  @chip.uart_setting.idle_line
         
     | 
| 
       46 
     | 
    
         
            -
                )
         
     | 
| 
       47 
     | 
    
         
            -
                @timer = Qt::Timer.new
         
     | 
| 
       48 
     | 
    
         
            -
                Qt::Object.connect(@timer, SIGNAL('timeout()'), self, SLOT('update()'))
         
     | 
| 
       49 
     | 
    
         
            -
                @timer.start(100)
         
     | 
| 
       50 
     | 
    
         
            -
                @data << 'Listening and ready to go !' + 0x0d.chr
         
     | 
| 
       51 
     | 
    
         
            -
                @view.console.setPlainText(@data)
         
     | 
| 
       52 
     | 
    
         
            -
                scroll_down
         
     | 
| 
       53 
     | 
    
         
            -
                sender.setEnabled(false)
         
     | 
| 
       54 
     | 
    
         
            -
                @view.btn_disconnect.setEnabled(true)
         
     | 
| 
       55 
     | 
    
         
            -
              end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
              def disconnect
         
     | 
| 
       58 
     | 
    
         
            -
                @timer.killTimer(@timer.timerId)
         
     | 
| 
       59 
     | 
    
         
            -
                @data << 'Disconnected' + 0x0d.chr
         
     | 
| 
       60 
     | 
    
         
            -
                @view.console.setPlainText(@data)
         
     | 
| 
       61 
     | 
    
         
            -
                scroll_down
         
     | 
| 
       62 
     | 
    
         
            -
                sender.setEnabled(false)
         
     | 
| 
       63 
     | 
    
         
            -
                @view.btn_connect.setEnabled(true)
         
     | 
| 
       64 
     | 
    
         
            -
              end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
              def send
         
     | 
| 
       67 
     | 
    
         
            -
                return false if @uart.nil? or @timer.nil?
         
     | 
| 
       68 
     | 
    
         
            -
                return ErrorMsg.new.ascii_only unless @view.lie_cmd.text.ascii_only?
         
     | 
| 
       69 
     | 
    
         
            -
                packet = []
         
     | 
| 
       70 
     | 
    
         
            -
                @view.lie_cmd.text.each_byte do |x|
         
     | 
| 
       71 
     | 
    
         
            -
                  packet.push x
         
     | 
| 
       72 
     | 
    
         
            -
                end
         
     | 
| 
       73 
     | 
    
         
            -
                packet.push 13 if @chip.uart_setting.return_type == 0
         
     | 
| 
       74 
     | 
    
         
            -
                packet.push 10 if @chip.uart_setting.return_type == 1
         
     | 
| 
       75 
     | 
    
         
            -
                if @chip.uart_setting.return_type == 2
         
     | 
| 
       76 
     | 
    
         
            -
                  packet.push 13
         
     | 
| 
       77 
     | 
    
         
            -
                  packet.push 10
         
     | 
| 
       78 
     | 
    
         
            -
                end
         
     | 
| 
       79 
     | 
    
         
            -
                @view.lie_cmd.clear
         
     | 
| 
       80 
     | 
    
         
            -
            		@uart.write(payload: packet)
         
     | 
| 
       81 
     | 
    
         
            -
              #Rescue
         
     | 
| 
       82 
     | 
    
         
            -
              end
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
              def update
         
     | 
| 
       85 
     | 
    
         
            -
                received = @uart.sendAndReceived.collect{|i| i.chr}
         
     | 
| 
       86 
     | 
    
         
            -
                unless received.empty?
         
     | 
| 
       87 
     | 
    
         
            -
                  @data << "#{received.join('')}"
         
     | 
| 
       88 
     | 
    
         
            -
                  @view.console.setPlainText(@data)
         
     | 
| 
       89 
     | 
    
         
            -
                end
         
     | 
| 
       90 
     | 
    
         
            -
                scroll_down
         
     | 
| 
       91 
     | 
    
         
            -
              rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
         
     | 
| 
       92 
     | 
    
         
            -
            		ErrorMsg.new.hardsploit_not_found
         
     | 
| 
       93 
     | 
    
         
            -
              rescue HardsploitAPI::ERROR::USB_ERROR
         
     | 
| 
       94 
     | 
    
         
            -
            	  ErrorMsg.new.usb_error
         
     | 
| 
       95 
     | 
    
         
            -
              rescue Exception => msg
         
     | 
| 
       96 
     | 
    
         
            -
                ErrorMsg.new.unknown(msg)
         
     | 
| 
       97 
     | 
    
         
            -
              end
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
              def clear_console
         
     | 
| 
       100 
     | 
    
         
            -
                @view.console.clear
         
     | 
| 
       101 
     | 
    
         
            -
                @data = ''
         
     | 
| 
       102 
     | 
    
         
            -
              end
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
              def open_settings
         
     | 
| 
       105 
     | 
    
         
            -
                settingsUART = Uart_settings.new(@chip)
         
     | 
| 
       106 
     | 
    
         
            -
                settingsUART.setWindowModality(Qt::ApplicationModal)
         
     | 
| 
       107 
     | 
    
         
            -
                settingsUART.show
         
     | 
| 
       108 
     | 
    
         
            -
              end
         
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
              def scroll_down
         
     | 
| 
       111 
     | 
    
         
            -
                sb = Qt::ScrollBar.new
         
     | 
| 
       112 
     | 
    
         
            -
                sb = @view.console.verticalScrollBar
         
     | 
| 
       113 
     | 
    
         
            -
                sb.setValue(sb.maximum())
         
     | 
| 
       114 
     | 
    
         
            -
              end
         
     | 
| 
       115 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            #===================================================
         
     | 
| 
      
 2 
     | 
    
         
            +
            #  Hardsploit API - By Opale Security
         
     | 
| 
      
 3 
     | 
    
         
            +
            #  www.opale-security.com || www.hardsploit.io
         
     | 
| 
      
 4 
     | 
    
         
            +
            #  License: GNU General Public License v3
         
     | 
| 
      
 5 
     | 
    
         
            +
            #  License URI: http://www.gnu.org/licenses/gpl.txt
         
     | 
| 
      
 6 
     | 
    
         
            +
            #===================================================
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative '../../gui/gui_uart_console'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_relative '../../gui/gui_uart_settings'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require_relative '../../HardsploitAPI/Modules/UART/HardsploitAPI_UART'
         
     | 
| 
      
 11 
     | 
    
         
            +
            class Uart_console < Qt::Widget
         
     | 
| 
      
 12 
     | 
    
         
            +
              slots 'send()'
         
     | 
| 
      
 13 
     | 
    
         
            +
              slots 'update()'
         
     | 
| 
      
 14 
     | 
    
         
            +
              slots 'connect()'
         
     | 
| 
      
 15 
     | 
    
         
            +
              slots 'disconnect()'
         
     | 
| 
      
 16 
     | 
    
         
            +
              slots 'clear_console()'
         
     | 
| 
      
 17 
     | 
    
         
            +
              slots 'open_settings()'
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              def initialize(chip)
         
     | 
| 
      
 20 
     | 
    
         
            +
                super()
         
     | 
| 
      
 21 
     | 
    
         
            +
                Firmware.new('UART')
         
     | 
| 
      
 22 
     | 
    
         
            +
                @view = Ui_Uart_console.new
         
     | 
| 
      
 23 
     | 
    
         
            +
                centerWindow(self)
         
     | 
| 
      
 24 
     | 
    
         
            +
                @view.setupUi(self)
         
     | 
| 
      
 25 
     | 
    
         
            +
                @view.lbl_chip.setText(chip.reference)
         
     | 
| 
      
 26 
     | 
    
         
            +
                @chip = chip
         
     | 
| 
      
 27 
     | 
    
         
            +
                @data = ''
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              def closeEvent(event)
         
     | 
| 
      
 31 
     | 
    
         
            +
                @timer.killTimer(@timer.timerId) unless @timer.nil?
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              def keyPressEvent(event)
         
     | 
| 
      
 35 
     | 
    
         
            +
                send if event.key() == Qt::Key_Enter or event.key() == Qt::Key_Return
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
              def connect
         
     | 
| 
      
 39 
     | 
    
         
            +
                @uart = HardsploitAPI_UART.new(
         
     | 
| 
      
 40 
     | 
    
         
            +
                  baud_rate:        @chip.uart_setting.baud_rate,
         
     | 
| 
      
 41 
     | 
    
         
            +
                  word_width:       @chip.uart_setting.word_size,
         
     | 
| 
      
 42 
     | 
    
         
            +
                  use_parity_bit:   @chip.uart_setting.parity_bit,
         
     | 
| 
      
 43 
     | 
    
         
            +
                  parity_type:      @chip.uart_setting.parity_type,
         
     | 
| 
      
 44 
     | 
    
         
            +
                  nb_stop_bits:     @chip.uart_setting.stop_bits_nbr,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  idle_line_level:  @chip.uart_setting.idle_line
         
     | 
| 
      
 46 
     | 
    
         
            +
                )
         
     | 
| 
      
 47 
     | 
    
         
            +
                @timer = Qt::Timer.new
         
     | 
| 
      
 48 
     | 
    
         
            +
                Qt::Object.connect(@timer, SIGNAL('timeout()'), self, SLOT('update()'))
         
     | 
| 
      
 49 
     | 
    
         
            +
                @timer.start(100)
         
     | 
| 
      
 50 
     | 
    
         
            +
                @data << 'Listening and ready to go !' + 0x0d.chr
         
     | 
| 
      
 51 
     | 
    
         
            +
                @view.console.setPlainText(@data)
         
     | 
| 
      
 52 
     | 
    
         
            +
                scroll_down
         
     | 
| 
      
 53 
     | 
    
         
            +
                sender.setEnabled(false)
         
     | 
| 
      
 54 
     | 
    
         
            +
                @view.btn_disconnect.setEnabled(true)
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              def disconnect
         
     | 
| 
      
 58 
     | 
    
         
            +
                @timer.killTimer(@timer.timerId)
         
     | 
| 
      
 59 
     | 
    
         
            +
                @data << 'Disconnected' + 0x0d.chr
         
     | 
| 
      
 60 
     | 
    
         
            +
                @view.console.setPlainText(@data)
         
     | 
| 
      
 61 
     | 
    
         
            +
                scroll_down
         
     | 
| 
      
 62 
     | 
    
         
            +
                sender.setEnabled(false)
         
     | 
| 
      
 63 
     | 
    
         
            +
                @view.btn_connect.setEnabled(true)
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              def send
         
     | 
| 
      
 67 
     | 
    
         
            +
                return false if @uart.nil? or @timer.nil?
         
     | 
| 
      
 68 
     | 
    
         
            +
                return ErrorMsg.new.ascii_only unless @view.lie_cmd.text.ascii_only?
         
     | 
| 
      
 69 
     | 
    
         
            +
                packet = []
         
     | 
| 
      
 70 
     | 
    
         
            +
                @view.lie_cmd.text.each_byte do |x|
         
     | 
| 
      
 71 
     | 
    
         
            +
                  packet.push x
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
                packet.push 13 if @chip.uart_setting.return_type == 0
         
     | 
| 
      
 74 
     | 
    
         
            +
                packet.push 10 if @chip.uart_setting.return_type == 1
         
     | 
| 
      
 75 
     | 
    
         
            +
                if @chip.uart_setting.return_type == 2
         
     | 
| 
      
 76 
     | 
    
         
            +
                  packet.push 13
         
     | 
| 
      
 77 
     | 
    
         
            +
                  packet.push 10
         
     | 
| 
      
 78 
     | 
    
         
            +
                end
         
     | 
| 
      
 79 
     | 
    
         
            +
                @view.lie_cmd.clear
         
     | 
| 
      
 80 
     | 
    
         
            +
            		@uart.write(payload: packet)
         
     | 
| 
      
 81 
     | 
    
         
            +
              #Rescue
         
     | 
| 
      
 82 
     | 
    
         
            +
              end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
              def update
         
     | 
| 
      
 85 
     | 
    
         
            +
                received = @uart.sendAndReceived.collect{|i| i.chr}
         
     | 
| 
      
 86 
     | 
    
         
            +
                unless received.empty?
         
     | 
| 
      
 87 
     | 
    
         
            +
                  @data << "#{received.join('')}"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  @view.console.setPlainText(@data)
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
                scroll_down
         
     | 
| 
      
 91 
     | 
    
         
            +
              rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
         
     | 
| 
      
 92 
     | 
    
         
            +
            		ErrorMsg.new.hardsploit_not_found
         
     | 
| 
      
 93 
     | 
    
         
            +
              rescue HardsploitAPI::ERROR::USB_ERROR
         
     | 
| 
      
 94 
     | 
    
         
            +
            	  ErrorMsg.new.usb_error
         
     | 
| 
      
 95 
     | 
    
         
            +
              rescue Exception => msg
         
     | 
| 
      
 96 
     | 
    
         
            +
                ErrorMsg.new.unknown(msg)
         
     | 
| 
      
 97 
     | 
    
         
            +
              end
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
              def clear_console
         
     | 
| 
      
 100 
     | 
    
         
            +
                @view.console.clear
         
     | 
| 
      
 101 
     | 
    
         
            +
                @data = ''
         
     | 
| 
      
 102 
     | 
    
         
            +
              end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
              def open_settings
         
     | 
| 
      
 105 
     | 
    
         
            +
                settingsUART = Uart_settings.new(@chip)
         
     | 
| 
      
 106 
     | 
    
         
            +
                settingsUART.setWindowModality(Qt::ApplicationModal)
         
     | 
| 
      
 107 
     | 
    
         
            +
                settingsUART.show
         
     | 
| 
      
 108 
     | 
    
         
            +
              end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
              def scroll_down
         
     | 
| 
      
 111 
     | 
    
         
            +
                sb = Qt::ScrollBar.new
         
     | 
| 
      
 112 
     | 
    
         
            +
                sb = @view.console.verticalScrollBar
         
     | 
| 
      
 113 
     | 
    
         
            +
                sb.setValue(sb.maximum())
         
     | 
| 
      
 114 
     | 
    
         
            +
              end
         
     | 
| 
      
 115 
     | 
    
         
            +
            end
         
     |