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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33cac9a06b6835cd33abb3a2b9937152f2d9d0f1
|
4
|
+
data.tar.gz: 0cd2a410c28964b3cbd40be6a1ccfe533e4d7fa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2356ccef654cc626ba4ab9b23e50708727f73233d0b46d92e61a0ac11f468f8b2d4a4faf03995f6a383289ef4eb6a110e47940bfc8a979d19209dc0557936e30
|
7
|
+
data.tar.gz: 1ec86ba60d5fffe6c512c6bf0709a595ad24f702507fbc521e9dfc5c7dfe341c1c335c33f1d78946272be9a7302b5b66c7a3a8053d5c9bfab080cc08525d996b
|
data/README.md
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
# Hardsploit
|
2
|
-
|
3
|
-
The essential security auditing tool for Internet of Things devices you'll need in your toolbox
|
4
|
-
|
5
|
-
### [GO TO HARDSPLOIT](http://www.hardsploit.io)
|
6
|
-
|
7
|
-
TO LEARN ABOUT IT
|
8
|
-
|
9
|
-
### [GO TO SHOP](https://www.shop-hardsploit.com)
|
10
|
-
TO BUY
|
11
|
-
|
12
|
-
### [GO TO WIKI](http://wiki.hardsploit.io)
|
13
|
-
|
14
|
-
TO UNDERSTAND HOW USE IT
|
15
|
-
|
16
|
-
### [GO TO FORUM](http://forum.hardsploit.io)
|
17
|
-
|
18
|
-
FOR SUPPORT / HELP
|
19
|
-
|
20
|
-
### [GO TO BUG TRACKER] (http://issues.hardsploit.io)
|
21
|
-
|
22
|
-
FOR BUGS OR IMPROVEMENTS
|
1
|
+
# Hardsploit
|
2
|
+
|
3
|
+
The essential security auditing tool for Internet of Things devices you'll need in your toolbox
|
4
|
+
|
5
|
+
### [GO TO HARDSPLOIT](http://www.hardsploit.io)
|
6
|
+
|
7
|
+
TO LEARN ABOUT IT
|
8
|
+
|
9
|
+
### [GO TO SHOP](https://www.shop-hardsploit.com)
|
10
|
+
TO BUY
|
11
|
+
|
12
|
+
### [GO TO WIKI](http://wiki.hardsploit.io)
|
13
|
+
|
14
|
+
TO UNDERSTAND HOW USE IT
|
15
|
+
|
16
|
+
### [GO TO FORUM](http://forum.hardsploit.io)
|
17
|
+
|
18
|
+
FOR SUPPORT / HELP
|
19
|
+
|
20
|
+
### [GO TO BUG TRACKER] (http://issues.hardsploit.io)
|
21
|
+
|
22
|
+
FOR BUGS OR IMPROVEMENTS
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/hardsploit_gui
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require
|
3
|
-
Hardsploit_gui.new
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "Hardsploit_gui"
|
3
|
+
Hardsploit_gui.new
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class VersionFPGA
|
2
|
-
module VERSION_FPGA
|
3
|
-
FPGA = "V1.2.0"
|
4
|
-
end
|
5
|
-
end
|
1
|
+
class VersionFPGA
|
2
|
+
module VERSION_FPGA
|
3
|
+
FPGA = "V1.2.0"
|
4
|
+
end
|
5
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
#===================================================
|
2
|
-
# Hardsploit UC - 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
|
-
class VersionUC
|
9
|
-
module VERSION_UC
|
10
|
-
UC = "V1.0.3"
|
11
|
-
end
|
12
|
-
end
|
1
|
+
#===================================================
|
2
|
+
# Hardsploit UC - 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
|
+
class VersionUC
|
9
|
+
module VERSION_UC
|
10
|
+
UC = "V1.0.3"
|
11
|
+
end
|
12
|
+
end
|
@@ -1,210 +1,210 @@
|
|
1
|
-
require 'singleton'
|
2
|
-
require 'libusb'
|
3
|
-
require 'thread'
|
4
|
-
require_relative 'HardsploitAPI_CONSTANT'
|
5
|
-
require_relative 'HardsploitAPI_USB_COMMUNICATION'
|
6
|
-
require_relative 'HardsploitAPI_FIRMWARE'
|
7
|
-
require_relative 'HardsploitAPI_ERROR'
|
8
|
-
require_relative '../../Firmwares/FPGA/VersionFPGA'
|
9
|
-
require_relative '../../Firmwares/UC/VersionUC'
|
10
|
-
class String
|
11
|
-
def black; "\e[30m#{self}\e[0m" end
|
12
|
-
def red; "\e[31m#{self}\e[0m" end
|
13
|
-
def green; "\e[32m#{self}\e[0m" end
|
14
|
-
def brown; "\e[33m#{self}\e[0m" end
|
15
|
-
def blue; "\e[34m#{self}\e[0m" end
|
16
|
-
def magenta; "\e[35m#{self}\e[0m" end
|
17
|
-
def cyan; "\e[36m#{self}\e[0m" end
|
18
|
-
def gray; "\e[37m#{self}\e[0m" end
|
19
|
-
|
20
|
-
def bg_black; "\e[40m#{self}\e[0m" end
|
21
|
-
def bg_red; "\e[41m#{self}\e[0m" end
|
22
|
-
def bg_green; "\e[42m#{self}\e[0m" end
|
23
|
-
def bg_brown; "\e[43m#{self}\e[0m" end
|
24
|
-
def bg_blue; "\e[44m#{self}\e[0m" end
|
25
|
-
def bg_magenta; "\e[45m#{self}\e[0m" end
|
26
|
-
def bg_cyan; "\e[46m#{self}\e[0m" end
|
27
|
-
def bg_gray; "\e[47m#{self}\e[0m" end
|
28
|
-
|
29
|
-
def bold; "\e[1m#{self}\e[22m" end
|
30
|
-
def italic; "\e[3m#{self}\e[23m" end
|
31
|
-
def underline; "\e[4m#{self}\e[24m" end
|
32
|
-
def blink; "\e[5m#{self}\e[25m" end
|
33
|
-
def reverse_color; "\e[7m#{self}\e[27m" end
|
34
|
-
end
|
35
|
-
|
36
|
-
class HardsploitAPI
|
37
|
-
include Singleton
|
38
|
-
include USB_COMMAND
|
39
|
-
include USB
|
40
|
-
include VERSION
|
41
|
-
include ERROR
|
42
|
-
|
43
|
-
@@callbackData = nil
|
44
|
-
@@callbackInfo = nil
|
45
|
-
@@callbackProgress = nil
|
46
|
-
@@callbackSpeedOfTransfert = nil
|
47
|
-
@@id = 0
|
48
|
-
@@crossWiringValue = Array.new
|
49
|
-
|
50
|
-
def self.callbackData= fn
|
51
|
-
@@callbackData = fn
|
52
|
-
end
|
53
|
-
def self.callbackInfo= fn
|
54
|
-
@@callbackInfo = fn
|
55
|
-
end
|
56
|
-
def self.callbackProgress= fn
|
57
|
-
@@callbackProgress = fn
|
58
|
-
end
|
59
|
-
def self.callbackSpeedOfTransfert= fn
|
60
|
-
@@callbackSpeedOfTransfert = fn
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.crossWiringValue
|
64
|
-
return @@crossWiringValue
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.id=id
|
68
|
-
if (id < 0) then
|
69
|
-
raise ERROR::HARDSPLOIT_NOT_FOUND
|
70
|
-
else
|
71
|
-
@@id = id
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def initialize
|
76
|
-
if @@callbackData == nil or @@callbackInfo == nil or @@callbackProgress == nil or @@callbackSpeedOfTransfert == nil then
|
77
|
-
raise "Error you need to specify callbackData callbackInfo callbackProgress callbackSpeedOfTransfert first"
|
78
|
-
else
|
79
|
-
#Default wiring
|
80
|
-
for i in 0..63
|
81
|
-
@@crossWiringValue.push i
|
82
|
-
end
|
83
|
-
self.connect
|
84
|
-
puts "Hardsploit is connected".green.bold
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
# Set the leds of uC returning nothing
|
89
|
-
# * +led+:: USB_COMMAND::GREEN_LED or USB_COMMAND::RED_LED
|
90
|
-
# * +state+:: callback to return +data for dump function+
|
91
|
-
def setStatutLed(led:,state:)
|
92
|
-
packet_send = Array.new
|
93
|
-
packet_send.push 0 #size set before send automatic
|
94
|
-
packet_send.push 0 #size set before send automatic
|
95
|
-
packet_send.push HardsploitAPI.lowByte(word:led)
|
96
|
-
packet_send.push HardsploitAPI.highByte(word:led)
|
97
|
-
packet_send.push (state ? 1 : 0)
|
98
|
-
return sendPacket(packet_send)
|
99
|
-
end
|
100
|
-
|
101
|
-
|
102
|
-
# Set custom value to wiring led
|
103
|
-
# * +value+:: 64 bits (8x8 Bytes) values to represent led (PortH PortG PortF PortE PortD PortC PortB PortA)
|
104
|
-
def setWiringLeds(value:)
|
105
|
-
# parametters = HardsploitAPI.checkParametters(["value"],args)
|
106
|
-
# val = parametters[:value]
|
107
|
-
|
108
|
-
packet = Array.new
|
109
|
-
packet.push 0 #low byte of lenght of trame refresh automaticly before send by usb
|
110
|
-
packet.push 0 #high byte of lenght of trame refresh automaticly before send by usb
|
111
|
-
packet.push HardsploitAPI.lowByte(word:USB_COMMAND::FPGA_COMMAND)
|
112
|
-
packet.push HardsploitAPI.highByte(word:USB_COMMAND::FPGA_COMMAND)
|
113
|
-
|
114
|
-
packet.push 0x23 #Command SPI write wiring led
|
115
|
-
|
116
|
-
packet.push HardsploitAPI.reverseBit((value & 0x00000000000000FF) >> 0)
|
117
|
-
packet.push HardsploitAPI.reverseBit((value & 0x000000000000FF00) >> 8 )
|
118
|
-
packet.push HardsploitAPI.reverseBit((value & 0x0000000000FF0000) >> 16 )
|
119
|
-
packet.push HardsploitAPI.reverseBit((value & 0x00000000FF000000) >> 24 )
|
120
|
-
packet.push HardsploitAPI.reverseBit((value & 0x000000FF00000000) >> 32 )
|
121
|
-
packet.push HardsploitAPI.reverseBit((value & 0x0000FF0000000000) >> 40 )
|
122
|
-
packet.push HardsploitAPI.reverseBit((value & 0x00FF000000000000) >> 48 )
|
123
|
-
packet.push HardsploitAPI.reverseBit((value & 0xFF00000000000000) >> 56 )
|
124
|
-
|
125
|
-
return HardsploitAPI.instance.sendPacket(packet)
|
126
|
-
end
|
127
|
-
|
128
|
-
# Obtaint the version number of the board
|
129
|
-
def getVersionNumber
|
130
|
-
packet = Array.new
|
131
|
-
packet.push 0 #low byte of lenght of trame refresh automaticly before send by usb
|
132
|
-
packet.push 0 #high byte of lenght of trame refresh automaticly before send by usb
|
133
|
-
packet.push HardsploitAPI.lowByte(word:USB_COMMAND::GET_VERSION_NUMBER)
|
134
|
-
packet.push HardsploitAPI.highByte(word:USB_COMMAND::GET_VERSION_NUMBER)
|
135
|
-
|
136
|
-
#remove header
|
137
|
-
version_number = self.sendAndReceiveDATA(packet,1000).drop(4)
|
138
|
-
if version_number.size < 20 then #if size more thant 20 char error when reading version number
|
139
|
-
return version_number.pack('U*')
|
140
|
-
else
|
141
|
-
return "BAD VERSION NUMBER"
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
def getAllVersions
|
146
|
-
puts "API : #{VERSION::API}".blue.bold
|
147
|
-
puts "Board : #{getVersionNumber}".blue.bold
|
148
|
-
puts "FPGA : #{VersionFPGA::VERSION_FPGA::FPGA}".blue.bold
|
149
|
-
puts "Microcontroller : #{VersionUC::VERSION_UC::UC}".blue.bold
|
150
|
-
end
|
151
|
-
|
152
|
-
def self.reverseBit(byte)
|
153
|
-
return byte.to_s(2).rjust(8, "0").reverse.to_i(2)
|
154
|
-
end
|
155
|
-
|
156
|
-
# Set cross wiring
|
157
|
-
# * +value+:: 64*8 bits to represent wiring
|
158
|
-
def setCrossWiring(value:)
|
159
|
-
if not value.size == 64 then
|
160
|
-
raise HardsploitAPI::ERROR::API_CROSS_WIRING
|
161
|
-
end
|
162
|
-
|
163
|
-
packet = Array.new
|
164
|
-
packet.push 0 #low byte of lenght of trame refresh automaticly before send by usb
|
165
|
-
packet.push 0 #high byte of lenght of trame refresh automaticly before send by usb
|
166
|
-
packet.push HardsploitAPI.lowByte(word:USB_COMMAND::FPGA_COMMAND)
|
167
|
-
packet.push HardsploitAPI.highByte(word:USB_COMMAND::FPGA_COMMAND)
|
168
|
-
|
169
|
-
packet.push 0x75 #Cross wiring command
|
170
|
-
packet.push *value
|
171
|
-
@@crossWiringValue = value
|
172
|
-
return self.sendPacket(packet)
|
173
|
-
end
|
174
|
-
|
175
|
-
def self.allPosibility(numberOfConnectedPinFromA0:,numberOfSignalsForBus:)
|
176
|
-
if numberOfConnectedPinFromA0 < numberOfSignalsForBus then
|
177
|
-
raise HardsploitAPI::ERROR::API_SCANNER_WRONG_PIN_NUMBER
|
178
|
-
end
|
179
|
-
a = Array.new
|
180
|
-
for i in 0..numberOfConnectedPinFromA0-1
|
181
|
-
a.push i
|
182
|
-
end
|
183
|
-
return a.permutation.to_a
|
184
|
-
end
|
185
|
-
|
186
|
-
def self.prepare_packet
|
187
|
-
packet = []
|
188
|
-
packet.push 0 #low byte of lenght of trame refresh automaticly before send by usb
|
189
|
-
packet.push 0 #high byte of lenght of trame refresh automaticly before send by usb
|
190
|
-
packet.push HardsploitAPI.lowByte(word:HardsploitAPI::USB_COMMAND::FPGA_COMMAND)
|
191
|
-
packet.push HardsploitAPI.highByte(word:HardsploitAPI::USB_COMMAND::FPGA_COMMAND)
|
192
|
-
packet.push 0x50 #Command RAW COMMUNICATION TO FPGA FIFO
|
193
|
-
return packet
|
194
|
-
end
|
195
|
-
|
196
|
-
#call back
|
197
|
-
def consoleProgress(percent:,startTime:,endTime:)
|
198
|
-
@@callbackProgress.call(percent:percent,startTime:startTime,endTime:endTime)
|
199
|
-
end
|
200
|
-
def consoleData(value)
|
201
|
-
@@callbackData.call(value)
|
202
|
-
end
|
203
|
-
def consoleSpeed(value)
|
204
|
-
@@callbackSpeedOfTransfert.call(value)
|
205
|
-
end
|
206
|
-
def consoleInfo(value)
|
207
|
-
@@callbackInfo.call(value)
|
208
|
-
end
|
209
|
-
|
210
|
-
end
|
1
|
+
require 'singleton'
|
2
|
+
require 'libusb'
|
3
|
+
require 'thread'
|
4
|
+
require_relative 'HardsploitAPI_CONSTANT'
|
5
|
+
require_relative 'HardsploitAPI_USB_COMMUNICATION'
|
6
|
+
require_relative 'HardsploitAPI_FIRMWARE'
|
7
|
+
require_relative 'HardsploitAPI_ERROR'
|
8
|
+
require_relative '../../Firmwares/FPGA/VersionFPGA'
|
9
|
+
require_relative '../../Firmwares/UC/VersionUC'
|
10
|
+
class String
|
11
|
+
def black; "\e[30m#{self}\e[0m" end
|
12
|
+
def red; "\e[31m#{self}\e[0m" end
|
13
|
+
def green; "\e[32m#{self}\e[0m" end
|
14
|
+
def brown; "\e[33m#{self}\e[0m" end
|
15
|
+
def blue; "\e[34m#{self}\e[0m" end
|
16
|
+
def magenta; "\e[35m#{self}\e[0m" end
|
17
|
+
def cyan; "\e[36m#{self}\e[0m" end
|
18
|
+
def gray; "\e[37m#{self}\e[0m" end
|
19
|
+
|
20
|
+
def bg_black; "\e[40m#{self}\e[0m" end
|
21
|
+
def bg_red; "\e[41m#{self}\e[0m" end
|
22
|
+
def bg_green; "\e[42m#{self}\e[0m" end
|
23
|
+
def bg_brown; "\e[43m#{self}\e[0m" end
|
24
|
+
def bg_blue; "\e[44m#{self}\e[0m" end
|
25
|
+
def bg_magenta; "\e[45m#{self}\e[0m" end
|
26
|
+
def bg_cyan; "\e[46m#{self}\e[0m" end
|
27
|
+
def bg_gray; "\e[47m#{self}\e[0m" end
|
28
|
+
|
29
|
+
def bold; "\e[1m#{self}\e[22m" end
|
30
|
+
def italic; "\e[3m#{self}\e[23m" end
|
31
|
+
def underline; "\e[4m#{self}\e[24m" end
|
32
|
+
def blink; "\e[5m#{self}\e[25m" end
|
33
|
+
def reverse_color; "\e[7m#{self}\e[27m" end
|
34
|
+
end
|
35
|
+
|
36
|
+
class HardsploitAPI
|
37
|
+
include Singleton
|
38
|
+
include USB_COMMAND
|
39
|
+
include USB
|
40
|
+
include VERSION
|
41
|
+
include ERROR
|
42
|
+
|
43
|
+
@@callbackData = nil
|
44
|
+
@@callbackInfo = nil
|
45
|
+
@@callbackProgress = nil
|
46
|
+
@@callbackSpeedOfTransfert = nil
|
47
|
+
@@id = 0
|
48
|
+
@@crossWiringValue = Array.new
|
49
|
+
|
50
|
+
def self.callbackData= fn
|
51
|
+
@@callbackData = fn
|
52
|
+
end
|
53
|
+
def self.callbackInfo= fn
|
54
|
+
@@callbackInfo = fn
|
55
|
+
end
|
56
|
+
def self.callbackProgress= fn
|
57
|
+
@@callbackProgress = fn
|
58
|
+
end
|
59
|
+
def self.callbackSpeedOfTransfert= fn
|
60
|
+
@@callbackSpeedOfTransfert = fn
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.crossWiringValue
|
64
|
+
return @@crossWiringValue
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.id=id
|
68
|
+
if (id < 0) then
|
69
|
+
raise ERROR::HARDSPLOIT_NOT_FOUND
|
70
|
+
else
|
71
|
+
@@id = id
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def initialize
|
76
|
+
if @@callbackData == nil or @@callbackInfo == nil or @@callbackProgress == nil or @@callbackSpeedOfTransfert == nil then
|
77
|
+
raise "Error you need to specify callbackData callbackInfo callbackProgress callbackSpeedOfTransfert first"
|
78
|
+
else
|
79
|
+
#Default wiring
|
80
|
+
for i in 0..63
|
81
|
+
@@crossWiringValue.push i
|
82
|
+
end
|
83
|
+
self.connect
|
84
|
+
puts "Hardsploit is connected".green.bold
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Set the leds of uC returning nothing
|
89
|
+
# * +led+:: USB_COMMAND::GREEN_LED or USB_COMMAND::RED_LED
|
90
|
+
# * +state+:: callback to return +data for dump function+
|
91
|
+
def setStatutLed(led:,state:)
|
92
|
+
packet_send = Array.new
|
93
|
+
packet_send.push 0 #size set before send automatic
|
94
|
+
packet_send.push 0 #size set before send automatic
|
95
|
+
packet_send.push HardsploitAPI.lowByte(word:led)
|
96
|
+
packet_send.push HardsploitAPI.highByte(word:led)
|
97
|
+
packet_send.push (state ? 1 : 0)
|
98
|
+
return sendPacket(packet_send)
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
# Set custom value to wiring led
|
103
|
+
# * +value+:: 64 bits (8x8 Bytes) values to represent led (PortH PortG PortF PortE PortD PortC PortB PortA)
|
104
|
+
def setWiringLeds(value:)
|
105
|
+
# parametters = HardsploitAPI.checkParametters(["value"],args)
|
106
|
+
# val = parametters[:value]
|
107
|
+
|
108
|
+
packet = Array.new
|
109
|
+
packet.push 0 #low byte of lenght of trame refresh automaticly before send by usb
|
110
|
+
packet.push 0 #high byte of lenght of trame refresh automaticly before send by usb
|
111
|
+
packet.push HardsploitAPI.lowByte(word:USB_COMMAND::FPGA_COMMAND)
|
112
|
+
packet.push HardsploitAPI.highByte(word:USB_COMMAND::FPGA_COMMAND)
|
113
|
+
|
114
|
+
packet.push 0x23 #Command SPI write wiring led
|
115
|
+
|
116
|
+
packet.push HardsploitAPI.reverseBit((value & 0x00000000000000FF) >> 0)
|
117
|
+
packet.push HardsploitAPI.reverseBit((value & 0x000000000000FF00) >> 8 )
|
118
|
+
packet.push HardsploitAPI.reverseBit((value & 0x0000000000FF0000) >> 16 )
|
119
|
+
packet.push HardsploitAPI.reverseBit((value & 0x00000000FF000000) >> 24 )
|
120
|
+
packet.push HardsploitAPI.reverseBit((value & 0x000000FF00000000) >> 32 )
|
121
|
+
packet.push HardsploitAPI.reverseBit((value & 0x0000FF0000000000) >> 40 )
|
122
|
+
packet.push HardsploitAPI.reverseBit((value & 0x00FF000000000000) >> 48 )
|
123
|
+
packet.push HardsploitAPI.reverseBit((value & 0xFF00000000000000) >> 56 )
|
124
|
+
|
125
|
+
return HardsploitAPI.instance.sendPacket(packet)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Obtaint the version number of the board
|
129
|
+
def getVersionNumber
|
130
|
+
packet = Array.new
|
131
|
+
packet.push 0 #low byte of lenght of trame refresh automaticly before send by usb
|
132
|
+
packet.push 0 #high byte of lenght of trame refresh automaticly before send by usb
|
133
|
+
packet.push HardsploitAPI.lowByte(word:USB_COMMAND::GET_VERSION_NUMBER)
|
134
|
+
packet.push HardsploitAPI.highByte(word:USB_COMMAND::GET_VERSION_NUMBER)
|
135
|
+
|
136
|
+
#remove header
|
137
|
+
version_number = self.sendAndReceiveDATA(packet,1000).drop(4)
|
138
|
+
if version_number.size < 20 then #if size more thant 20 char error when reading version number
|
139
|
+
return version_number.pack('U*')
|
140
|
+
else
|
141
|
+
return "BAD VERSION NUMBER"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def getAllVersions
|
146
|
+
puts "API : #{VERSION::API}".blue.bold
|
147
|
+
puts "Board : #{getVersionNumber}".blue.bold
|
148
|
+
puts "FPGA : #{VersionFPGA::VERSION_FPGA::FPGA}".blue.bold
|
149
|
+
puts "Microcontroller : #{VersionUC::VERSION_UC::UC}".blue.bold
|
150
|
+
end
|
151
|
+
|
152
|
+
def self.reverseBit(byte)
|
153
|
+
return byte.to_s(2).rjust(8, "0").reverse.to_i(2)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Set cross wiring
|
157
|
+
# * +value+:: 64*8 bits to represent wiring
|
158
|
+
def setCrossWiring(value:)
|
159
|
+
if not value.size == 64 then
|
160
|
+
raise HardsploitAPI::ERROR::API_CROSS_WIRING
|
161
|
+
end
|
162
|
+
|
163
|
+
packet = Array.new
|
164
|
+
packet.push 0 #low byte of lenght of trame refresh automaticly before send by usb
|
165
|
+
packet.push 0 #high byte of lenght of trame refresh automaticly before send by usb
|
166
|
+
packet.push HardsploitAPI.lowByte(word:USB_COMMAND::FPGA_COMMAND)
|
167
|
+
packet.push HardsploitAPI.highByte(word:USB_COMMAND::FPGA_COMMAND)
|
168
|
+
|
169
|
+
packet.push 0x75 #Cross wiring command
|
170
|
+
packet.push *value
|
171
|
+
@@crossWiringValue = value
|
172
|
+
return self.sendPacket(packet)
|
173
|
+
end
|
174
|
+
|
175
|
+
def self.allPosibility(numberOfConnectedPinFromA0:,numberOfSignalsForBus:)
|
176
|
+
if numberOfConnectedPinFromA0 < numberOfSignalsForBus then
|
177
|
+
raise HardsploitAPI::ERROR::API_SCANNER_WRONG_PIN_NUMBER
|
178
|
+
end
|
179
|
+
a = Array.new
|
180
|
+
for i in 0..numberOfConnectedPinFromA0-1
|
181
|
+
a.push i
|
182
|
+
end
|
183
|
+
return a.permutation.to_a
|
184
|
+
end
|
185
|
+
|
186
|
+
def self.prepare_packet
|
187
|
+
packet = []
|
188
|
+
packet.push 0 #low byte of lenght of trame refresh automaticly before send by usb
|
189
|
+
packet.push 0 #high byte of lenght of trame refresh automaticly before send by usb
|
190
|
+
packet.push HardsploitAPI.lowByte(word:HardsploitAPI::USB_COMMAND::FPGA_COMMAND)
|
191
|
+
packet.push HardsploitAPI.highByte(word:HardsploitAPI::USB_COMMAND::FPGA_COMMAND)
|
192
|
+
packet.push 0x50 #Command RAW COMMUNICATION TO FPGA FIFO
|
193
|
+
return packet
|
194
|
+
end
|
195
|
+
|
196
|
+
#call back
|
197
|
+
def consoleProgress(percent:,startTime:,endTime:)
|
198
|
+
@@callbackProgress.call(percent:percent,startTime:startTime,endTime:endTime)
|
199
|
+
end
|
200
|
+
def consoleData(value)
|
201
|
+
@@callbackData.call(value)
|
202
|
+
end
|
203
|
+
def consoleSpeed(value)
|
204
|
+
@@callbackSpeedOfTransfert.call(value)
|
205
|
+
end
|
206
|
+
def consoleInfo(value)
|
207
|
+
@@callbackInfo.call(value)
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|