Class: HackEx::Action
- Inherits:
-
Object
- Object
- HackEx::Action
- Defined in:
- lib/libGoo/hackex/action.rb
Class Method Summary collapse
- .AddContact(http, user_id1, auth_token1, user_id2, auth_token2) ⇒ Object
- .Login(http, email, password) ⇒ Object
- .PrepareToCrack(http, auth_token, params = {}) ⇒ Object
- .PrepareToCrackAndSpam(http, auth_token, params = {}) ⇒ Object
- .PrepareToSpam(http, auth_token, params = {}) ⇒ Object
- .ProcessClean(http, auth_token, params = {}) ⇒ Object
- .PurchaseMissingSoftware(http, auth_token, items, params = {}) ⇒ Object
-
.StartBypass(http, auth_token, victim_user_id, params = {}) ⇒ Object
start crack process.
- .StartCrack(http, auth_token, victim_user_id, params = {}) ⇒ Object
-
.StartProcess(http, auth_token, victim_user_id, mode, params = {}) ⇒ Object
start single process.
- .StartSpam(http, auth_token, victim_user_id, params = {}) ⇒ Object
-
.UserBank(http, auth_token) ⇒ Object
return empty array [] in case of any error.
-
.UserProcesses(http, auth_token) ⇒ Object
return empty array [] in case of any error.
-
.UserSoftware(http, auth_token) ⇒ Object
return empty array [] in case of any error.
-
.UserSpam(http, auth_token) ⇒ Object
return empty array [] in case of any error.
Class Method Details
.AddContact(http, user_id1, auth_token1, user_id2, auth_token2) ⇒ Object
10 11 12 13 14 |
# File 'lib/libGoo/hackex/action.rb', line 10 def AddContact http, user_id1, auth_token1, user_id2, auth_token2 # prevent failure json = HackEx::Request.Do(http, [HackEx::Request.AddContact(auth_token1, user_id2)]) json = HackEx::Request.Do(http, [HackEx::Request.AcceptContact(auth_token2, user_id1)]) end |
.Login(http, email, password) ⇒ Object
5 6 7 8 |
# File 'lib/libGoo/hackex/action.rb', line 5 def Login http, email, password json = HackEx::Request.Do(http, HackEx::Request.Login(email, password)) json['user'] end |
.PrepareToCrack(http, auth_token, params = {}) ⇒ Object
102 103 104 |
# File 'lib/libGoo/hackex/action.rb', line 102 def PrepareToCrack http, auth_token, params = {} PurchaseMissingSoftware http, auth_token, 'Password Cracker', params end |
.PrepareToCrackAndSpam(http, auth_token, params = {}) ⇒ Object
106 107 108 |
# File 'lib/libGoo/hackex/action.rb', line 106 def PrepareToCrackAndSpam http, auth_token, params = {} PurchaseMissingSoftware http, auth_token, ['Spam', 'Password Cracker'], params end |
.PrepareToSpam(http, auth_token, params = {}) ⇒ Object
98 99 100 |
# File 'lib/libGoo/hackex/action.rb', line 98 def PrepareToSpam http, auth_token, params = {} PurchaseMissingSoftware http, auth_token, 'Spam', params end |
.ProcessClean(http, auth_token, params = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/libGoo/hackex/action.rb', line 52 def ProcessClean http, auth_token, params = {} process_types = params.fetch(:process_types, [Helper.ProcessTypeId('download'), Helper.ProcessTypeId('upload')]) process_types = [process_types] unless process_types.is_a?(Array) process_statuses = params.fetch(:process_statuses, Helper.ProcessStatusId('ready')) process_statuses = [] unless process_statuses.is_a?(Array) user_processes = params.fetch(:user_processes, nil) user_processes ||= HackEx::Action.UserProcesses(http, auth_token) to_clean = [] ready_list = Helper.FilterHashArray user_processes, {'status' => process_statuses, 'process_type_id' => process_types} out_list = user_processes - ready_list ready_list.each do |p| to_clean << p['id'] end unless to_clean.empty? HackEx::Request.Do(http, HackEx::Request.ProcessesDelete(auth_token, to_clean)) end out_list end |
.PurchaseMissingSoftware(http, auth_token, items, params = {}) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/libGoo/hackex/action.rb', line 74 def PurchaseMissingSoftware http, auth_token, items, params = {} items = [items] unless items.is_a? Array user_software = params.fetch(:user_software, nil) user_software ||= HackEx::Action.UserSoftware(http, auth_token) sw = HackEx.ParseSoftware(user_software) res = true items.each do |item| unless sw.has_key? item puts "No #{item}, try to buy it" json = HackEx::Request.Do(http, HackEx::Request.StorePurchase(auth_token, 'software', HackEx::Helper.SoftwareId(item))) #puts res.inspect if json['success'].to_s != 'true' puts 'Error in buying' res = false end end end res end |
.StartBypass(http, auth_token, victim_user_id, params = {}) ⇒ Object
start crack process
216 217 218 |
# File 'lib/libGoo/hackex/action.rb', line 216 def StartBypass http, auth_token, victim_user_id, params = {} StartProcess http, auth_token, victim_user_id, 'bypass', params end |
.StartCrack(http, auth_token, victim_user_id, params = {}) ⇒ Object
220 221 222 |
# File 'lib/libGoo/hackex/action.rb', line 220 def StartCrack http, auth_token, victim_user_id, params = {} StartProcess http, auth_token, victim_user_id, 'crack', params end |
.StartProcess(http, auth_token, victim_user_id, mode, params = {}) ⇒ Object
start single process
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/libGoo/hackex/action.rb', line 112 def StartProcess http, auth_token, victim_user_id, mode, params = {} sw_victim = true case mode when 'bypass' action = 'bypass' sw_name = 'Firewall' add_param = params.fetch(:fw_add, 0) when 'crack' action = 'crack' sw_name = 'Password Encryptor' add_param = params.fetch(:enc_add, 0) when 'spam' action = 'upload' sw_name = 'Spam' add_param = 0 sw_victim = false when 'spyware' action = 'upload' sw_name = 'Spyware' add_param = 0 sw_victim = false else raise HackExError, "Incorrect mode #{mode}" end user_processes = params.fetch(:user_processes, nil) user_processes ||= HackEx::Action.UserProcesses(http, auth_token) software_id = params.fetch(:software_id, nil) software_level = params.fetch(:software_level, nil) if software_id.nil? || software_level.nil? if sw_victim victim_user = params.fetch(:victim_user, nil) victim_user ||= HackEx::Request.Do(http, HackEx::Request.VictimInfo(auth_token, victim_user_id)) victim_sws = victim_user['user_software'] else user_software = params.fetch(:user_software, nil) user_software ||= HackEx::Action.UserSoftware(http, auth_token) victim_sws = user_software #puts victim_sws.inspect end victim_sw = Helper.FilterHashArray victim_sws, {'software_type_id' => Helper.SoftwareId(sw_name)} #puts victim_sw.inspect if action == 'upload' unless victim_sw.empty? software_id = victim_sw.first['software_id'] software_level = victim_sw.first['software_level'] else puts "No #{sw_name} on #{sw_victim ? 'victim' : 'us'} is found" software_level = 1 end end # need levels software_need_level = software_level.to_i + add_param.to_i software_need_level = params[:level].to_i if params.has_key?(:level) software_need_level = 1 if software_need_level.to_i < 1 puts "Process #{mode} user #{victim_user_id}, sw level #{software_need_level} (current #{software_level.to_i})" scan_processes = Helper.FilterHashArray user_processes, {'process_type_id' => Helper.ProcessTypeId(action), 'victim_user_id' => victim_user_id} unless scan_processes.empty? # check is it ok or not if scan_processes.size > 1 # todo: handle better more than 1 process at the same time # now - as incorrect situation, just remove everything to_clean = [] scan_processes.each do |p| to_clean << p['id'] end puts "More than 1 existing #{mode} processes, delete everything" HackEx::Request.Do(http, HackEx::Request.ProcessesDelete(auth_token, to_clean)) scan_processes = [] else scan_process = scan_processes.first scan_process_sw_level = scan_process['software_level'] scan_process_sw_id = scan_process['software_id'] if scan_process_sw_level.to_i < software_need_level.to_i || scan_process_sw_id.to_s != software_id.to_s puts "Existing process sw level #{scan_process_sw_level.to_i} < #{software_need_level.to_i} or sw id #{scan_process_sw_id.to_s} != #{software_id.to_s}" HackEx::Request.Do(http, HackEx::Request.ProcessDelete(auth_token, scan_process['id'])) scan_processes = [] elsif scan_process['status'].to_s == Helper.ProcessStatusId('failed').to_s puts "Retry process #{scan_process['id']}" HackEx::Request.Do(http, HackEx::Request.ProcessRetry(auth_token, scan_process['id'])) elsif scan_process['status'].to_s == Helper.ProcessStatusId('ready').to_s puts "Ready process #{scan_process['id']} found" elsif scan_process['status'].to_s == Helper.ProcessStatusId('progress').to_s puts "In progress process #{scan_process['id']} found" end end end if scan_processes.empty? puts "Add #{mode} process user #{victim_user_id} sw id #{software_id} level #{software_need_level}" json = HackEx::Request.Do(http, HackEx::Request.UserAddProcess(auth_token, victim_user_id, action, software_id, software_need_level))['user_processes'][0] puts "Process #{json['id']} is added" json else scan_processes.first end end |
.StartSpam(http, auth_token, victim_user_id, params = {}) ⇒ Object
224 225 226 |
# File 'lib/libGoo/hackex/action.rb', line 224 def StartSpam http, auth_token, victim_user_id, params = {} StartProcess http, auth_token, victim_user_id, 'spam', params end |
.UserBank(http, auth_token) ⇒ Object
return empty array [] in case of any error
17 18 19 20 21 22 23 |
# File 'lib/libGoo/hackex/action.rb', line 17 def UserBank http, auth_token json = HackEx::Request.Do(http, HackEx::Request.UserBank(auth_token)) json['user_bank'] || {} rescue # ok {} end |
.UserProcesses(http, auth_token) ⇒ Object
return empty array [] in case of any error
26 27 28 29 30 31 32 |
# File 'lib/libGoo/hackex/action.rb', line 26 def UserProcesses http, auth_token json = HackEx::Request.Do(http, HackEx::Request.UserProcesses(auth_token)) json['user_processes'] || [] rescue # ok [] end |
.UserSoftware(http, auth_token) ⇒ Object
return empty array [] in case of any error
35 36 37 38 39 40 41 |
# File 'lib/libGoo/hackex/action.rb', line 35 def UserSoftware http, auth_token json = HackEx::Request.Do(http, HackEx::Request.UserSoftware(auth_token)) json['user_software'] || [] rescue # ok [] end |