hardsploit_gui 2.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.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +22 -0
  3. data/Rakefile +1 -0
  4. data/bin/hardsploit_gui +3 -0
  5. data/lib/Firmware/FPGA/I2C/I2C_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_I2C_INTERACT.rpd +0 -0
  6. data/lib/Firmware/FPGA/PARALLEL/NO_MUX_PARALLEL_MEMORY/HARDSPLOIT_FIRMWARE_FPGA_NO_MUX_PARALLEL_MEMORY.rpd +0 -0
  7. data/lib/Firmware/FPGA/SPI/SPI_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SPI_INTERACT.rpd +0 -0
  8. data/lib/Firmware/FPGA/SWD/SWD_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SWD_INTERACT.rpd +0 -0
  9. data/lib/Firmware/FPGA/TEST/TEST_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_TEST_INTERACT.rpd +0 -0
  10. data/lib/Firmware/FPGA/VersionFPGA.rb +5 -0
  11. data/lib/Firmware/UC/HARDSPLOIT_FIRMWARE_UC.bin +0 -0
  12. data/lib/Firmware/UC/VersionUC.rb +12 -0
  13. data/lib/HardsploitAPI/HardsploitAPI.rb +134 -0
  14. data/lib/HardsploitAPI/HardsploitAPI_CONSTANT.rb +145 -0
  15. data/lib/HardsploitAPI/HardsploitAPI_FIRMWARE.rb +311 -0
  16. data/lib/HardsploitAPI/HardsploitAPI_I2C.rb +218 -0
  17. data/lib/HardsploitAPI/HardsploitAPI_NO_MUX_PARALLELE_MEMORY.rb +229 -0
  18. data/lib/HardsploitAPI/HardsploitAPI_SPI.rb +179 -0
  19. data/lib/HardsploitAPI/HardsploitAPI_TEST_INTERACT.rb +98 -0
  20. data/lib/HardsploitAPI/HardsploitAPI_USB_COMMUNICATION.rb +149 -0
  21. data/lib/HardsploitAPI/LICENSE.txt +674 -0
  22. data/lib/HardsploitAPI/README.md +22 -0
  23. data/lib/HardsploitAPI/SWD/HardsploitAPI_SWD.rb +249 -0
  24. data/lib/HardsploitAPI/SWD/HardsploitAPI_SWD_DEBUG.rb +102 -0
  25. data/lib/HardsploitAPI/SWD/HardsploitAPI_SWD_MEM_AP.rb +78 -0
  26. data/lib/HardsploitAPI/SWD/HardsploitAPI_SWD_STM32.rb +104 -0
  27. data/lib/HardsploitAPI/TRADEMARK +3 -0
  28. data/lib/LICENSE.txt +674 -0
  29. data/lib/README.md +22 -0
  30. data/lib/TRADEMARK +3 -0
  31. data/lib/class/Chip_editor.rb +448 -0
  32. data/lib/class/Command_editor.rb +268 -0
  33. data/lib/class/Command_table.rb +239 -0
  34. data/lib/class/Console.rb +28 -0
  35. data/lib/class/Export_manager.rb +124 -0
  36. data/lib/class/Firmware.rb +29 -0
  37. data/lib/class/Generic_commands.rb +275 -0
  38. data/lib/class/HardsploitGUI.rb +462 -0
  39. data/lib/class/I2C/I2c_command.rb +48 -0
  40. data/lib/class/I2C/I2c_export.rb +121 -0
  41. data/lib/class/I2C/I2c_import.rb +92 -0
  42. data/lib/class/I2C/I2c_settings.rb +117 -0
  43. data/lib/class/PARALLEL/Parallel_export.rb +146 -0
  44. data/lib/class/PARALLEL/Parallel_import.rb +88 -0
  45. data/lib/class/PARALLEL/Parallel_settings.rb +102 -0
  46. data/lib/class/SPI/Spi_export.rb +141 -0
  47. data/lib/class/SPI/Spi_import.rb +112 -0
  48. data/lib/class/SPI/Spi_settings.rb +90 -0
  49. data/lib/class/Wire_helper.rb +246 -0
  50. data/lib/db/associations.rb +125 -0
  51. data/lib/db/hs.db +0 -0
  52. data/lib/gui/gui_chip_editor.rb +355 -0
  53. data/lib/gui/gui_chip_management.rb +372 -0
  54. data/lib/gui/gui_command_editor.rb +218 -0
  55. data/lib/gui/gui_export_manager.rb +93 -0
  56. data/lib/gui/gui_generic_commands.rb +164 -0
  57. data/lib/gui/gui_generic_export.rb +148 -0
  58. data/lib/gui/gui_generic_import.rb +126 -0
  59. data/lib/gui/gui_i2c_command.rb +115 -0
  60. data/lib/gui/gui_i2c_settings.rb +201 -0
  61. data/lib/gui/gui_parallel_settings.rb +194 -0
  62. data/lib/gui/gui_spi_import.rb +126 -0
  63. data/lib/gui/gui_spi_settings.rb +187 -0
  64. data/lib/gui/gui_wire_helper.rb +99 -0
  65. data/lib/gui_designer/gui_chip_editor.ui +553 -0
  66. data/lib/gui_designer/gui_chip_management.ui +842 -0
  67. data/lib/gui_designer/gui_command_editor.ui +347 -0
  68. data/lib/gui_designer/gui_export_manager.ui +115 -0
  69. data/lib/gui_designer/gui_generic_commands.ui +258 -0
  70. data/lib/gui_designer/gui_generic_export.ui +179 -0
  71. data/lib/gui_designer/gui_generic_import.ui +142 -0
  72. data/lib/gui_designer/gui_i2c_command.ui +145 -0
  73. data/lib/gui_designer/gui_i2c_settings.ui +261 -0
  74. data/lib/gui_designer/gui_parallel_settings.ui +244 -0
  75. data/lib/gui_designer/gui_processing.ui +81 -0
  76. data/lib/gui_designer/gui_spi_settings.ui +321 -0
  77. data/lib/gui_designer/gui_wire_helper.ui +117 -0
  78. data/lib/hardsploit.rb +122 -0
  79. data/lib/images/search.png +0 -0
  80. data/lib/logs/error.log +0 -0
  81. metadata +236 -0
