Top Level Namespace
Defined Under Namespace
Modules: Ui
Classes: Bus, Byte, CType, Chip, ChipType, Chip_clone, Chip_editor, Chip_management, Cmd, Command, Command_editor, Command_table, Console, CreateBuses, CreateBytes, CreateChipTypes, CreateChips, CreateCommands, CreateI2cSettings, CreateManufacturers, CreatePackages, CreateParallelSettings, CreatePins, CreateSignals, CreateSpiSettings, CreateSwdSettings, CreateUartSettings, CreateUses, CustomItem, ErrorMsg, Export, Export_manager, Firmware, Generic_commands, HardsploitAPI, HardsploitAPI_I2C, HardsploitAPI_NRF24L01, HardsploitAPI_PARALLEL, HardsploitAPI_SPI, HardsploitAPI_SPI_SNIFFER, HardsploitAPI_SWD, HardsploitAPI_TEST, HardsploitAPI_UART, Hardsploit_gui, I2C, I2cSetting, I2c_command, I2c_read, I2c_scanner, I2c_settings, I2c_write, Import, Manufacturer, Package, Parallel, ParallelSetting, Parallel_read, Parallel_settings, Parallel_write, Pin, Progress_bar, SWD_DEBUG_PORT, SWD_MEM_AP, SWD_STM32, Signal_mapper, Signall, Spi, SpiSetting, Spi_read, Spi_settings, Spi_sniffer, Spi_write, String, Swd, SwdSetting, Swd_scanner, Swd_settings, UartSetting, Uart_baudrate, Uart_console, Uart_settings, Ui_Chip_clone, Ui_Chip_editor, Ui_Chip_management, Ui_Command_editor, Ui_Export, Ui_Export_manager, Ui_Generic_commands, Ui_Generic_read, Ui_Generic_write, Ui_I2c_command, Ui_I2c_settings, Ui_Import, Ui_Parallel_settings, Ui_Progress_bar, Ui_Signal_mapper, Ui_Signal_scanner, Ui_Spi_settings, Ui_Spi_sniffer, Ui_Swd_settings, Ui_Uart_baudrate, Ui_Uart_console, Ui_Uart_settings, Ui_Wire_helper, UniqPin, Use, VersionFPGA, VersionUC, Wire_helper
Constant Summary
collapse
- ABSOLUTE_PATH =
Hardsploit GUI - By Opale Security
www.opale-security.com || www.hardsploit.io
License: GNU General Public License v3
License URI: http://www.gnu.org/licenses/gpl.txt
File.expand_path(File.dirname(__FILE__)) + "/"
VersionUC::VERSION_UC::UC
VersionFPGA::VERSION_FPGA::FPGA
Instance Method Summary
collapse
Instance Method Details
#callbackData(receiveData) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/hardsploit-api/Examples/testI2C.rb', line 16
def callbackData(receiveData)
if receiveData != nil then
puts "received #{receiveData.size}"
p receiveData
else
puts "ISSUE BECAUSE DATA IS NIL"
end
end
|
#callbackInfo(receiveData) ⇒ Object
12
13
14
|
# File 'lib/hardsploit-api/Examples/testI2C.rb', line 12
def callbackInfo(receiveData)
end
|
#callbackProgress(percent:, startTime:, endTime:) ⇒ Object
puts “Speed : #receiveData”
28
29
30
31
32
|
# File 'lib/hardsploit-api/Examples/testSPI.rb', line 28
def callbackProgress(percent:,startTime:,endTime:)
print "\r\e[#{31}mUpload of FPGA firmware in progress : #{percent}%\e[0m"
end
|
#callbackSpeedOfTransfert(receiveData) ⇒ Object
25
26
27
|
# File 'lib/hardsploit-api/Examples/testI2C.rb', line 25
def callbackSpeedOfTransfert(receiveData)
end
|
#centerWindow(win) ⇒ Object
89
90
91
92
93
94
95
|
# File 'lib/Hardsploit_gui.rb', line 89
def centerWindow(win)
desktop = Qt::DesktopWidget.new
rect = desktop.screenGeometry(desktop.primaryScreen)
centerX = (rect.width - win.width ) / 2
centerY = (rect.height - win.height) / 2
win.move(centerX,centerY)
end
|
#check_for_errors(result) ⇒ Object
67
68
69
70
71
72
73
74
75
|
# File 'lib/Hardsploit_gui.rb', line 67
def check_for_errors(result)
return false if result.errors.messages.empty?
error_message = ""
result.errors.messages.each do |msg|
error_message << "Error: #{msg[0]} #{msg[1][0]}\n"
end
Qt::MessageBox.new(Qt::MessageBox::Warning, 'Warning', error_message).exec
return true
end
|
#draw_rect ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/class/Wire_helper.rb', line 103
def draw_rect
total_pin_nbr = Pin.where(chip_id: @chip.id).count
pin_by_side = total_pin_nbr / 2
cHeight = 14 * (pin_by_side + 2) @scene.addRect(Qt::RectF.new(0, 0, cHeight, cHeight))
y = 18
y2 = cHeight - 24
(1..total_pin_nbr).each do |i|
if i <= total_pin_nbr / 2
ySig = y
yNum = y
UniqPin.new(@scene, i, @chip.id, -70, ySig - 12, 0, yNum - 12, 0, y, -20, 6, false)
y = y + 14
else
xSig = cHeight + 24
ySig = y2
yNum = y2
if i < 10
xNum = cHeight - 20
elsif i >= 10 && i < 100
xNum = cHeight - 25
else
xNum = cHeight - 35
end
UniqPin.new(@scene, i, @chip.id, xSig, ySig - 12, xNum, yNum - 12, cHeight, y2, 20, 6, false)
y2 = y2 - 14
end
end
end
|
#draw_square ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/class/Wire_helper.rb', line 48
def draw_square
total_pin_nbr = Pin.where(chip_id: @chip.id).count
pin_by_side = total_pin_nbr / 4
cHeight = 14*(pin_by_side + 4) @scene.addRect(Qt::RectF.new(0, 0, cHeight, cHeight))
y = 32
y2 = cHeight - 38
x = 32
x2 = cHeight - 38
(1..total_pin_nbr).each do |i|
if i <= pin_by_side
ySig = y
yNum = y
UniqPin.new(@scene, i, @chip.id, -70, ySig - 12, 0, yNum - 12, 0, y, -20, 6, false)
y = y + 14 elsif i > pin_by_side && i <= total_pin_nbr / 2
xSig2 = x
xNum2 = x
UniqPin.new(@scene, i, @chip.id, xSig2 - 12, cHeight + 55, xNum2 - 12, cHeight, x, cHeight, 6, 20, true)
x = x + 14
elsif i > total_pin_nbr / 2 && i <= (total_pin_nbr - (pin_by_side))
xSig = cHeight + 24
ySig = y2
yNum = y2
if i < 10
xNum = cHeight - 20
elsif i >= 10 && i < 100
xNum = cHeight - 25
else
xNum = cHeight - 35
end
UniqPin.new(@scene, i, @chip.id, xSig, ySig - 12, xNum, yNum - 12, cHeight, y2, 20, 6, false)
y2 = y2 - 14
else
xSig2 = x2
xNum2 = x2
if i < 10
yNum2 = 20
elsif i >= 10 && i < 100
yNum2 = 30
else
yNum2 = 40
end
UniqPin.new(@scene, i, @chip.id, xSig2 - 12, -20, xNum2 - 12, yNum2, x2, 0, 6, -20, true)
x2 = x2 - 14
end
end
end
|
#i2cCustomInteract ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/Hardsploit_gui.rb', line 77
def inputRestrict(lineEdit, type)
case type
when 0 ; reg = Qt::RegExp.new("[0-9]+")
when 1 ; reg = Qt::RegExp.new("^[a-zA-Z_@-]+( [a-zA-Z_@-]+)*$")
when 2 ; reg = Qt::RegExp.new("^[a-zA-Z0-9_@-]+( [a-zA-Z0-9_@-]+)*$")
when 3 ; reg = Qt::RegExp.new("^[A-Fa-f0-9]{2}")
when 4 ; reg = Qt::RegExp.new("^[A-Fa-f0-9]{8}")
end
regVal = Qt::RegExpValidator.new(reg, self)
lineEdit.setValidator(regVal)
end
|
#spiCustomCommand ⇒ Object
p HardsploitAPI::VERSION::API
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/hardsploit-api/Examples/testSPI.rb', line 51
def spiCustomCommand
testpack = Array.new
for i in (0..10) do
testpack.push i
end
result = @spi.spi_Interact(payload:testpack)
p result
end
|
#swdCustomRead ⇒ Object
The current API version p HardsploitAPI::VERSION::API
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/hardsploit-api/Examples/testSWD.rb', line 48
def swdCustomRead
begin
swd = HardsploitAPI_SWD.new(
memory_start_address: "0x08000000",
memory_size_address: "0x1FFFF7E0",
cpu_id_address: "0xE000ED00",
device_id_address: "0x1FFFF7E8"
)
code = swd.obtainCodes
puts "DP.IDCODE: #{code[:DebugPortId].to_s(16)} "
rescue
puts "MCU NOT FOUND"
rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
puts "Hardsploit not found"
rescue HardsploitAPI::ERROR::USB_ERROR
puts "USB ERRROR"
end
end
|
#swdCustomWrite ⇒ Object
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/hardsploit-api/Examples/testSWD.rb', line 82
def swdCustomWrite
begin
swd = HardsploitAPI_SWD.new(
memory_start_address: "0x08000000",
memory_size_address: "0x1FFFF7E0",
cpu_id_address: "0xE000ED00",
device_id_address: "0x1FFFF7E8"
)
code = swd.obtainCodes
puts "DP.IDCODE: #{code[:DebugPortId].to_s(16)} "
puts "AP.IDCODE: #{code[:AccessPortId].to_s(16)} "
puts "CPU ID : #{code[:CpuId].to_s(16)} "
swd.writeFlash('dumdp2.bin')
rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
puts "Hardsploit not found"
rescue HardsploitAPI::ERROR::USB_ERROR
puts "USB ERRROR"
end
end
|
#uartCustomRead ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/hardsploit-api/Examples/testUARTFuzzer.rb', line 68
def uartCustomRead
while 1
begin
tab = @uart.sendAndReceived
print tab.pack('c*')
rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
puts "Hardsploit not found"
rescue HardsploitAPI::ERROR::USB_ERROR
puts "USB ERRROR"
end
sleep(0.2)
end
end
|
#uartCustomSend ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/hardsploit-api/Examples/testUARTFuzzer.rb', line 51
def uartCustomSend
begin
payload = Array.new
for i in 0..23
payload.push 0x40
end
payload.push 13
@uart.write(payload:payload)
puts payload.pack("C*")
rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
puts "Hardsploit not found"
rescue HardsploitAPI::ERROR::USB_ERROR
puts "USB ERRROR"
end
end
|