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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 801459f50d14a2e5b5d94fb574cd6163e630b1ae
|
4
|
+
data.tar.gz: 5fa96b5a0281ce5557a14701b2e121e92a4fa861
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f57c188bc439fe59bb84b655be76781915b3873c8ca3d020a7cb7a17b9ad3436fa8f8f382fc602d897639a7cbc25706fa5fa2394f9d246e1a8429d182c3df109
|
7
|
+
data.tar.gz: e716df40ec6768c808ab85e357facac2be65a54a3174af8b3de3b9a24e7f64ff9661d618764d040621d16b3b94bb136bb2e538d1ce8cfbc91a26870abe59792f
|
data/lib/Hardsploit_gui.rb
CHANGED
@@ -11,14 +11,14 @@ require 'active_record'
|
|
11
11
|
require_relative 'db/database.rb'
|
12
12
|
require_relative 'gui/gui_chip_management'
|
13
13
|
require_relative 'class/Chip_management'
|
14
|
-
require_relative 'HardsploitAPI/Core/HardsploitAPI'
|
15
|
-
require_relative 'Firmwares/UC/VersionUC'
|
16
|
-
require_relative 'Firmwares/FPGA/VersionFPGA'
|
14
|
+
require_relative 'hardsploit-api/HardsploitAPI/Core/HardsploitAPI'
|
15
|
+
require_relative 'hardsploit-api/Firmwares/UC/VersionUC'
|
16
|
+
require_relative 'hardsploit-api/Firmwares/FPGA/VersionFPGA'
|
17
17
|
include VersionFPGA::VERSION_FPGA
|
18
18
|
include VersionUC::VERSION_UC
|
19
19
|
|
20
20
|
class Hardsploit_gui
|
21
|
-
VERSION = "2.
|
21
|
+
VERSION = "2.5.0"
|
22
22
|
def initialize
|
23
23
|
HardsploitAPI.callbackInfo = method(:callbackInfo)
|
24
24
|
HardsploitAPI.callbackData = method(:callbackData)
|
@@ -28,7 +28,6 @@ class Hardsploit_gui
|
|
28
28
|
$currentFirmware = nil
|
29
29
|
$logFilePath = File.expand_path(File.dirname(__FILE__)) + "/logs/error.log"
|
30
30
|
$dbFilePath = File.expand_path(File.dirname(__FILE__)) + "/db/hs.db"
|
31
|
-
# Launch GUI
|
32
31
|
Qt::Application.new(ARGV) do
|
33
32
|
$app = self
|
34
33
|
w = Chip_management.new(VERSION)
|
@@ -0,0 +1,70 @@
|
|
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_chip_clone'
|
9
|
+
class Chip_clone < Qt::Widget
|
10
|
+
slots 'clone()'
|
11
|
+
|
12
|
+
def initialize(parent, chip)
|
13
|
+
super()
|
14
|
+
@parent = parent
|
15
|
+
@chip = chip
|
16
|
+
@view = Ui_Chip_clone.new
|
17
|
+
centerWindow(self)
|
18
|
+
@view.setupUi(self)
|
19
|
+
inputRestrict(@view.lie_reference, 2)
|
20
|
+
end
|
21
|
+
|
22
|
+
def clone
|
23
|
+
#Chip
|
24
|
+
clone = @chip.dup
|
25
|
+
clone.reference = @view.lie_reference.text
|
26
|
+
clone.save
|
27
|
+
#Pins
|
28
|
+
@chip.pins.each do |pin|
|
29
|
+
npin = pin.dup
|
30
|
+
npin.chip_id = clone.id
|
31
|
+
npin.save
|
32
|
+
end
|
33
|
+
#Setting(s)
|
34
|
+
unless @chip.parallel_setting.nil?
|
35
|
+
clone.parralel_setting = @chip.parallel_setting.dup
|
36
|
+
clone.parralel_setting.save
|
37
|
+
end
|
38
|
+
unless @chip.spi_setting.nil?
|
39
|
+
clone.spi_setting = @chip.spi_setting.dup
|
40
|
+
clone.spi_setting.save
|
41
|
+
end
|
42
|
+
unless @chip.i2c_setting.nil?
|
43
|
+
clone.i2c_setting = @chip.i2c_setting.dup
|
44
|
+
clone.i2c_setting.save
|
45
|
+
end
|
46
|
+
unless @chip.swd_setting.nil?
|
47
|
+
clone.swd_setting = @chip.swd_setting.dup
|
48
|
+
clone.swd_setting.save
|
49
|
+
end
|
50
|
+
unless @chip.uart_setting.nil?
|
51
|
+
clone.uart_setting = @chip.uart_setting.dup
|
52
|
+
clone.uart_setting.save
|
53
|
+
end
|
54
|
+
#Command(s) and cmd bytes
|
55
|
+
unless @chip.commands.nil?
|
56
|
+
@chip.commands.each do |cmd|
|
57
|
+
clone_cmd = cmd.dup
|
58
|
+
clone_cmd.chip_id = clone.id
|
59
|
+
clone_cmd.save
|
60
|
+
cmd.bytes.each do |byte|
|
61
|
+
clone_byte = byte.dup
|
62
|
+
clone_byte.command_id = clone_cmd.id
|
63
|
+
clone_byte.save
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
@parent.feed_chip_array
|
68
|
+
self.close
|
69
|
+
end
|
70
|
+
end
|
data/lib/class/Chip_editor.rb
CHANGED
@@ -46,12 +46,25 @@ class Chip_management < Qt::MainWindow
|
|
46
46
|
feed_type_cbx
|
47
47
|
@console = Console.new(@view.tbl_console)
|
48
48
|
@versionGUI = versionGUI
|
49
|
+
@hardsploit_board_status = Qt::Label.new
|
50
|
+
statusBar.addWidget(@hardsploit_board_status);
|
49
51
|
check_hardsploit_connection
|
50
52
|
rescue Exception => msg
|
51
53
|
ErrorMsg.new.unknown(msg)
|
52
54
|
return false
|
53
55
|
end
|
54
56
|
|
57
|
+
def set_hs_board_status(connected)
|
58
|
+
if connected
|
59
|
+
@hardsploit_board_status.setText("Hardsploit board: connected " +
|
60
|
+
"- version #{HardsploitAPI.instance.getVersionNumber} " +
|
61
|
+
"- api V#{HardsploitAPI::VERSION::API}"
|
62
|
+
)
|
63
|
+
else
|
64
|
+
@hardsploit_board_status.setText("Hardsploit board: disconnected");
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
55
68
|
def feed_type_cbx
|
56
69
|
Manufacturer.all.each do |m|
|
57
70
|
@view.cbx_manufacturer.addItem(m.name)
|
@@ -109,9 +122,9 @@ class Chip_management < Qt::MainWindow
|
|
109
122
|
edit_lvl = Qt::TreeWidgetItem.new
|
110
123
|
edit_lvl.setText(0, "Edit")
|
111
124
|
parent_node.addChild(edit_lvl)
|
112
|
-
|
113
|
-
|
114
|
-
parent_node.addChild(
|
125
|
+
clone_lvl = Qt::TreeWidgetItem.new
|
126
|
+
clone_lvl.setText(0, "Clone")
|
127
|
+
parent_node.addChild(clone_lvl)
|
115
128
|
delete_lvl = Qt::TreeWidgetItem.new
|
116
129
|
delete_lvl.setText(0, "Delete")
|
117
130
|
parent_node.addChild(delete_lvl)
|
@@ -137,12 +150,12 @@ class Chip_management < Qt::MainWindow
|
|
137
150
|
detect_lvl = Qt::TreeWidgetItem.new
|
138
151
|
detect_lvl.setText(0, "Detect")
|
139
152
|
parent_node.addChild(detect_lvl)
|
140
|
-
|
141
|
-
|
142
|
-
parent_node.addChild(
|
143
|
-
|
144
|
-
|
145
|
-
parent_node.addChild(
|
153
|
+
write_lvl = Qt::TreeWidgetItem.new
|
154
|
+
write_lvl.setText(0, "Write")
|
155
|
+
parent_node.addChild(write_lvl)
|
156
|
+
read_lvl = Qt::TreeWidgetItem.new
|
157
|
+
read_lvl.setText(0, "Read")
|
158
|
+
parent_node.addChild(read_lvl)
|
146
159
|
erase_lvl = Qt::TreeWidgetItem.new
|
147
160
|
erase_lvl.setText(0, "Erase")
|
148
161
|
parent_node.addChild(erase_lvl)
|
@@ -153,12 +166,12 @@ class Chip_management < Qt::MainWindow
|
|
153
166
|
cmd_lvl = Qt::TreeWidgetItem.new
|
154
167
|
cmd_lvl.setText(0, "Commands")
|
155
168
|
parent_node.addChild(cmd_lvl)
|
156
|
-
|
157
|
-
|
158
|
-
parent_node.addChild(
|
159
|
-
|
160
|
-
|
161
|
-
parent_node.addChild(
|
169
|
+
write_lvl = Qt::TreeWidgetItem.new
|
170
|
+
write_lvl.setText(0, "Write")
|
171
|
+
parent_node.addChild(write_lvl)
|
172
|
+
read_lvl = Qt::TreeWidgetItem.new
|
173
|
+
read_lvl.setText(0, "Read")
|
174
|
+
parent_node.addChild(read_lvl)
|
162
175
|
sniffer_lvl = Qt::TreeWidgetItem.new
|
163
176
|
sniffer_lvl.setText(0, "Sniffer")
|
164
177
|
parent_node.addChild(sniffer_lvl)
|
@@ -172,23 +185,23 @@ class Chip_management < Qt::MainWindow
|
|
172
185
|
cmd_lvl = Qt::TreeWidgetItem.new
|
173
186
|
cmd_lvl.setText(0, "Commands")
|
174
187
|
parent_node.addChild(cmd_lvl)
|
175
|
-
|
176
|
-
|
177
|
-
parent_node.addChild(
|
178
|
-
|
179
|
-
|
180
|
-
parent_node.addChild(
|
188
|
+
write_lvl = Qt::TreeWidgetItem.new
|
189
|
+
write_lvl.setText(0, "Write")
|
190
|
+
parent_node.addChild(write_lvl)
|
191
|
+
read_lvl = Qt::TreeWidgetItem.new
|
192
|
+
read_lvl.setText(0, "Read")
|
193
|
+
parent_node.addChild(read_lvl)
|
181
194
|
when 'PARALLEL'
|
182
195
|
settings_lvl = Qt::TreeWidgetItem.new
|
183
196
|
settings_lvl.setText(0, "Settings")
|
184
197
|
parent_node.addChild(settings_lvl)
|
185
198
|
# Not implemented yet
|
186
|
-
#
|
187
|
-
#
|
188
|
-
#parent_node.addChild(
|
189
|
-
|
190
|
-
|
191
|
-
parent_node.addChild(
|
199
|
+
#write_lvl = Qt::TreeWidgetItem.new
|
200
|
+
#write_lvl.setText(0, "write")
|
201
|
+
#parent_node.addChild(write_lvl)
|
202
|
+
read_lvl = Qt::TreeWidgetItem.new
|
203
|
+
read_lvl.setText(0, "Read")
|
204
|
+
parent_node.addChild(read_lvl)
|
192
205
|
end
|
193
206
|
return parent_node
|
194
207
|
end
|
@@ -250,7 +263,7 @@ class Chip_management < Qt::MainWindow
|
|
250
263
|
case item.text(0)
|
251
264
|
when 'Wiring' ; wire_chip
|
252
265
|
when 'Edit' ; edit_chip
|
253
|
-
when '
|
266
|
+
when 'Clone' ; clone_chip
|
254
267
|
when 'Delete' ; delete_chip
|
255
268
|
end
|
256
269
|
else
|
@@ -268,8 +281,8 @@ class Chip_management < Qt::MainWindow
|
|
268
281
|
case spi_module
|
269
282
|
when 'Settings' ; Spi_settings.new(@chip_clicked).show
|
270
283
|
when 'Commands' ; Generic_commands.new(@chip_clicked, 'SPI').show
|
271
|
-
when '
|
272
|
-
when '
|
284
|
+
when 'Write' ; Spi_write.new(@chip_clicked).show
|
285
|
+
when 'Read' ; Spi_read.new(@chip_clicked).show
|
273
286
|
when 'Sniffer' ; Spi_sniffer.new(@chip_clicked).show
|
274
287
|
end
|
275
288
|
end
|
@@ -279,31 +292,39 @@ class Chip_management < Qt::MainWindow
|
|
279
292
|
when 'Settings' ; I2c_settings.new(@chip_clicked).show
|
280
293
|
when 'PIN Scanner' ; I2c_scanner.new.show
|
281
294
|
when 'Commands' ; Generic_commands.new(@chip_clicked, 'I2C').show
|
282
|
-
when '
|
283
|
-
when '
|
295
|
+
when 'Write' ; I2c_write.new(@chip_clicked).show
|
296
|
+
when 'Read' ; I2c_read.new(@chip_clicked).show
|
284
297
|
end
|
285
298
|
end
|
286
299
|
|
287
300
|
def load_parallel_module(parallel_module)
|
288
301
|
case parallel_module
|
289
302
|
when 'Settings' ; Parallel_settings.new(@chip_clicked).show
|
290
|
-
when '
|
291
|
-
when '
|
303
|
+
when 'Write' ; Parallel_write.new(@chip_clicked).show
|
304
|
+
when 'Read' ; Parallel_read.new(@chip_clicked).show
|
292
305
|
end
|
293
306
|
end
|
294
307
|
|
295
308
|
def load_swd_module(swd_module)
|
296
309
|
case swd_module
|
297
|
-
when 'Settings'
|
298
|
-
when 'PIN Scanner'
|
299
|
-
|
300
|
-
|
310
|
+
when 'Settings'; Swd_settings.new(@chip_clicked).show
|
311
|
+
when 'PIN Scanner'
|
312
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
313
|
+
Swd_scanner.new.show
|
314
|
+
when 'Detect'
|
315
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
316
|
+
Swd.new(@chip_clicked, @console).detect
|
317
|
+
when 'Write'
|
318
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
301
319
|
filepath = Qt::FileDialog.getOpenFileName(self, tr('Select a file'), '/')
|
302
|
-
Swd.new(@chip_clicked, @console).
|
303
|
-
when '
|
320
|
+
Swd.new(@chip_clicked, @console).write(filepath) unless filepath.nil?
|
321
|
+
when 'Read'
|
322
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
304
323
|
filepath = Qt::FileDialog.getSaveFileName(self, tr('Select a file'), '/')
|
305
|
-
Swd.new(@chip_clicked, @console).
|
306
|
-
when 'Erase'
|
324
|
+
Swd.new(@chip_clicked, @console).read(filepath) unless filepath.nil?
|
325
|
+
when 'Erase'
|
326
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
327
|
+
Swd.new(@chip_clicked, @console).erase
|
307
328
|
end
|
308
329
|
end
|
309
330
|
|
@@ -314,6 +335,7 @@ class Chip_management < Qt::MainWindow
|
|
314
335
|
settingsUart.setWindowModality(Qt::ApplicationModal)
|
315
336
|
settingsUart.show
|
316
337
|
when 'Console'
|
338
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
317
339
|
consoleUart = Uart_console.new(@chip_clicked)
|
318
340
|
consoleUart.setWindowModality(Qt::ApplicationModal)
|
319
341
|
consoleUart.show
|
@@ -321,16 +343,7 @@ class Chip_management < Qt::MainWindow
|
|
321
343
|
end
|
322
344
|
|
323
345
|
def add_chip
|
324
|
-
|
325
|
-
if sender.objectName == 'tw_chip' or sender.objectName == 'actionTemplate'
|
326
|
-
unless @chip_clicked.nil?
|
327
|
-
add_chip = Chip_editor.new(self, @chip_clicked, 'temp')
|
328
|
-
else
|
329
|
-
ErrorMsg.new.no_chip_loaded
|
330
|
-
end
|
331
|
-
else
|
332
|
-
add_chip = Chip_editor.new(self, 'none', 'new')
|
333
|
-
end
|
346
|
+
add_chip = Chip_editor.new(self, 'none', 'new')
|
334
347
|
add_chip.show
|
335
348
|
end
|
336
349
|
|
@@ -340,6 +353,12 @@ class Chip_management < Qt::MainWindow
|
|
340
353
|
edit_chip.show
|
341
354
|
end
|
342
355
|
|
356
|
+
def clone_chip
|
357
|
+
return ErrorMsg.new.no_chip_loaded if @chip_clicked.nil?
|
358
|
+
clone_chip = Chip_clone.new(self, @chip_clicked)
|
359
|
+
clone_chip.show
|
360
|
+
end
|
361
|
+
|
343
362
|
def delete_chip
|
344
363
|
return ErrorMsg.new.no_chip_loaded if @chip_clicked.nil?
|
345
364
|
msg = Qt::MessageBox.new
|
@@ -486,11 +505,13 @@ class Chip_management < Qt::MainWindow
|
|
486
505
|
"BOARD : #{HardsploitAPI.instance.getVersionNumber}"
|
487
506
|
)
|
488
507
|
@console.print('Hardsploit ready to suck chip souls !')
|
508
|
+
set_hs_board_status(true)
|
489
509
|
else
|
490
510
|
@console.print(
|
491
511
|
'Hardsploit board unconnected: '+
|
492
512
|
'Wiring and command execution disabled'
|
493
513
|
)
|
514
|
+
set_hs_board_status(false)
|
494
515
|
end
|
495
516
|
end
|
496
517
|
end
|
data/lib/class/ErrorMsg.rb
CHANGED
data/lib/class/Firmware.rb
CHANGED
@@ -12,7 +12,7 @@ class Firmware
|
|
12
12
|
$pgb = Progress_bar.new("Upload firmware :")
|
13
13
|
$pgb.show
|
14
14
|
end
|
15
|
-
base_path = File.expand_path(File.dirname(__FILE__)) + '/../Firmwares/FPGA/'
|
15
|
+
base_path = File.expand_path(File.dirname(__FILE__)) + '/../hardsploit-api/Firmwares/FPGA/'
|
16
16
|
case firmware
|
17
17
|
when 'I2C'
|
18
18
|
firmware_path = base_path + 'I2C/I2C_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_I2C_INTERACT.rpd'
|
data/lib/class/Progress_bar.rb
CHANGED
data/lib/class/Wire_helper.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
#===================================================
|
7
7
|
|
8
8
|
require_relative '../gui/gui_wire_helper'
|
9
|
-
require_relative '../HardsploitAPI/Core/HardsploitAPI'
|
9
|
+
require_relative '../hardsploit-api/HardsploitAPI/Core/HardsploitAPI'
|
10
10
|
|
11
11
|
class Wire_helper < Qt::Widget
|
12
12
|
slots 'rotate_scene()'
|
@@ -158,7 +158,10 @@ class CustomItem < Qt::GraphicsTextItem
|
|
158
158
|
pin.setColor
|
159
159
|
pin.instance_variable_get('@signalTxt').clearFocus
|
160
160
|
pin.instance_variable_get('@nbrTxt').clearFocus
|
161
|
-
|
161
|
+
if @api_value.name == 'NA'
|
162
|
+
HardsploitAPI.instance.setWiringLeds(value: 0x0000000000000000)
|
163
|
+
return false
|
164
|
+
end
|
162
165
|
pin_group = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
|
163
166
|
hardsploit_pin_number = pin_group.index(@api_value.pin[0]) * 8 + @api_value.pin[1].to_i
|
164
167
|
HardsploitAPI.instance.setWiringLeds(value: 2**hardsploit_pin_number)
|
@@ -196,7 +199,7 @@ class UniqPin
|
|
196
199
|
|
197
200
|
@nbrTxt = CustomItem.new(pinNum.to_s)
|
198
201
|
@nbrTxt.cursor = Qt::Cursor.new(Qt::PointingHandCursor)
|
199
|
-
@nbrTxt.setPin(self,
|
202
|
+
@nbrTxt.setPin(self, signal_name)
|
200
203
|
@nbrTxt.setTextInteractionFlags(Qt::TextSelectableByMouse)
|
201
204
|
@nbrTxt.setX(xNum)
|
202
205
|
@nbrTxt.setY(yNum)
|
File without changes
|
@@ -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_read'
|
9
|
+
require_relative '../../hardsploit-api/HardsploitAPI/Modules/I2C/HardsploitAPI_I2C'
|
10
|
+
class I2c_read < Qt::Widget
|
11
|
+
slots 'read()'
|
12
|
+
slots 'select_read_file()'
|
13
13
|
|
14
14
|
def initialize(chip)
|
15
15
|
super()
|
16
|
-
@view =
|
16
|
+
@view = Ui_Generic_read.new
|
17
17
|
centerWindow(self)
|
18
18
|
@view.setupUi(self)
|
19
19
|
@view.lbl_chip.setText(chip.reference)
|
@@ -22,32 +22,32 @@ class I2c_export < Qt::Widget
|
|
22
22
|
@chip = chip
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def select_read_file
|
26
26
|
@filepath = Qt::FileDialog.getSaveFileName(self, tr('Select a file'), '/', tr('*.*'))
|
27
27
|
unless @filepath.nil?
|
28
|
-
@view.
|
29
|
-
@view.btn_full_export.setEnabled(true)
|
28
|
+
@view.btn_read.setEnabled(true)
|
30
29
|
@view.lbl_selected_file.setText("#{@filepath.split("/").last}")
|
31
30
|
end
|
32
31
|
rescue Exception => msg
|
33
32
|
ErrorMsg.new.unknown(msg)
|
34
33
|
end
|
35
34
|
|
36
|
-
def
|
35
|
+
def read
|
36
|
+
return ErrorMsg.new.hardsploit_not_found unless HardsploitAPI.getNumberOfBoardAvailable > 0
|
37
37
|
$file = File.open("#{@filepath}", 'w') unless @filepath.nil?
|
38
|
-
if
|
39
|
-
return false unless
|
38
|
+
if @view.rbn_full.isChecked
|
39
|
+
return false unless control_read_settings('full')
|
40
40
|
start = 0
|
41
41
|
stop = @chip.i2c_setting.total_size - 1
|
42
42
|
control = @chip.i2c_setting.total_size
|
43
43
|
else
|
44
|
-
return false unless
|
44
|
+
return false unless control_read_settings('partial')
|
45
45
|
start = @view.lie_start.text.to_i
|
46
46
|
stop = @view.lie_stop.text.to_i
|
47
47
|
control = (stop - start) + 1
|
48
48
|
end
|
49
49
|
Firmware.new('I2C')
|
50
|
-
$pgb = Progress_bar.new("I²C:
|
50
|
+
$pgb = Progress_bar.new("I²C: Reading...")
|
51
51
|
$pgb.show
|
52
52
|
|
53
53
|
if [40, 100, 400, 1000].include?(@chip.i2c_setting.frequency)
|
@@ -73,7 +73,7 @@ class I2c_export < Qt::Widget
|
|
73
73
|
ErrorMsg.new.unknown(msg)
|
74
74
|
end
|
75
75
|
|
76
|
-
def
|
76
|
+
def control_read_settings(type)
|
77
77
|
return ErrorMsg.new.settings_missing if @chip.i2c_setting.nil?
|
78
78
|
return ErrorMsg.new.frequency_missing if @chip.i2c_setting.frequency.nil?
|
79
79
|
return ErrorMsg.new.mode_missing if @chip.i2c_setting.address_w.nil?
|