hardsploit_gui 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Hardsploit_gui.rb +4 -5
- data/lib/class/Chip_clone.rb +70 -0
- data/lib/class/Chip_editor.rb +1 -0
- data/lib/class/Chip_management.rb +73 -52
- data/lib/class/ErrorMsg.rb +1 -0
- data/lib/class/Firmware.rb +1 -1
- data/lib/class/Progress_bar.rb +1 -1
- data/lib/class/Wire_helper.rb +6 -3
- data/lib/class/{I2C → i2c}/I2c_command.rb +0 -0
- data/lib/class/{I2C/I2c_export.rb → i2c/I2c_read.rb} +15 -15
- data/lib/class/{I2C → i2c}/I2c_scanner.rb +2 -1
- data/lib/class/{I2C → i2c}/I2c_settings.rb +1 -0
- data/lib/class/{I2C/I2c_import.rb → i2c/I2c_write.rb} +13 -12
- data/lib/class/{PARALLEL/Parallel_export.rb → parallel/Parallel_read.rb} +17 -18
- data/lib/class/{PARALLEL → parallel}/Parallel_settings.rb +0 -0
- data/lib/class/{PARALLEL/Parallel_import.rb → parallel/Parallel_write.rb} +11 -10
- data/lib/class/{SPI/Spi_export.rb → spi/Spi_read.rb} +15 -15
- data/lib/class/{SPI → spi}/Spi_settings.rb +0 -0
- data/lib/class/{SPI → spi}/Spi_sniffer.rb +2 -1
- data/lib/class/{SPI/Spi_import.rb → spi/Spi_write.rb} +13 -12
- data/lib/class/swd/Swd.rb +10 -10
- data/lib/class/swd/Swd_scanner.rb +2 -1
- data/lib/class/uart/Uart_baudrate.rb +1 -1
- data/lib/class/uart/Uart_console.rb +1 -1
- data/lib/class/uart/Uart_settings.rb +1 -0
- data/lib/db/development.sqlite3 +0 -0
- data/lib/gui/gui_chip_clone.rb +87 -0
- data/lib/gui/gui_chip_editor.rb +349 -349
- data/lib/gui/gui_chip_management.rb +378 -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_read.rb +185 -0
- data/lib/gui/gui_generic_write.rb +142 -0
- data/lib/gui/gui_i2c_command.rb +116 -116
- data/lib/gui/gui_i2c_settings.rb +242 -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_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/compile_to_ruby.sh +14 -0
- data/lib/gui_designer/gui_chip_clone.ui +96 -0
- data/lib/gui_designer/gui_chip_management.ui +25 -22
- data/lib/gui_designer/{gui_generic_export.ui → gui_generic_read.ui} +152 -72
- data/lib/gui_designer/{gui_generic_import.ui → gui_generic_write.ui} +47 -47
- data/lib/gui_designer/gui_i2c_settings.ui +68 -60
- data/lib/hardsploit-api/Examples/swdProgrammer.rb +76 -0
- data/lib/hardsploit-api/Examples/testI2C.rb +183 -0
- data/lib/hardsploit-api/Examples/testNRF24L01.rb +122 -0
- data/lib/hardsploit-api/Examples/testParralel.rb +84 -0
- data/lib/hardsploit-api/Examples/testSPI.rb +113 -0
- data/lib/hardsploit-api/Examples/testSPISniffer.rb +91 -0
- data/lib/hardsploit-api/Examples/testSWD.rb +224 -0
- data/lib/hardsploit-api/Examples/testUARTBufferOverflow.rb +113 -0
- data/lib/hardsploit-api/Examples/testUARTConsole.rb +74 -0
- data/lib/hardsploit-api/Examples/testUARTFuzzer.rb +109 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/FPGA/I2C/I2C_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_I2C_INTERACT.rpd +0 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/FPGA/PARALLEL/NO_MUX_PARALLEL_MEMORY/HARDSPLOIT_FIRMWARE_FPGA_NO_MUX_PARALLEL_MEMORY.rpd +0 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/FPGA/SPI/SPI_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SPI_INTERACT.rpd +0 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/FPGA/SPI/SPI_SNIFFER/HARDSPLOIT_FIRMWARE_FPGA_SPI_SNIFFER.rpd +0 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/FPGA/SWD/SWD_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SWD_INTERACT.rpd +0 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/FPGA/TEST/TEST_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_TEST_INTERACT.rpd +0 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/FPGA/UART/UART_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_UART_INTERACT.rpd +0 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/FPGA/VersionFPGA.rb +0 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/UC/HARDSPLOIT_FIRMWARE_UC.bin +0 -0
- data/lib/{Firmwares → hardsploit-api/Firmwares}/UC/VersionUC.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Core/HardsploitAPI.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Core/HardsploitAPI_CONSTANT.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Core/HardsploitAPI_ERROR.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Core/HardsploitAPI_FIRMWARE.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Core/HardsploitAPI_PROGRESS.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Core/HardsploitAPI_USB_COMMUNICATION.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/I2C/HardsploitAPI_I2C.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/NO_MUX_PARALLEL_MEMORY/HardsploitAPI_NO_MUX_PARALLEL_MEMORY.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/NRF24L01/HardsploitAPI_NRF24L01.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/SPI/HardsploitAPI_SPI.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/SPI_SNIFFER/HardsploitAPI_SPI_SNIFFER.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/SWD/HardsploitAPI_SWD.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/SWD/HardsploitAPI_SWD_DEBUG.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/SWD/HardsploitAPI_SWD_MEM_AP.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/SWD/HardsploitAPI_SWD_STM32.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/TEST/HardsploitAPI_TEST_INTERACT.rb +0 -0
- data/lib/{HardsploitAPI → hardsploit-api/HardsploitAPI}/Modules/UART/HardsploitAPI_UART.rb +0 -0
- data/lib/hardsploit-api/LICENSE.txt +674 -0
- data/lib/hardsploit-api/README.md +22 -0
- data/lib/hardsploit-api/TRADEMARK +3 -0
- data/lib/logs/error.log +80 -0
- metadata +65 -49
- data/lib/gui/gui_generic_export.rb +0 -164
- data/lib/gui/gui_generic_import.rb +0 -142
- data/lib/gui/gui_spi_import.rb +0 -126
@@ -6,7 +6,7 @@
|
|
6
6
|
#===================================================
|
7
7
|
|
8
8
|
require_relative '../../gui/gui_signal_scanner'
|
9
|
-
require_relative '../../HardsploitAPI/Modules/I2C/HardsploitAPI_I2C'
|
9
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/I2C/HardsploitAPI_I2C'
|
10
10
|
|
11
11
|
class I2c_scanner < Qt::Widget
|
12
12
|
slots 'scan()'
|
@@ -23,6 +23,7 @@ class I2c_scanner < Qt::Widget
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def scan
|
26
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
26
27
|
@view.cbx_start.setEnabled(false)
|
27
28
|
@view.cbx_stop.setEnabled(false)
|
28
29
|
@view.btn_scan.setEnabled(false)
|
@@ -5,15 +5,15 @@
|
|
5
5
|
# License URI: http://www.gnu.org/licenses/gpl.txt
|
6
6
|
#===================================================
|
7
7
|
|
8
|
-
require_relative '../../gui/
|
9
|
-
require_relative '../../HardsploitAPI/Modules/I2C/HardsploitAPI_I2C'
|
10
|
-
class
|
11
|
-
slots '
|
12
|
-
slots '
|
8
|
+
require_relative '../../gui/gui_generic_write'
|
9
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/I2C/HardsploitAPI_I2C'
|
10
|
+
class I2c_write < Qt::Widget
|
11
|
+
slots 'write()'
|
12
|
+
slots 'select_write_file()'
|
13
13
|
|
14
14
|
def initialize(chip)
|
15
15
|
super()
|
16
|
-
@view =
|
16
|
+
@view = Ui_Generic_write.new
|
17
17
|
centerWindow(self)
|
18
18
|
@view.setupUi(self)
|
19
19
|
@view.lbl_chip.setText(chip.reference)
|
@@ -21,20 +21,21 @@ class I2c_import < Qt::Widget
|
|
21
21
|
@chip = chip
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def select_write_file
|
25
25
|
@filepath = Qt::FileDialog.getOpenFileName(self, tr('Select a file'), '/', tr('*.*'))
|
26
26
|
unless @filepath.nil?
|
27
|
-
@view.
|
27
|
+
@view.btn_write.setEnabled(true)
|
28
28
|
@view.lbl_selected_file.setText("#{@filepath.split("/").last}")
|
29
29
|
end
|
30
30
|
rescue Exception => msg
|
31
31
|
ErrorMsg.new.unknown(msg)
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
return
|
34
|
+
def write
|
35
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
36
|
+
return 0 if control_write_settings.zero?
|
36
37
|
Firmware.new('I2C')
|
37
|
-
$pgb = Progress_bar.new("I²C:
|
38
|
+
$pgb = Progress_bar.new("I²C: Writing...")
|
38
39
|
$pgb.show
|
39
40
|
if [40, 100, 400, 1000].include?(@chip.i2c_setting.frequency)
|
40
41
|
speed = 0 if @chip.i2c_setting.frequency == 100
|
@@ -61,7 +62,7 @@ class I2c_import < Qt::Widget
|
|
61
62
|
ErrorMsg.new.unknown(msg)
|
62
63
|
end
|
63
64
|
|
64
|
-
def
|
65
|
+
def control_write_settings
|
65
66
|
if @chip.i2c_setting.nil?
|
66
67
|
Qt::MessageBox.new(
|
67
68
|
Qt::MessageBox::Warning,
|
@@ -5,16 +5,16 @@
|
|
5
5
|
# License URI: http://www.gnu.org/licenses/gpl.txt
|
6
6
|
#===================================================
|
7
7
|
|
8
|
-
require_relative '../../gui/
|
9
|
-
require_relative '../../HardsploitAPI/Modules/NO_MUX_PARALLEL_MEMORY/HardsploitAPI_NO_MUX_PARALLEL_MEMORY'
|
8
|
+
require_relative '../../gui/gui_generic_read'
|
9
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/NO_MUX_PARALLEL_MEMORY/HardsploitAPI_NO_MUX_PARALLEL_MEMORY'
|
10
10
|
|
11
|
-
class
|
12
|
-
slots '
|
13
|
-
slots '
|
11
|
+
class Parallel_read < Qt::Widget
|
12
|
+
slots 'read()'
|
13
|
+
slots 'select_read_file()'
|
14
14
|
|
15
15
|
def initialize(chip)
|
16
16
|
super()
|
17
|
-
@view =
|
17
|
+
@view = Ui_Generic_read.new
|
18
18
|
centerWindow(self)
|
19
19
|
@view.setupUi(self)
|
20
20
|
@view.lbl_chip.setText(chip.reference)
|
@@ -23,23 +23,23 @@ class Parallel_export < Qt::Widget
|
|
23
23
|
@chip = chip
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
26
|
+
def select_read_file
|
27
27
|
@filepath = Qt::FileDialog.getSaveFileName(self, tr('Select a file'), '/', tr('Bin file (*.bin)'))
|
28
28
|
unless @filepath.nil?
|
29
|
-
@view.
|
30
|
-
@view.btn_full_export.setEnabled(true)
|
29
|
+
@view.btn_read.setEnabled(true)
|
31
30
|
end
|
32
31
|
rescue Exception => msg
|
33
32
|
ErrorMsg.new.unknown(msg)
|
34
33
|
end
|
35
34
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
35
|
+
def read
|
36
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
37
|
+
if @view.rbn_full.isChecked
|
38
|
+
return false unless control_read_settings('full')
|
39
39
|
start = 0
|
40
40
|
stop = @chip.parallel_setting.total_size - 1
|
41
41
|
else
|
42
|
-
return false unless
|
42
|
+
return false unless control_read_settings('partial')
|
43
43
|
start = @view.lie_start.text.to_i
|
44
44
|
stop = @view.lie_stop.text.to_i
|
45
45
|
end
|
@@ -56,9 +56,8 @@ class Parallel_export < Qt::Widget
|
|
56
56
|
latency: @chip.parallel_setting.read_latency
|
57
57
|
)
|
58
58
|
|
59
|
-
|
60
|
-
@view.
|
61
|
-
@view.btn_full_export.setEnabled(false)
|
59
|
+
control_read_result(stop, time)
|
60
|
+
@view.btn_read.setEnabled(false)
|
62
61
|
@filepath = nil
|
63
62
|
rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
|
64
63
|
ErrorMsg.new.hardsploit_not_found
|
@@ -68,7 +67,7 @@ class Parallel_export < Qt::Widget
|
|
68
67
|
ErrorMsg.new.unknown(msg)
|
69
68
|
end
|
70
69
|
|
71
|
-
def
|
70
|
+
def control_read_result(stop, time)
|
72
71
|
time = Time.new - time
|
73
72
|
file_size = File.size("#{@filepath}")
|
74
73
|
# 8 bits test
|
@@ -96,7 +95,7 @@ class Parallel_export < Qt::Widget
|
|
96
95
|
p "DUMP #{((file_size/time)).round(2)}Bytes/s (#{(file_size)}Bytes in #{time.round(4)} s)"
|
97
96
|
end
|
98
97
|
|
99
|
-
def
|
98
|
+
def control_read_settings(type)
|
100
99
|
return ErrorMsg.new.settings_missing if @chip.parallel_setting.nil?
|
101
100
|
return ErrorMsg.new.para_read_latency if @chip.parallel_setting.read_latency.nil?
|
102
101
|
return ErrorMsg.new.para_word_size if @chip.parallel_setting.word_size.nil?
|
File without changes
|
@@ -5,26 +5,26 @@
|
|
5
5
|
# License URI: http://www.gnu.org/licenses/gpl.txt
|
6
6
|
#===================================================
|
7
7
|
|
8
|
-
require_relative '../../gui/
|
8
|
+
require_relative '../../gui/gui_generic_write'
|
9
9
|
|
10
|
-
class
|
11
|
-
slots '
|
12
|
-
slots '
|
10
|
+
class Parallel_write < Qt::Widget
|
11
|
+
slots 'write()'
|
12
|
+
slots 'select_write_file()'
|
13
13
|
|
14
14
|
def initialize(chip)
|
15
15
|
super()
|
16
|
-
@view =
|
16
|
+
@view = Ui_Generic_write.new
|
17
17
|
centerWindow(self)
|
18
18
|
@view.setupUi(self)
|
19
19
|
@view.lbl_chip.setText(chip.reference)
|
20
20
|
inputRestrict(@view.lie_start, 0)
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def select_write_file
|
24
24
|
@filepath = Qt::FileDialog.getOpenFileName(self, tr('Select a file'), '/', tr('Bin file (*.bin)'))
|
25
25
|
unless @filepath.nil?
|
26
26
|
$file = File.open("#{@filepath}", 'w')
|
27
|
-
@view.
|
27
|
+
@view.btn_write.setEnabled(true)
|
28
28
|
end
|
29
29
|
rescue Exception => msg
|
30
30
|
ErrorMsg.new.unknow(msg)
|
@@ -38,8 +38,9 @@ class Parallel_import < Qt::Widget
|
|
38
38
|
ErrorMsg.new.unknow(msg)
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
return
|
41
|
+
def write
|
42
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
43
|
+
return 0 if control_write_settings.zero?
|
43
44
|
start = @view.lie_start.text.to_i
|
44
45
|
Firmware.new('PARALLEL')
|
45
46
|
time = Time.new
|
@@ -58,7 +59,7 @@ class Parallel_import < Qt::Widget
|
|
58
59
|
return false
|
59
60
|
end
|
60
61
|
|
61
|
-
def
|
62
|
+
def control_write_settings
|
62
63
|
file_size = File.size("#{@filepath}")
|
63
64
|
if @chip.parallel_setting.nil?
|
64
65
|
Qt::MessageBox.new(
|
@@ -5,16 +5,16 @@
|
|
5
5
|
# License URI: http://www.gnu.org/licenses/gpl.txt
|
6
6
|
#===================================================
|
7
7
|
|
8
|
-
require_relative '../../gui/
|
9
|
-
require_relative '../../HardsploitAPI/Modules/SPI/HardsploitAPI_SPI'
|
8
|
+
require_relative '../../gui/gui_generic_read'
|
9
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/SPI/HardsploitAPI_SPI'
|
10
10
|
|
11
|
-
class
|
12
|
-
slots '
|
13
|
-
slots '
|
11
|
+
class Spi_read < Qt::Widget
|
12
|
+
slots 'read()'
|
13
|
+
slots 'select_read_file()'
|
14
14
|
|
15
15
|
def initialize(chip)
|
16
16
|
super()
|
17
|
-
@view =
|
17
|
+
@view = Ui_Generic_read.new
|
18
18
|
centerWindow(self)
|
19
19
|
@view.setupUi(self)
|
20
20
|
@view.lbl_chip.setText(chip.reference)
|
@@ -39,32 +39,32 @@ class Spi_export < Qt::Widget
|
|
39
39
|
}
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def select_read_file
|
43
43
|
@filepath = Qt::FileDialog.getSaveFileName(self, tr('Select a file'), '/', tr('*.*'))
|
44
44
|
unless @filepath.nil?
|
45
|
-
@view.
|
46
|
-
@view.btn_full_export.setEnabled(true)
|
45
|
+
@view.btn_read.setEnabled(true)
|
47
46
|
@view.lbl_selected_file.setText("#{@filepath.split("/").last}")
|
48
47
|
end
|
49
48
|
rescue Exception => msg
|
50
49
|
ErrorMsg.new.unknown(msg)
|
51
50
|
end
|
52
51
|
|
53
|
-
def
|
52
|
+
def read
|
53
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
54
54
|
$file = File.open("#{@filepath}", 'w') unless @filepath.nil?
|
55
|
-
if
|
56
|
-
return false unless
|
55
|
+
if @view.rbn_full.isChecked
|
56
|
+
return false unless control_read_settings('full')
|
57
57
|
start = 0
|
58
58
|
stop = @chip.spi_setting.total_size - 1
|
59
59
|
control = @chip.spi_setting.total_size
|
60
60
|
else
|
61
|
-
return false unless
|
61
|
+
return false unless control_read_settings('partial')
|
62
62
|
start = @view.lie_start.text.to_i
|
63
63
|
stop = @view.lie_stop.text.to_i
|
64
64
|
control = (stop - start) + 1
|
65
65
|
end
|
66
66
|
Firmware.new('SPI')
|
67
|
-
$pgb = Progress_bar.new("SPI:
|
67
|
+
$pgb = Progress_bar.new("SPI: Reading...")
|
68
68
|
$pgb.show
|
69
69
|
spi = HardsploitAPI_SPI.new(
|
70
70
|
speed: @speeds[@chip.spi_setting.frequency],
|
@@ -86,7 +86,7 @@ class Spi_export < Qt::Widget
|
|
86
86
|
ErrorMsg.new.unknown(msg)
|
87
87
|
end
|
88
88
|
|
89
|
-
def
|
89
|
+
def control_read_settings(type)
|
90
90
|
return ErrorMsg.new.settings_missing if @chip.spi_setting.nil?
|
91
91
|
return ErrorMsg.new.frequency_missing if @chip.spi_setting.frequency.nil?
|
92
92
|
return ErrorMsg.new.mode_missing if @chip.spi_setting.command_read.nil?
|
File without changes
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#===================================================
|
7
7
|
|
8
8
|
require_relative '../../gui/gui_spi_sniffer'
|
9
|
-
require_relative '../../HardsploitAPI/Modules/SPI_SNIFFER/HardsploitAPI_SPI_SNIFFER'
|
9
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/SPI_SNIFFER/HardsploitAPI_SPI_SNIFFER'
|
10
10
|
|
11
11
|
class Spi_sniffer < Qt::Widget
|
12
12
|
slots 'start()'
|
@@ -23,6 +23,7 @@ class Spi_sniffer < Qt::Widget
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def start
|
26
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
26
27
|
@view.btn_stop.setEnabled(true)
|
27
28
|
@view.btn_start.setEnabled(false)
|
28
29
|
@view.cbx_type.setEnabled(false)
|
@@ -5,16 +5,16 @@
|
|
5
5
|
# License URI: http://www.gnu.org/licenses/gpl.txt
|
6
6
|
#===================================================
|
7
7
|
|
8
|
-
require_relative '../../gui/
|
9
|
-
require_relative '../../HardsploitAPI/Modules/SPI/HardsploitAPI_SPI'
|
8
|
+
require_relative '../../gui/gui_generic_write'
|
9
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/SPI/HardsploitAPI_SPI'
|
10
10
|
|
11
|
-
class
|
12
|
-
slots '
|
13
|
-
slots '
|
11
|
+
class Spi_write < Qt::Widget
|
12
|
+
slots 'write()'
|
13
|
+
slots 'select_write_file()'
|
14
14
|
|
15
15
|
def initialize(chip)
|
16
16
|
super()
|
17
|
-
@view =
|
17
|
+
@view = Ui_Generic_write.new
|
18
18
|
centerWindow(self)
|
19
19
|
@view.setupUi(self)
|
20
20
|
@view.lbl_chip.setText(chip.reference)
|
@@ -38,24 +38,25 @@ class Spi_import < Qt::Widget
|
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def select_write_file
|
42
42
|
@filepath = Qt::FileDialog.getOpenFileName(self, tr('Select a file'), '/', tr('*.*'))
|
43
43
|
unless @filepath.nil?
|
44
|
-
@view.
|
44
|
+
@view.btn_write.setEnabled(true)
|
45
45
|
@view.lbl_selected_file.setText("#{@filepath.split("/").last}")
|
46
46
|
end
|
47
47
|
rescue Exception => msg
|
48
48
|
ErrorMsg.new.unknown(msg)
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
52
|
-
return
|
51
|
+
def write
|
52
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
53
|
+
return 0 if control_write_settings.zero?
|
53
54
|
spi = HardsploitAPI_SPI.new(
|
54
55
|
speed: @speeds[@chip.spi_setting.frequency],
|
55
56
|
mode: @chip.spi_setting.mode
|
56
57
|
)
|
57
58
|
Firmware.new('SPI')
|
58
|
-
$pgb = Progress_bar.new("SPI:
|
59
|
+
$pgb = Progress_bar.new("SPI: Writing...")
|
59
60
|
$pgb.show
|
60
61
|
@chip.spi_setting.is_flash.zero? ? flash = false : flash = true
|
61
62
|
spi.spi_Generic_Import(
|
@@ -78,7 +79,7 @@ class Spi_import < Qt::Widget
|
|
78
79
|
ErrorMsg.new.unknown(msg)
|
79
80
|
end
|
80
81
|
|
81
|
-
def
|
82
|
+
def control_write_settings
|
82
83
|
if @chip.spi_setting.nil?
|
83
84
|
Qt::MessageBox.new(
|
84
85
|
Qt::MessageBox::Warning,
|
data/lib/class/swd/Swd.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# License URI: http://www.gnu.org/licenses/gpl.txt
|
6
6
|
#===================================================
|
7
7
|
|
8
|
-
require_relative '../../HardsploitAPI/Modules/SWD/HardsploitAPI_SWD'
|
8
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD'
|
9
9
|
|
10
10
|
class Swd
|
11
11
|
|
@@ -43,11 +43,11 @@ class Swd
|
|
43
43
|
case action
|
44
44
|
when 'detect'
|
45
45
|
return api.obtainCodes
|
46
|
-
when '
|
46
|
+
when 'read'
|
47
47
|
$pgb = Progress_bar.new("SWD: #{action}...")
|
48
48
|
$pgb.show
|
49
49
|
api.dumpFlash(option)
|
50
|
-
when '
|
50
|
+
when 'write'
|
51
51
|
$pgb = Progress_bar.new("SWD: #{action}...")
|
52
52
|
$pgb.show
|
53
53
|
api.writeFlash(option)
|
@@ -83,23 +83,23 @@ class Swd
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
def
|
87
|
-
unless do_swd_action('
|
86
|
+
def read(filepath)
|
87
|
+
unless do_swd_action('read', filepath) == false
|
88
88
|
Qt::MessageBox.new(
|
89
89
|
Qt::MessageBox::Information,
|
90
|
-
"SWD
|
90
|
+
"SWD Read action",
|
91
91
|
"Dump finished"
|
92
92
|
).exec
|
93
93
|
$pgb.close
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
def
|
98
|
-
unless do_swd_action('
|
97
|
+
def write(filepath)
|
98
|
+
unless do_swd_action('write', filepath) == false
|
99
99
|
Qt::MessageBox.new(
|
100
100
|
Qt::MessageBox::Information,
|
101
|
-
"SWD
|
102
|
-
"
|
101
|
+
"SWD Write Action",
|
102
|
+
"Write finished"
|
103
103
|
).exec
|
104
104
|
$pgb.close
|
105
105
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#===================================================
|
7
7
|
|
8
8
|
require_relative '../../gui/gui_signal_scanner'
|
9
|
-
require_relative '../../HardsploitAPI/Modules/SWD/HardsploitAPI_SWD'
|
9
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD'
|
10
10
|
|
11
11
|
class Swd_scanner < Qt::Widget
|
12
12
|
slots 'scan()'
|
@@ -23,6 +23,7 @@ class Swd_scanner < Qt::Widget
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def scan
|
26
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
26
27
|
@view.cbx_start.setEnabled(false)
|
27
28
|
@view.cbx_stop.setEnabled(false)
|
28
29
|
@view.btn_scan.setEnabled(false)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#===================================================
|
7
7
|
|
8
8
|
require_relative '../../gui/gui_uart_baudrate'
|
9
|
-
require_relative '../../HardsploitAPI/Modules/UART/HardsploitAPI_UART'
|
9
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/UART/HardsploitAPI_UART'
|
10
10
|
|
11
11
|
class Uart_baudrate < Qt::Widget
|
12
12
|
slots 'start_detect()'
|