Class: Hardsploit_GUI
- Inherits:
-
Object
- Object
- Hardsploit_GUI
- Defined in:
- lib/hardsploit.rb
Instance Method Summary collapse
- #callbackData(receiveData) ⇒ Object
- #callbackError(receiveData) ⇒ Object
-
#callbackInfo(receiveData) ⇒ Object
CALLBACK.
- #callbackSpeedOfTransfert(receiveData) ⇒ Object
- #check_ReceivedData ⇒ Object
- #check_SendData(value) ⇒ Object
-
#initialize ⇒ Hardsploit_GUI
constructor
A new instance of Hardsploit_GUI.
Constructor Details
#initialize ⇒ Hardsploit_GUI
Returns a new instance of Hardsploit_GUI.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/hardsploit.rb', line 33 def initialize # Launch API hardAPI = HardsploitAPI.new(method(:callbackData),method(:callbackInfo),method(:callbackError),method(:callbackSpeedOfTransfert)) $file = nil $currentFirmware = nil $usbConnected = nil $logFilePath = File.(File.dirname(__FILE__)) + "/logs/error.log" $dbFilePath = File.(File.dirname(__FILE__)) + "/db/hs.db" # Launch GUI Qt::Application.new(ARGV) do w = HardsploitGUI.new(hardAPI) centerWindow(w) w.show exec end end |
Instance Method Details
#callbackData(receiveData) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/hardsploit.rb', line 66 def callbackData(receiveData) begin $file.write(receiveData.pack('C*')) rescue Qt::MessageBox.new(Qt::MessageBox::Critical, "Critical error", "Error occured when opening the dump file. Consult the logs for more details").exec end end |
#callbackError(receiveData) ⇒ Object
58 59 60 |
# File 'lib/hardsploit.rb', line 58 def callbackError(receiveData) print receiveData + "\n" end |
#callbackInfo(receiveData) ⇒ Object
CALLBACK
54 55 56 |
# File 'lib/hardsploit.rb', line 54 def callbackInfo(receiveData) print receiveData + "\n" end |
#callbackSpeedOfTransfert(receiveData) ⇒ Object
62 63 64 |
# File 'lib/hardsploit.rb', line 62 def callbackSpeedOfTransfert(receiveData) puts receiveData end |
#check_ReceivedData ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/hardsploit.rb', line 74 def check_ReceivedData result = hardAPI.receiveDATA(2000) case result when HardsploitAPI::USB_STATE::BUSY puts "BUSY" when HardsploitAPI::USB_STATE::TIMEOUT_RECEIVE puts "TIMEOUT_RECEIVE\n" else puts "Received" p result end end |
#check_SendData(value) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/hardsploit.rb', line 87 def check_SendData(value) case value when HardsploitAPI::USB_STATE::SUCCESSFUL_SEND puts "SUCCESSFUL_SEND" when HardsploitAPI::USB_STATE::PACKET_IS_TOO_LARGE puts "PACKET_IS_TOO_LARGE max: #{USB::USB_TRAME_SIZE}" when HardsploitAPI::USB_STATE::ERROR_SEND puts "ERROR_SEND\n" else puts "UNKNOWN SEND STATE" end end |