@@ -0,0 +1,246 @@
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 '../HardsploitAPI/HardsploitAPI'
9
+ require_relative '../gui/gui_wire_helper'
10
+
11
+ class Wire_helper < Qt::Widget
12
+ slots 'rotate_scene()'
13
+
14
+ def initialize(chip, api)
15
+ super()
16
+ @wire_helper_gui = Ui_Wire_helper.new
17
+ centerWindow(self)
18
+ @wire_helper_gui.setupUi(self)
19
+ @chip = chip
20
+ @api = api
21
+
22
+ # Default led position
23
+ api.setWiringLeds(0x0000000000000000)
24
+
25
+ # Draw the chip
26
+ scene = Qt::GraphicsScene.new
27
+ @wire_helper_gui.lbl_chip.setText("Your chip (#{chip.chip_reference}):")
28
+
29
+ # Get the pin total number
30
+ # UniqPin parameters: (scene, pinNum, pinChip, xSig, ySig, xNum, yNum, xRect, yRect, wRect, hRect, rotation)
31
+ total_pin_nbr = Pin.where(pin_chip: @chip.chip_id).count
32
+ # If it's a square
33
+ if Package.find_by(package_id: chip.chip_package).package_shape == 0
34
+ pin_by_side = total_pin_nbr / 4
35
+ cHeight = 14*(pin_by_side + 4) # Chip's height (+4 because we add a space equal to one pin for each corner)
36
+ scene.addRect(Qt::RectF.new(0, 0, cHeight, cHeight))
37
+ y = 32
38
+ y2 = cHeight - 38
39
+ x = 32
40
+ x2 = cHeight - 38
41
+ (1..total_pin_nbr).each do |i|
42
+ # Face 1
43
+ if i <= pin_by_side
44
+ ySig = y
45
+ yNum = y
46
+ UniqPin.new(scene, i, @chip.chip_id, -70, ySig - 12, 0, yNum - 12, 0, y, -20, 6, false, api)
47
+ y = y + 14 # Space between each pin
48
+ elsif i > pin_by_side && i <= total_pin_nbr / 2
49
+ # Face 2
50
+ xSig2 = x
51
+ xNum2 = x
52
+ UniqPin.new(scene, i, @chip.chip_id, xSig2 - 12, cHeight + 55, xNum2 - 12, cHeight, x, cHeight, 6, 20, true, api)
53
+ x = x + 14
54
+ elsif i > total_pin_nbr / 2 && i <= (total_pin_nbr - (pin_by_side))
55
+ # Face 3
56
+ xSig = cHeight + 24
57
+ ySig = y2
58
+ yNum = y2
59
+
60
+ if i < 10
61
+ xNum = cHeight - 20
62
+ elsif i >= 10 && i < 100
63
+ xNum = cHeight - 25
64
+ else
65
+ xNum = cHeight - 35
66
+ end
67
+ UniqPin.new(scene, i, @chip.chip_id, xSig, ySig - 12, xNum, yNum - 12, cHeight, y2, 20, 6, false, api)
68
+ y2 = y2 - 14
69
+ else
70
+ # Face 4
71
+ xSig2 = x2
72
+ xNum2 = x2
73
+
74
+ if i < 10
75
+ yNum2 = 20
76
+ elsif i >= 10 && i < 100
77
+ yNum2 = 30
78
+ else
79
+ yNum2 = 40
80
+ end
81
+ UniqPin.new(scene, i, @chip.chip_id, xSig2 - 12, -20, xNum2 - 12, yNum2, x2, 0, 6, -20, true, api)
82
+ x2 = x2 - 14
83
+ end
84
+ end
85
+ # If it's a rectangle
86
+ else
87
+ pin_by_side = total_pin_nbr / 2
88
+ cHeight = 14 * (pin_by_side + 2) # +2 because we add a space equal to one pin for each corner
89
+ scene.addRect(Qt::RectF.new(0, 0, cHeight, cHeight))
90
+ # Add the pins + text
91
+ y = 18
92
+ y2 = cHeight - 24
93
+ (1..total_pin_nbr).each do |i|
94
+ # Face 1
95
+ if i <= total_pin_nbr / 2
96
+ ySig = y
97
+ yNum = y
98
+ UniqPin.new(scene, i, @chip.chip_id, -70, ySig - 12, 0, yNum - 12, 0, y, -20, 6, false, api)
99
+ y = y + 14
100
+ # Face 2
101
+ else
102
+ xSig = cHeight + 24
103
+ ySig = y2
104
+ yNum = y2
105
+
106
+ if i < 10
107
+ xNum = cHeight - 20
108
+ elsif i >= 10 && i < 100
109
+ xNum = cHeight - 25
110
+ else
111
+ xNum = cHeight - 35
112
+ end
113
+ UniqPin.new(scene, i, @chip.chip_id, xSig, ySig - 12, xNum, yNum - 12, cHeight, y2, 20, 6, false, api)
114
+ y2 = y2 - 14
115
+ end
116
+ end
117
+ end
118
+ # Draw!
119
+ @wire_helper_gui.gView.setScene(scene)
120
+ rescue Exception => msg
121
+ Qt::MessageBox.new(Qt::MessageBox::Critical, 'Critical error', 'Error occured while drawing the chip. Consult the logs for more details').exec
122
+ logger = Logger.new($logFilePath)
123
+ logger.error msg
124
+ end
125
+
126
+ def closeEvent(event)
127
+ @api.setWiringLeds(0xFF00FF00FF00FF00)
128
+ end
129
+
130
+ def rotate_scene
131
+ @wire_helper_gui.gView.rotate(90)
132
+ end
133
+ end
134
+
135
+ #
136
+ # Custom Item - To trigger events on the graphics text items
137
+ #
138
+ class CustomItem < Qt::GraphicsTextItem
139
+
140
+ def setPin(upin)
141
+ @UPin = upin
142
+ end
143
+
144
+ def boundingRect
145
+ rect = Qt::RectF.new
146
+ rect.setHeight(20)
147
+ rect.setWidth(65)
148
+ rect.setTop(5)
149
+ return rect
150
+ end
151
+
152
+ def mouseDoubleClickEvent(event)
153
+ begin
154
+ pin = self.instance_variable_get('@UPin')
155
+ pin.setColor
156
+ pin.instance_variable_get('@api').signalHelpingWiring(pin.instance_variable_get('@signalId'))
157
+ pin.instance_variable_get('@signalTxt').clearFocus
158
+ pin.instance_variable_get('@nbrTxt').clearFocus
159
+ rescue
160
+ pin.instance_variable_get('@api').setWiringLeds(0x0000000000000000)
161
+ pin.instance_variable_get('@signalTxt').clearFocus
162
+ pin.instance_variable_get('@nbrTxt').clearFocus
163
+ Qt::MessageBox.new(Qt::MessageBox::Critical, 'Signal not found', 'This signal is not handled by the board').exec
164
+ end
165
+ end
166
+
167
+ def mousePressEvent(event)
168
+ begin
169
+ pin = self.instance_variable_get('@UPin')
170
+ pin.setColor
171
+ pin.instance_variable_get('@api').signalHelpingWiring(pin.instance_variable_get('@signalId'))
172
+ pin.instance_variable_get('@signalTxt').clearFocus
173
+ pin.instance_variable_get('@nbrTxt').clearFocus
174
+ rescue
175
+ pin.instance_variable_get('@api').setWiringLeds(0x0000000000000000)
176
+ pin.instance_variable_get('@signalTxt').clearFocus
177
+ pin.instance_variable_get('@nbrTxt').clearFocus
178
+ Qt::MessageBox.new(Qt::MessageBox::Critical, 'Signal not found', 'This signal is not handled by the board').exec
179
+ end
180
+ end
181
+ end
182
+
183
+ #
184
+ # UniqPin - Contain all data linked to one pin on the graphic
185
+ #
186
+ class UniqPin
187
+ def initialize(scene, pinNum, pinChip, xSig, ySig, xNum, yNum, xRect, yRect, wRect, hRect, rotation, api)
188
+ currentPin = Pin.where(pin_number: pinNum, pin_chip: pinChip).pluck(:pin_signal)[0]
189
+ currentSignal = Signall.where(signal_id: currentPin).pluck(:signal_name)[0]
190
+ # Set the signal id
191
+ @signalId = currentSignal
192
+
193
+ @api = api
194
+ # Signal text
195
+ @signalTxt = CustomItem.new(currentSignal)
196
+ @signalTxt.cursor = Qt::Cursor.new(Qt::PointingHandCursor)
197
+ @signalTxt.setPin(self)
198
+ @signalTxt.setTextInteractionFlags(Qt::TextSelectableByMouse)
199
+ @signalTxt.setX(xSig)
200
+ @signalTxt.setY(ySig)
201
+ if rotation
202
+ @signalTxt.rotation = 270.00
203
+ end
204
+ scene.addItem(@signalTxt)
205
+
206
+ # Number text
207
+ @nbrTxt = CustomItem.new(pinNum.to_s)
208
+ @nbrTxt.cursor = Qt::Cursor.new(Qt::PointingHandCursor)
209
+ @nbrTxt.setPin(self)
210
+ @nbrTxt.setTextInteractionFlags(Qt::TextSelectableByMouse)
211
+ @nbrTxt.setX(xNum)
212
+ @nbrTxt.setY(yNum)
213
+ if rotation
214
+ @nbrTxt.rotation = 270.00
215
+ end
216
+ scene.addItem(@nbrTxt)
217
+
218
+ # Pin graphic
219
+ @pinGraphItem = scene.addRect(xRect, yRect, wRect, hRect)
220
+ end
221
+
222
+ def setColor
223
+ # Colors
224
+ @on = Qt::Color.new(0, 0, 255)
225
+ @off = Qt::Color.new(0, 0, 0)
226
+ # Disable the pin if a pin is already enabled
227
+ unless $pinEnabled.nil?
228
+ $pinEnabled.unsetColor
229
+ end
230
+ # Light the new pin
231
+ @nbrTxt.setDefaultTextColor(@on)
232
+ @signalTxt.setDefaultTextColor(@on)
233
+ @bold = Qt::Font.new
234
+ @bold.setBold(true)
235
+ @signalTxt.setFont(@bold)
236
+ $pinEnabled = self
237
+ end
238
+
239
+ def unsetColor
240
+ @nbrTxt.setDefaultTextColor(@off)
241
+ @signalTxt.setDefaultTextColor(@off)
242
+ @bold.setBold(false)
243
+ @signalTxt.setFont(@bold)
244
+ end
245
+
246
+ end
@@ -0,0 +1,125 @@
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 'sqlite3'
9
+ require 'active_record'
10
+
11
+ ActiveRecord::Base.establish_connection(
12
+ :adapter => 'sqlite3',
13
+ :database => File.expand_path(File.dirname(__FILE__)) + '/hs.db'
14
+ )
15
+
16
+ class Package < ActiveRecord::Base
17
+ self.table_name = "HS_PACKAGE"
18
+ has_many :chips,
19
+ foreign_key: "chip_package",
20
+ :dependent => :delete_all
21
+ end
22
+
23
+ class Manufacturer < ActiveRecord::Base
24
+ self.table_name = "HS_MANUFACTURER"
25
+ validates :manufacturer_name, uniqueness: true
26
+ has_many :chips,
27
+ foreign_key: "chip_manufacturer",
28
+ :dependent => :delete_all
29
+ end
30
+
31
+ class CType < ActiveRecord::Base
32
+ self.table_name = "HS_CHIP_TYPE"
33
+ validates :cType_name, uniqueness: true
34
+ has_many :chips,
35
+ foreign_key: "chip_type",
36
+ :dependent => :delete_all
37
+ end
38
+
39
+ class Chip < ActiveRecord::Base
40
+ self.table_name = "HS_CHIP"
41
+ belongs_to :package
42
+ belongs_to :manufacturer,
43
+ foreign_key: "chip_manufacturer"
44
+ belongs_to :ctype,
45
+ class_name: "CType",
46
+ foreign_key: "chip_type"
47
+ has_many :pin,
48
+ foreign_key: "pin_chip",
49
+ :dependent => :delete_all
50
+ has_many :cmd,
51
+ foreign_key: "cmd_chip",
52
+ :dependent => :delete_all
53
+ end
54
+
55
+ class Parallel < ActiveRecord::Base
56
+ self.table_name = "HS_PARAM_PARA"
57
+ belongs_to :chip,
58
+ class_name: "Chip",
59
+ foreign_key: "parallel_chip"
60
+ end
61
+
62
+ class Spi < ActiveRecord::Base
63
+ self.table_name = "HS_PARAM_SPI"
64
+ belongs_to :chip,
65
+ class_name: "Chip",
66
+ foreign_key: "spi_chip"
67
+ end
68
+
69
+ class I2C < ActiveRecord::Base
70
+ self.table_name = "HS_PARAM_I2C"
71
+ belongs_to :chip,
72
+ class_name: "Chip",
73
+ foreign_key: "i2c_chip"
74
+ end
75
+
76
+ class Pin < ActiveRecord::Base
77
+ self.table_name = "HS_PIN"
78
+ belongs_to :chip
79
+ belongs_to :signall,
80
+ class_name: "Signall",
81
+ foreign_key: "pin_signal"
82
+ end
83
+
84
+ class Signall < ActiveRecord::Base
85
+ self.table_name = "HS_SIGNAL"
86
+ has_many :use,
87
+ class_name: "Use",
88
+ foreign_key: "signal_id"
89
+ has_many :bus, through: :use
90
+ has_many :pin
91
+ end
92
+
93
+ class Use < ActiveRecord::Base
94
+ self.table_name = "HS_USE"
95
+ belongs_to :signall,
96
+ class_name: "Signall",
97
+ foreign_key: "signal_id"
98
+ belongs_to :bus,
99
+ class_name: "Bus",
100
+ foreign_key: "bus_id"
101
+ end
102
+
103
+ class Bus < ActiveRecord::Base
104
+ self.table_name = "HS_BUS"
105
+ has_many :signall, through: :use
106
+ has_many :cmd
107
+ end
108
+
109
+ class Cmd < ActiveRecord::Base
110
+ self.table_name = "HS_CMD"
111
+ has_many :byte,
112
+ foreign_key: "byte_cmd",
113
+ :dependent => :delete_all
114
+ belongs_to :bus,
115
+ class_name: "Bus",
116
+ foreign_key: "cmd_bus"
117
+ belongs_to :chip
118
+ end
119
+
120
+ class Byte < ActiveRecord::Base
121
+ self.table_name = "HS_CMD_BYTE"
122
+ belongs_to :cmd,
123
+ class_name: "Cmd",
124
+ foreign_key: "byte_cmd"
125
+ end
data/lib/db/hs.db ADDED
Binary file
@@ -0,0 +1,355 @@
1
+ =begin
2
+ ** Form generated from reading ui file 'gui_chip_editor.ui'
3
+ **
4
+ ** Created: mar. déc. 22 16:54:43 2015
5
+ ** by: Qt User Interface Compiler version 4.8.6
6
+ **
7
+ ** WARNING! All changes made in this file will be lost when recompiling ui file!
8
+ =end
9
+
10
+ class Ui_Chip_editor
11
+ attr_reader :gridLayout
12
+ attr_reader :tbl_pins
13
+ attr_reader :lbl_advice
14
+ attr_reader :hl
15
+ attr_reader :hs
16
+ attr_reader :btn_cancel
17
+ attr_reader :btn_add
18
+ attr_reader :vl
19
+ attr_reader :fl
20
+ attr_reader :lbl_ref
21
+ attr_reader :lbl_package
22
+ attr_reader :hl1
23
+ attr_reader :cbx_package
24
+ attr_reader :btn_pack_remove
25
+ attr_reader :lbl_pack_new
26
+ attr_reader :lbl_name
27
+ attr_reader :lie_pack_name
28
+ attr_reader :lbl_pack_pin
29
+ attr_reader :lie_pack_pin
30
+ attr_reader :lbl_pack_shape
31
+ attr_reader :lie_reference
32
+ attr_reader :hl2
33
+ attr_reader :groupBox
34
+ attr_reader :rbn_3v
35
+ attr_reader :rbn_5v
36
+ attr_reader :lbl_voltage
37
+ attr_reader :hl3
38
+ attr_reader :groupBox_2
39
+ attr_reader :rbn_square
40
+ attr_reader :rbn_rectangular
41
+ attr_reader :lbl_manu
42
+ attr_reader :lie_manu_name
43
+ attr_reader :lbl_type
44
+ attr_reader :hl5
45
+ attr_reader :cbx_type
46
+ attr_reader :btn_type_remove
47
+ attr_reader :lie_type_name
48
+ attr_reader :lbl_description
49
+ attr_reader :lie_description
50
+ attr_reader :hl4
51
+ attr_reader :cbx_manufacturer
52
+ attr_reader :btn_manu_remove
53
+
54
+ def setupUi(chip_editor)
55
+ if chip_editor.objectName.nil?
56
+ chip_editor.objectName = "chip_editor"
57
+ end
58
+ chip_editor.resize(414, 594)
59
+ @gridLayout = Qt::GridLayout.new(chip_editor)
60
+ @gridLayout.objectName = "gridLayout"
61
+ @tbl_pins = Qt::TableWidget.new(chip_editor)
62
+ @tbl_pins.objectName = "tbl_pins"
63
+ @tbl_pins.minimumSize = Qt::Size.new(0, 200)
64
+ @tbl_pins.maximumSize = Qt::Size.new(16777215, 16777215)
65
+
66
+ @gridLayout.addWidget(@tbl_pins, 1, 0, 1, 1)
67
+
68
+ @lbl_advice = Qt::Label.new(chip_editor)
69
+ @lbl_advice.objectName = "lbl_advice"
70
+
71
+ @gridLayout.addWidget(@lbl_advice, 2, 0, 1, 1)
72
+
73
+ @hl = Qt::HBoxLayout.new()
74
+ @hl.objectName = "hl"
75
+ @hs = Qt::SpacerItem.new(40, 20, Qt::SizePolicy::Expanding, Qt::SizePolicy::Minimum)
76
+
77
+ @hl.addItem(@hs)
78
+
79
+ @btn_cancel = Qt::PushButton.new(chip_editor)
80
+ @btn_cancel.objectName = "btn_cancel"
81
+
82
+ @hl.addWidget(@btn_cancel)
83
+
84
+ @btn_add = Qt::PushButton.new(chip_editor)
85
+ @btn_add.objectName = "btn_add"
86
+
87
+ @hl.addWidget(@btn_add)
88
+
89
+
90
+ @gridLayout.addLayout(@hl, 3, 0, 1, 1)
91
+
92
+ @vl = Qt::VBoxLayout.new()
93
+ @vl.objectName = "vl"
94
+ @fl = Qt::FormLayout.new()
95
+ @fl.objectName = "fl"
96
+ @lbl_ref = Qt::Label.new(chip_editor)
97
+ @lbl_ref.objectName = "lbl_ref"
98
+
99
+ @fl.setWidget(0, Qt::FormLayout::LabelRole, @lbl_ref)
100
+
101
+ @lbl_package = Qt::Label.new(chip_editor)
102
+ @lbl_package.objectName = "lbl_package"
103
+
104
+ @fl.setWidget(7, Qt::FormLayout::LabelRole, @lbl_package)
105
+
106
+ @hl1 = Qt::HBoxLayout.new()
107
+ @hl1.objectName = "hl1"
108
+ @cbx_package = Qt::ComboBox.new(chip_editor)
109
+ @cbx_package.objectName = "cbx_package"
110
+
111
+ @hl1.addWidget(@cbx_package)
112
+
113
+ @btn_pack_remove = Qt::PushButton.new(chip_editor)
114
+ @btn_pack_remove.objectName = "btn_pack_remove"
115
+ @btn_pack_remove.maximumSize = Qt::Size.new(30, 16777215)
116
+
117
+ @hl1.addWidget(@btn_pack_remove)
118
+
119
+
120
+ @fl.setLayout(7, Qt::FormLayout::FieldRole, @hl1)
121
+
122
+ @lbl_pack_new = Qt::Label.new(chip_editor)
123
+ @lbl_pack_new.objectName = "lbl_pack_new"
124
+
125
+ @fl.setWidget(10, Qt::FormLayout::LabelRole, @lbl_pack_new)
126
+
127
+ @lbl_name = Qt::Label.new(chip_editor)
128
+ @lbl_name.objectName = "lbl_name"
129
+
130
+ @fl.setWidget(11, Qt::FormLayout::LabelRole, @lbl_name)
131
+
132
+ @lie_pack_name = Qt::LineEdit.new(chip_editor)
133
+ @lie_pack_name.objectName = "lie_pack_name"
134
+ @lie_pack_name.maxLength = 30
135
+
136
+ @fl.setWidget(11, Qt::FormLayout::FieldRole, @lie_pack_name)
137
+
138
+ @lbl_pack_pin = Qt::Label.new(chip_editor)
139
+ @lbl_pack_pin.objectName = "lbl_pack_pin"
140
+
141
+ @fl.setWidget(12, Qt::FormLayout::LabelRole, @lbl_pack_pin)
142
+
143
+ @lie_pack_pin = Qt::LineEdit.new(chip_editor)
144
+ @lie_pack_pin.objectName = "lie_pack_pin"
145
+ @lie_pack_pin.maxLength = 3
146
+
147
+ @fl.setWidget(12, Qt::FormLayout::FieldRole, @lie_pack_pin)
148
+
149
+ @lbl_pack_shape = Qt::Label.new(chip_editor)
150
+ @lbl_pack_shape.objectName = "lbl_pack_shape"
151
+
152
+ @fl.setWidget(13, Qt::FormLayout::LabelRole, @lbl_pack_shape)
153
+
154
+ @lie_reference = Qt::LineEdit.new(chip_editor)
155
+ @lie_reference.objectName = "lie_reference"
156
+ @lie_reference.maxLength = 30
157
+
158
+ @fl.setWidget(0, Qt::FormLayout::FieldRole, @lie_reference)
159
+
160
+ @hl2 = Qt::HBoxLayout.new()
161
+ @hl2.objectName = "hl2"
162
+ @groupBox = Qt::GroupBox.new(chip_editor)
163
+ @groupBox.objectName = "groupBox"
164
+ @rbn_3v = Qt::RadioButton.new(@groupBox)
165
+ @rbn_3v.objectName = "rbn_3v"
166
+ @rbn_3v.geometry = Qt::Rect.new(10, 0, 70, 21)
167
+ @rbn_3v.checked = true
168
+ @rbn_3v.autoExclusive = true
169
+ @rbn_5v = Qt::RadioButton.new(@groupBox)
170
+ @rbn_5v.objectName = "rbn_5v"
171
+ @rbn_5v.geometry = Qt::Rect.new(90, 0, 109, 21)
172
+ @rbn_5v.autoExclusive = true
173
+
174
+ @hl2.addWidget(@groupBox)
175
+
176
+
177
+ @fl.setLayout(2, Qt::FormLayout::FieldRole, @hl2)
178
+
179
+ @lbl_voltage = Qt::Label.new(chip_editor)
180
+ @lbl_voltage.objectName = "lbl_voltage"
181
+
182
+ @fl.setWidget(2, Qt::FormLayout::LabelRole, @lbl_voltage)
183
+
184
+ @hl3 = Qt::HBoxLayout.new()
185
+ @hl3.objectName = "hl3"
186
+ @groupBox_2 = Qt::GroupBox.new(chip_editor)
187
+ @groupBox_2.objectName = "groupBox_2"
188
+ @rbn_square = Qt::RadioButton.new(@groupBox_2)
189
+ @rbn_square.objectName = "rbn_square"
190
+ @rbn_square.geometry = Qt::Rect.new(10, 0, 81, 20)
191
+ @rbn_square.checked = true
192
+ @rbn_square.autoExclusive = true
193
+ @rbn_rectangular = Qt::RadioButton.new(@groupBox_2)
194
+ @rbn_rectangular.objectName = "rbn_rectangular"
195
+ @rbn_rectangular.geometry = Qt::Rect.new(110, 0, 109, 20)
196
+ @rbn_rectangular.checked = false
197
+ @rbn_rectangular.autoExclusive = true
198
+
199
+ @hl3.addWidget(@groupBox_2)
200
+
201
+
202
+ @fl.setLayout(13, Qt::FormLayout::FieldRole, @hl3)
203
+
204
+ @lbl_manu = Qt::Label.new(chip_editor)
205
+ @lbl_manu.objectName = "lbl_manu"
206
+
207
+ @fl.setWidget(3, Qt::FormLayout::LabelRole, @lbl_manu)
208
+
209
+ @lie_manu_name = Qt::LineEdit.new(chip_editor)
210
+ @lie_manu_name.objectName = "lie_manu_name"
211
+ @lie_manu_name.maxLength = 30
212
+
213
+ @fl.setWidget(4, Qt::FormLayout::FieldRole, @lie_manu_name)
214
+
215
+ @lbl_type = Qt::Label.new(chip_editor)
216
+ @lbl_type.objectName = "lbl_type"
217
+
218
+ @fl.setWidget(5, Qt::FormLayout::LabelRole, @lbl_type)
219
+
220
+ @hl5 = Qt::HBoxLayout.new()
221
+ @hl5.objectName = "hl5"
222
+ @cbx_type = Qt::ComboBox.new(chip_editor)
223
+ @cbx_type.objectName = "cbx_type"
224
+
225
+ @hl5.addWidget(@cbx_type)
226
+
227
+ @btn_type_remove = Qt::PushButton.new(chip_editor)
228
+ @btn_type_remove.objectName = "btn_type_remove"
229
+ @btn_type_remove.maximumSize = Qt::Size.new(30, 16777215)
230
+
231
+ @hl5.addWidget(@btn_type_remove)
232
+
233
+
234
+ @fl.setLayout(5, Qt::FormLayout::FieldRole, @hl5)
235
+
236
+ @lie_type_name = Qt::LineEdit.new(chip_editor)
237
+ @lie_type_name.objectName = "lie_type_name"
238
+ @lie_type_name.maxLength = 30
239
+
240
+ @fl.setWidget(6, Qt::FormLayout::FieldRole, @lie_type_name)
241
+
242
+ @lbl_description = Qt::Label.new(chip_editor)
243
+ @lbl_description.objectName = "lbl_description"
244
+
245
+ @fl.setWidget(1, Qt::FormLayout::LabelRole, @lbl_description)
246
+
247
+ @lie_description = Qt::LineEdit.new(chip_editor)
248
+ @lie_description.objectName = "lie_description"
249
+ @lie_description.maxLength = 200
250
+
251
+ @fl.setWidget(1, Qt::FormLayout::FieldRole, @lie_description)
252
+
253
+ @hl4 = Qt::HBoxLayout.new()
254
+ @hl4.objectName = "hl4"
255
+ @cbx_manufacturer = Qt::ComboBox.new(chip_editor)
256
+ @cbx_manufacturer.objectName = "cbx_manufacturer"
257
+
258
+ @hl4.addWidget(@cbx_manufacturer)
259
+
260
+ @btn_manu_remove = Qt::PushButton.new(chip_editor)
261
+ @btn_manu_remove.objectName = "btn_manu_remove"
262
+ @btn_manu_remove.maximumSize = Qt::Size.new(30, 16777215)
263
+
264
+ @hl4.addWidget(@btn_manu_remove)
265
+
266
+
267
+ @fl.setLayout(3, Qt::FormLayout::FieldRole, @hl4)
268
+
269
+
270
+ @vl.addLayout(@fl)
271
+
272
+
273
+ @gridLayout.addLayout(@vl, 0, 0, 1, 1)
274
+
275
+
276
+ retranslateUi(chip_editor)
277
+ Qt::Object.connect(@lie_pack_pin, SIGNAL('editingFinished()'), chip_editor, SLOT('fill_pin_table()'))
278
+ Qt::Object.connect(@btn_manu_remove, SIGNAL('clicked()'), chip_editor, SLOT('delete_cbx_element()'))
279
+ Qt::Object.connect(@btn_type_remove, SIGNAL('clicked()'), chip_editor, SLOT('delete_cbx_element()'))
280
+ Qt::Object.connect(@btn_pack_remove, SIGNAL('clicked()'), chip_editor, SLOT('delete_cbx_element()'))
281
+ Qt::Object.connect(@cbx_package, SIGNAL('currentIndexChanged(int)'), chip_editor, SLOT('select_package()'))
282
+ Qt::Object.connect(@cbx_type, SIGNAL('currentIndexChanged(int)'), chip_editor, SLOT('select_type()'))
283
+ Qt::Object.connect(@cbx_manufacturer, SIGNAL('currentIndexChanged(int)'), chip_editor, SLOT('select_manufacturer()'))
284
+ Qt::Object.connect(@btn_cancel, SIGNAL('clicked()'), chip_editor, SLOT('close()'))
285
+
286
+ Qt::MetaObject.connectSlotsByName(chip_editor)
287
+ end # setupUi
288
+
289
+ def setup_ui(chip_editor)
290
+ setupUi(chip_editor)
291
+ end
292
+
293
+ def retranslateUi(chip_editor)
294
+ chip_editor.windowTitle = Qt::Application.translate("Chip_editor", "Hardsploit - Chip editor", nil, Qt::Application::UnicodeUTF8)
295
+ if @tbl_pins.columnCount < 3
296
+ @tbl_pins.columnCount = 3
297
+ end
298
+
299
+ __colItem = Qt::TableWidgetItem.new
300
+ __colItem.setText(Qt::Application.translate("Chip_editor", "Pin Number", nil, Qt::Application::UnicodeUTF8))
301
+ @tbl_pins.setHorizontalHeaderItem(0, __colItem)
302
+
303
+ __colItem1 = Qt::TableWidgetItem.new
304
+ __colItem1.setText(Qt::Application.translate("Chip_editor", "Bus", nil, Qt::Application::UnicodeUTF8))
305
+ @tbl_pins.setHorizontalHeaderItem(1, __colItem1)
306
+
307
+ __colItem2 = Qt::TableWidgetItem.new
308
+ __colItem2.setText(Qt::Application.translate("Chip_editor", "Signal", nil, Qt::Application::UnicodeUTF8))
309
+ @tbl_pins.setHorizontalHeaderItem(2, __colItem2)
310
+ @lbl_advice.text = Qt::Application.translate("Chip_editor", "To complete this form, please report to the component datasheet.", nil, Qt::Application::UnicodeUTF8)
311
+ @btn_cancel.text = Qt::Application.translate("Chip_editor", "Cancel", nil, Qt::Application::UnicodeUTF8)
312
+ @btn_add.text = Qt::Application.translate("Chip_editor", "Add", nil, Qt::Application::UnicodeUTF8)
313
+ @lbl_ref.text = Qt::Application.translate("Chip_editor", "Name / Reference:", nil, Qt::Application::UnicodeUTF8)
314
+ @lbl_package.text = Qt::Application.translate("Chip_editor", "Package:", nil, Qt::Application::UnicodeUTF8)
315
+ @cbx_package.insertItems(0, [Qt::Application.translate("Chip_editor", "Select...", nil, Qt::Application::UnicodeUTF8)])
316
+ @btn_pack_remove.text = Qt::Application.translate("Chip_editor", "X", nil, Qt::Application::UnicodeUTF8)
317
+ @lbl_pack_new.text = Qt::Application.translate("Chip_editor", "Not in the list ? Create a new one", nil, Qt::Application::UnicodeUTF8)
318
+ @lbl_name.text = Qt::Application.translate("Chip_editor", "Package name:", nil, Qt::Application::UnicodeUTF8)
319
+ @lie_pack_name.placeholderText = Qt::Application.translate("Chip_editor", "30 chars max", nil, Qt::Application::UnicodeUTF8)
320
+ @lbl_pack_pin.text = Qt::Application.translate("Chip_editor", "Package pin number:", nil, Qt::Application::UnicodeUTF8)
321
+ @lie_pack_pin.inputMask = ''
322
+ @lie_pack_pin.placeholderText = Qt::Application.translate("Chip_editor", "4-144", nil, Qt::Application::UnicodeUTF8)
323
+ @lbl_pack_shape.text = Qt::Application.translate("Chip_editor", "Package shape:", nil, Qt::Application::UnicodeUTF8)
324
+ @lie_reference.placeholderText = Qt::Application.translate("Chip_editor", "30 chars max", nil, Qt::Application::UnicodeUTF8)
325
+ @groupBox.title = ''
326
+ @rbn_3v.text = Qt::Application.translate("Chip_editor", "3,3V", nil, Qt::Application::UnicodeUTF8)
327
+ @rbn_5v.text = Qt::Application.translate("Chip_editor", "5V", nil, Qt::Application::UnicodeUTF8)
328
+ @lbl_voltage.text = Qt::Application.translate("Chip_editor", "Voltage:", nil, Qt::Application::UnicodeUTF8)
329
+ @groupBox_2.title = ''
330
+ @rbn_square.text = Qt::Application.translate("Chip_editor", "Square", nil, Qt::Application::UnicodeUTF8)
331
+ @rbn_rectangular.text = Qt::Application.translate("Chip_editor", "Rectangular", nil, Qt::Application::UnicodeUTF8)
332
+ @lbl_manu.text = Qt::Application.translate("Chip_editor", "Manufacturer:", nil, Qt::Application::UnicodeUTF8)
333
+ @lie_manu_name.placeholderText = Qt::Application.translate("Chip_editor", "Other...", nil, Qt::Application::UnicodeUTF8)
334
+ @lbl_type.text = Qt::Application.translate("Chip_editor", "Type:", nil, Qt::Application::UnicodeUTF8)
335
+ @cbx_type.insertItems(0, [Qt::Application.translate("Chip_editor", "Select...", nil, Qt::Application::UnicodeUTF8)])
336
+ @btn_type_remove.text = Qt::Application.translate("Chip_editor", "X", nil, Qt::Application::UnicodeUTF8)
337
+ @lie_type_name.text = ''
338
+ @lie_type_name.placeholderText = Qt::Application.translate("Chip_editor", "Other...", nil, Qt::Application::UnicodeUTF8)
339
+ @lbl_description.text = Qt::Application.translate("Chip_editor", "Description:", nil, Qt::Application::UnicodeUTF8)
340
+ @lie_description.placeholderText = Qt::Application.translate("Chip_editor", "200 chars max", nil, Qt::Application::UnicodeUTF8)
341
+ @cbx_manufacturer.insertItems(0, [Qt::Application.translate("Chip_editor", "Select...", nil, Qt::Application::UnicodeUTF8)])
342
+ @btn_manu_remove.text = Qt::Application.translate("Chip_editor", "X", nil, Qt::Application::UnicodeUTF8)
343
+ end # retranslateUi
344
+
345
+ def retranslate_ui(chip_editor)
346
+ retranslateUi(chip_editor)
347
+ end
348
+
349
+ end
350
+
351
+ module Ui
352
+ class Chip_editor < Ui_Chip_editor
353
+ end
354
+ end # module Ui
355
+