Top Level Namespace

Defined Under Namespace

Modules: Ui Classes: Bus, Byte, CType, Chip, ChipType, 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_export, I2c_import, I2c_scanner, I2c_settings, Import, Manufacturer, Package, Parallel, ParallelSetting, Parallel_export, Parallel_import, Parallel_settings, Pin, Progress_bar, SWD_DEBUG_PORT, SWD_MEM_AP, SWD_STM32, Signal_mapper, Signall, Spi, SpiSetting, Spi_export, Spi_import, Spi_settings, Spi_sniffer, String, Swd, SwdSetting, Swd_scanner, Swd_settings, UartSetting, Uart_baudrate, Uart_console, Uart_settings, Ui_Chip_editor, Ui_Chip_management, Ui_Command_editor, Ui_Export, Ui_Export_manager, Ui_Generic_commands, Ui_Generic_export, Ui_Generic_import, Ui_I2c_command, Ui_I2c_settings, Ui_Import, Ui_Parallel_settings, Ui_Progress_bar, Ui_Signal_mapper, Ui_Signal_scanner, Ui_Spi_import, 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__)) + "/"

Constants included from VersionUC::VERSION_UC

VersionUC::VERSION_UC::UC

Constants included from VersionFPGA::VERSION_FPGA

VersionFPGA::VERSION_FPGA::FPGA

Instance Method Summary collapse

Instance Method Details

#centerWindow(win) ⇒ Object



90
91
92
93
94
95
96
# File 'lib/Hardsploit_gui.rb', line 90

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



68
69
70
71
72
73
74
75
76
# File 'lib/Hardsploit_gui.rb', line 68

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_rectObject



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) # +2 because we add a space equal to one pin for each corner
  @scene.addRect(Qt::RectF.new(0, 0, cHeight, cHeight))
  # Add the pins + text
  y = 18
  y2 = cHeight - 24
  (1..total_pin_nbr).each do |i|
    # Face 1
    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
    # Face 2
    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_squareObject



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)  # Chip's height (+4 because we add a space equal to one pin for each corner)
  @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|
    # Face 1
    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 # Space between each pin
    elsif i > pin_by_side && i <= total_pin_nbr / 2
    # Face 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))
    # Face 3
      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
    # Face 4
      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

#inputRestrict(lineEdit, type) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
# File 'lib/Hardsploit_gui.rb', line 78

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