Class: Hardsploit_gui

Inherits:
Object
  • Object
show all
Defined in:
lib/Hardsploit_gui.rb

Constant Summary collapse

VERSION =
"2.4.0"

Instance Method Summary collapse

Constructor Details

#initializeHardsploit_gui

Returns a new instance of Hardsploit_gui.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/Hardsploit_gui.rb', line 22

def initialize
  HardsploitAPI.callbackInfo = method(:callbackInfo)
  HardsploitAPI.callbackData = method(:callbackData)
  HardsploitAPI.callbackSpeedOfTransfert = method(:callbackSpeedOfTransfert)
  HardsploitAPI.callbackProgress = method(:callbackProgress)
  $file = nil
  $currentFirmware = nil
  $logFilePath = File.expand_path(File.dirname(__FILE__)) + "/logs/error.log"
  $dbFilePath = File.expand_path(File.dirname(__FILE__)) + "/db/hs.db"
  # Launch GUI
  Qt::Application.new(ARGV) do
    $app = self
    w = Chip_management.new(VERSION)
    centerWindow(w)
    w.show
    exec
  end
end

Instance Method Details

#callbackData(receiveData) ⇒ Object



59
60
61
# File 'lib/Hardsploit_gui.rb', line 59

def callbackData(receiveData)
  $file.write(receiveData.pack('C*'))
end

#callbackInfo(receiveData) ⇒ Object



41
42
43
# File 'lib/Hardsploit_gui.rb', line 41

def callbackInfo(receiveData)
  print receiveData  + "\n"
end

#callbackProgress(percent:, startTime:, endTime:) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/Hardsploit_gui.rb', line 45

def callbackProgress(percent:, startTime:, endTime:)
  print "\r\e[#{31}mIn progress : #{percent}%\e[0m"
  $pgb.update_value(percent) unless $pgb.nil?
  if percent == 100
    duration = (endTime-startTime).round(2)
    $pgb.display_time("Total duration: #{duration} second(s)")
  end
  $app.processEvents
end

#callbackSpeedOfTransfert(receiveData) ⇒ Object



55
56
57
# File 'lib/Hardsploit_gui.rb', line 55

def callbackSpeedOfTransfert(receiveData)
  #puts receiveData
end

#check_ReceivedDataObject



63
64
65
# File 'lib/Hardsploit_gui.rb', line 63

def check_ReceivedData
  result = HardsploitAPI.receiveDATA(2000)
end