libGoo 0.0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e75c36f2ebb61f7f36449e8c5578eb93e4313a1e
4
- data.tar.gz: 1634cecc4ee067b3ea8cfebc28df3b7a289b3a64
3
+ metadata.gz: 8b0c79f36a312707254052bb87a36de631a064d7
4
+ data.tar.gz: 93d68e3055614496c8fa9ffe4294075e950b67de
5
5
  SHA512:
6
- metadata.gz: 2040677a274784cb4a2f926ab2bed850bf632333eaa106c2f49a5e5d84200634f03e8bf8926e962a91c8ef94395b8fb26a51f51b8cd30f9dcca9e9c53951ca39
7
- data.tar.gz: 63f4c62e450f2759abecac21355ad4b8450a3b1a9b47c8c667d08b7d9804333af583c08b4f6846623d27a749785323985382b63b73a226f67b76bb1053dfd8ff
6
+ metadata.gz: 23d9a20da2f7295ca4b770f6f02383731499adda30a841ac1d593300029cfdfee67ace355b64692f3842d7e751d2c5fcd283cf20c69b384e4a5971f422c3b765
7
+ data.tar.gz: 92edcaf947ab55e80df1d02f696b539dd0f46cfda05a181e6a82473bbefa303ace275762b80724349c675ab0ffd5c47d079e0fdddc113db022abcfacfa2564a0
data/.gitignore CHANGED
@@ -1,15 +1,17 @@
1
1
  /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
15
- pkg/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ .idea/
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
16
+ /bin/debug.rb
17
+ pkg
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'json'
3
4
  # Specify your gem's dependencies in libGoo.gemspec
4
5
  gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 grig191
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # LibGoo
2
2
 
3
- LibGoo is HackEx api library attachment, this gem have HackEx library in it.
3
+ This gem was developed to ease your HackEx scripting, it also has full HackEx API lib inside.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  $ gem install libGoo
8
8
 
9
- ## Example
9
+ ## Usage examples
10
10
 
11
- user = LibGoo::User.new("email", "password")
12
- user.getUser
11
+ See bin/example.rb
data/bin/example.rb ADDED
@@ -0,0 +1,13 @@
1
+ #require 'hackex' #Optional
2
+ require 'libGoo'
3
+ include LibGoo
4
+
5
+ user = User.new('your@e.mail', 'password')
6
+ #user = User.new(nil, nil, 'YOUR_AUTH_TOKEN_HERE') #Loggining by auth token
7
+
8
+ #Methods names as in hackex/request.rb, but you can also use old methods names or translate old ones to new ones by OLD_TO_NEW
9
+ puts LibGoo::OLD_TO_NEW['getUserProcesses'.to_sym] #=>UserProcesses
10
+ puts LibGoo::NEW_TO_OLD[:UserProcesses] #=>getUserProcesses
11
+ puts JSON.pretty_generate user.VictimInfo(590331)
12
+ puts JSON.pretty_generate user.user
13
+ puts user.auth_token
data/lib/hackex.rb ADDED
@@ -0,0 +1,12 @@
1
+ begin
2
+ #require_relative 'hackex/typhoeus'
3
+ rescue LoadError
4
+ puts "Typheous not available: #{$!}"
5
+ end
6
+ require_relative 'hackex/net/std' unless defined?(HackEx::Network)
7
+
8
+ require_relative 'hackex/error'
9
+ require_relative 'hackex/helper'
10
+ require_relative 'hackex/request'
11
+ require_relative 'hackex/action'
12
+ require_relative 'hackex/hackex'
@@ -0,0 +1,229 @@
1
+ module HackEx
2
+ class Action
3
+ class << self
4
+ public
5
+ def Login http, email, password
6
+ json = HackEx::Request.Do(http, HackEx::Request.Login(email, password))
7
+ json['user']
8
+ end
9
+
10
+ def AddContact http, user_id1, auth_token1, user_id2, auth_token2
11
+ # prevent failure
12
+ json = HackEx::Request.Do(http, [HackEx::Request.AddContact(auth_token1, user_id2)])
13
+ json = HackEx::Request.Do(http, [HackEx::Request.AcceptContact(auth_token2, user_id1)])
14
+ end
15
+
16
+ # return empty array [] in case of any error
17
+ def UserBank http, auth_token
18
+ json = HackEx::Request.Do(http, HackEx::Request.UserBank(auth_token))
19
+ json['user_bank'] || {}
20
+ rescue
21
+ # ok
22
+ {}
23
+ end
24
+
25
+ # return empty array [] in case of any error
26
+ def UserProcesses http, auth_token
27
+ json = HackEx::Request.Do(http, HackEx::Request.UserProcesses(auth_token))
28
+ json['user_processes'] || []
29
+ rescue
30
+ # ok
31
+ []
32
+ end
33
+
34
+ # return empty array [] in case of any error
35
+ def UserSoftware http, auth_token
36
+ json = HackEx::Request.Do(http, HackEx::Request.UserSoftware(auth_token))
37
+ json['user_software'] || []
38
+ rescue
39
+ # ok
40
+ []
41
+ end
42
+
43
+ # return empty array [] in case of any error
44
+ def UserSpam http, auth_token
45
+ json = HackEx::Request.Do(http, HackEx::Request.UserSpam(auth_token))
46
+ json['spam'] || []
47
+ rescue
48
+ # ok
49
+ []
50
+ end
51
+
52
+ def ProcessClean http, auth_token, params = {}
53
+ process_types = params.fetch(:process_types, [Helper.ProcessTypeId('download'), Helper.ProcessTypeId('upload')])
54
+ process_types = [process_types] unless process_types.is_a?(Array)
55
+ process_statuses = params.fetch(:process_statuses, Helper.ProcessStatusId('ready'))
56
+ process_statuses = [] unless process_statuses.is_a?(Array)
57
+ user_processes = params.fetch(:user_processes, nil)
58
+ user_processes ||= HackEx::Action.UserProcesses(http, auth_token)
59
+
60
+ to_clean = []
61
+ ready_list = Helper.FilterHashArray user_processes, {'status' => process_statuses, 'process_type_id' => process_types}
62
+ out_list = user_processes - ready_list
63
+ ready_list.each do |p|
64
+ to_clean << p['id']
65
+ end
66
+
67
+ unless to_clean.empty?
68
+ HackEx::Request.Do(http, HackEx::Request.ProcessesDelete(auth_token, to_clean))
69
+ end
70
+
71
+ out_list
72
+ end
73
+
74
+ def PurchaseMissingSoftware http, auth_token, items, params = {}
75
+ items = [items] unless items.is_a? Array
76
+
77
+ user_software = params.fetch(:user_software, nil)
78
+ user_software ||= HackEx::Action.UserSoftware(http, auth_token)
79
+
80
+ sw = HackEx.ParseSoftware(user_software)
81
+
82
+ res = true
83
+ items.each do |item|
84
+ unless sw.has_key? item
85
+ puts "No #{item}, try to buy it"
86
+ json = HackEx::Request.Do(http, HackEx::Request.StorePurchase(auth_token, 'software', HackEx::Helper.SoftwareId(item)))
87
+ #puts res.inspect
88
+ if json['success'].to_s != 'true'
89
+ puts 'Error in buying'
90
+ res = false
91
+ end
92
+ end
93
+ end
94
+
95
+ res
96
+ end
97
+
98
+ def PrepareToSpam http, auth_token, params = {}
99
+ PurchaseMissingSoftware http, auth_token, 'Spam', params
100
+ end
101
+
102
+ def PrepareToCrack http, auth_token, params = {}
103
+ PurchaseMissingSoftware http, auth_token, 'Password Cracker', params
104
+ end
105
+
106
+ def PrepareToCrackAndSpam http, auth_token, params = {}
107
+ PurchaseMissingSoftware http, auth_token, ['Spam', 'Password Cracker'], params
108
+ end
109
+
110
+ # start single process
111
+ # @return Process (hash)
112
+ def StartProcess http, auth_token, victim_user_id, mode, params = {}
113
+ sw_victim = true
114
+ case mode
115
+ when 'bypass'
116
+ action = 'bypass'
117
+ sw_name = 'Firewall'
118
+ add_param = params.fetch(:fw_add, 0)
119
+ when 'crack'
120
+ action = 'crack'
121
+ sw_name = 'Password Encryptor'
122
+ add_param = params.fetch(:enc_add, 0)
123
+ when 'spam'
124
+ action = 'upload'
125
+ sw_name = 'Spam'
126
+ add_param = 0
127
+ sw_victim = false
128
+ when 'spyware'
129
+ action = 'upload'
130
+ sw_name = 'Spyware'
131
+ add_param = 0
132
+ sw_victim = false
133
+ else
134
+ raise HackExError, "Incorrect mode #{mode}"
135
+ end
136
+
137
+ user_processes = params.fetch(:user_processes, nil)
138
+ user_processes ||= HackEx::Action.UserProcesses(http, auth_token)
139
+ software_id = params.fetch(:software_id, nil)
140
+ software_level = params.fetch(:software_level, nil)
141
+
142
+ if software_id.nil? || software_level.nil?
143
+ if sw_victim
144
+ victim_user = params.fetch(:victim_user, nil)
145
+ victim_user ||= HackEx::Request.Do(http, HackEx::Request.VictimInfo(auth_token, victim_user_id))
146
+ victim_sws = victim_user['user_software']
147
+ else
148
+ user_software = params.fetch(:user_software, nil)
149
+ user_software ||= HackEx::Action.UserSoftware(http, auth_token)
150
+ victim_sws = user_software
151
+ #puts victim_sws.inspect
152
+ end
153
+ victim_sw = Helper.FilterHashArray victim_sws, {'software_type_id' => Helper.SoftwareId(sw_name)}
154
+ #puts victim_sw.inspect if action == 'upload'
155
+ unless victim_sw.empty?
156
+ software_id = victim_sw.first['software_id']
157
+ software_level = victim_sw.first['software_level']
158
+ else
159
+ puts "No #{sw_name} on #{sw_victim ? 'victim' : 'us'} is found"
160
+ software_level = 1
161
+ end
162
+ end
163
+
164
+ # need levels
165
+ software_need_level = software_level.to_i + add_param.to_i
166
+ software_need_level = params[:level].to_i if params.has_key?(:level)
167
+ software_need_level = 1 if software_need_level.to_i < 1
168
+
169
+ puts "Process #{mode} user #{victim_user_id}, sw level #{software_need_level} (current #{software_level.to_i})"
170
+
171
+ scan_processes = Helper.FilterHashArray user_processes, {'process_type_id' => Helper.ProcessTypeId(action), 'victim_user_id' => victim_user_id}
172
+ unless scan_processes.empty?
173
+ # check is it ok or not
174
+ if scan_processes.size > 1
175
+ # todo: handle better more than 1 process at the same time
176
+ # now - as incorrect situation, just remove everything
177
+ to_clean = []
178
+ scan_processes.each do |p|
179
+ to_clean << p['id']
180
+ end
181
+ puts "More than 1 existing #{mode} processes, delete everything"
182
+ HackEx::Request.Do(http, HackEx::Request.ProcessesDelete(auth_token, to_clean))
183
+ scan_processes = []
184
+ else
185
+ scan_process = scan_processes.first
186
+ scan_process_sw_level = scan_process['software_level']
187
+ scan_process_sw_id = scan_process['software_id']
188
+ if scan_process_sw_level.to_i < software_need_level.to_i || scan_process_sw_id.to_s != software_id.to_s
189
+ 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}"
190
+ HackEx::Request.Do(http, HackEx::Request.ProcessDelete(auth_token, scan_process['id']))
191
+ scan_processes = []
192
+ elsif scan_process['status'].to_s == Helper.ProcessStatusId('failed').to_s
193
+ puts "Retry process #{scan_process['id']}"
194
+ HackEx::Request.Do(http, HackEx::Request.ProcessRetry(auth_token, scan_process['id']))
195
+ elsif scan_process['status'].to_s == Helper.ProcessStatusId('ready').to_s
196
+ puts "Ready process #{scan_process['id']} found"
197
+ elsif scan_process['status'].to_s == Helper.ProcessStatusId('progress').to_s
198
+ puts "In progress process #{scan_process['id']} found"
199
+ end
200
+ end
201
+ end
202
+
203
+ if scan_processes.empty?
204
+ puts "Add #{mode} process user #{victim_user_id} sw id #{software_id} level #{software_need_level}"
205
+ json = HackEx::Request.Do(http, HackEx::Request.UserAddProcess(auth_token, victim_user_id, action, software_id, software_need_level))['user_processes'][0]
206
+ puts "Process #{json['id']} is added"
207
+ json
208
+ else
209
+ scan_processes.first
210
+ end
211
+ end
212
+ private :StartProcess
213
+
214
+ # start crack process
215
+ # @return Process (hash)
216
+ def StartBypass http, auth_token, victim_user_id, params = {}
217
+ StartProcess http, auth_token, victim_user_id, 'bypass', params
218
+ end
219
+
220
+ def StartCrack http, auth_token, victim_user_id, params = {}
221
+ StartProcess http, auth_token, victim_user_id, 'crack', params
222
+ end
223
+
224
+ def StartSpam http, auth_token, victim_user_id, params = {}
225
+ StartProcess http, auth_token, victim_user_id, 'spam', params
226
+ end
227
+ end
228
+ end
229
+ end
@@ -0,0 +1,4 @@
1
+ module HackEx
2
+ class HackExError < StandardError
3
+ end
4
+ end
@@ -0,0 +1,197 @@
1
+ module HackEx
2
+ class << self
3
+ public
4
+ def NetworkDo &proc
5
+ HackEx::Request::NetworkDo &proc
6
+ end
7
+
8
+ def LoginDo email, password, &proc
9
+ NetworkDo do |http|
10
+ user = HackEx::Action.Login http, email, password
11
+ token = user['auth_token']
12
+ proc.call(http, token, user)
13
+ end
14
+ end
15
+
16
+ def VictimProcesses user_processes, victim_user_id, process_type_id = 0
17
+ out = []
18
+ user_processes = [] if user_processes.nil?
19
+ user_processes.each do |p|
20
+ next if (process_type_id.to_i != 0 && process_type_id.to_i != p['process_type_id'].to_i)
21
+ out << p if p['victim_user_id'].to_i == victim_user_id.to_i
22
+ end
23
+ out
24
+ end
25
+
26
+ def SpamUpload http, auth_token, user_id, level
27
+ scan = Request.Do(http, HackEx::Request.UserAddProcess(auth_token, user_id, 'scan', '1264694', '100'))
28
+ begin
29
+ Request.Do(http, Request.UserAddProcess(auth_token, user_id, 'upload', '1264818', level.to_i.to_s))
30
+ rescue
31
+ puts "Rescued: #{$!}"
32
+ end
33
+ Request.Do(http, HackEx::Request.ProcessDelete(auth_token, scan['user_processes'][0]['id']))
34
+ puts "Uploading spam #{level} to user #{user_id}"#, scan process #{scan['user_processes'][0]['id']}"
35
+ end
36
+
37
+ def VictimProcessClean http, auth_token, user_id
38
+ HackEx::Request.Do(http, HackEx::Request.UserProcesses(auth_token))['user_processes'].each do |p|
39
+ if p['victim_user_id'].to_i == user_id.to_i
40
+ puts "Delete process #{p['id']}"
41
+ HackEx::Request.Do(http, HackEx::Request.ProcessDelete(auth_token, p['id']))
42
+ end
43
+ end
44
+ end
45
+
46
+ def VictimProcessWait http, auth_token, user_id, process_id = nil
47
+ finish = false
48
+ chars = 'abcdefghijklmnopqrstuvwxyz'
49
+ total_msg = 0
50
+ while !finish do
51
+ finish = true
52
+ long_wait = false
53
+ if process_id.nil?
54
+ processes = HackEx::Request.Do(http, HackEx::Request.UserProcesses(auth_token))['user_processes']
55
+ else
56
+ processes = [ HackEx::Request.Do(http, HackEx::Request.ProcessInfo(auth_token, process_id))['process'] ]
57
+ end
58
+ processes.each do |p|
59
+ if p['victim_user_id'].to_i == user_id.to_i
60
+ c = chars[total_msg % chars.length]
61
+ if (p['process_type_id'].to_i == 3 || p['process_type_id'].to_i == 4) && p['status'].to_i == 2
62
+ puts "Delete ready process #{p['id']} #{c}"
63
+ total_msg += 1
64
+ HackEx::Request.Do(http, HackEx::Request.ProcessDelete(auth_token, p['id']))
65
+ elsif p['status'].to_i == 3
66
+ puts "Retry process #{p['id']} #{c}"
67
+ total_msg += 1
68
+ HackEx::Request.Do(http, HackEx::Request.ProcessRetry(auth_token, p['id']))
69
+ finish = false
70
+ elsif p['status'].to_i == 1
71
+ puts "Waiting process #{p['id']}, overclocks #{p['overclocks_needed']} #{c}"
72
+ long_wait = true if p['overclocks_needed'].to_i > 1
73
+ total_msg += 1
74
+ finish = false
75
+ end
76
+ end
77
+ end
78
+ sleep (long_wait ? 20 : 5) unless finish
79
+ print '.' unless finish
80
+ end
81
+ end
82
+
83
+ def ProcessClean email, password
84
+ LoginDo(email, password) do |http, auth_token|
85
+ json = Request.Do(http, Request.UserProcesses(auth_token))
86
+ json['user_processes'].each do |p|
87
+ if p['status'].to_i == 2 && (p['process_type_id'].to_i == 4 || p['process_type_id'].to_i == 3)
88
+ puts p.inspect
89
+ Request.Do(http, Request.ProcessDelete(auth_token, p['id']))
90
+ end
91
+ end
92
+ end
93
+
94
+ end
95
+
96
+ def ParseSoftware software
97
+ out = {}
98
+ software = [] if software.nil?
99
+ software.each do |s|
100
+ #puts s
101
+ out[s['name']] = s['software_level']
102
+ end
103
+ out
104
+ end
105
+
106
+ # clean user hash from non-needed keys
107
+ def CleanUser user
108
+ out = user.dup
109
+ ['reputation', 'pts_to_next_level', 'pts_level_progress', 'overclocks', 'wallpaper', 'created_at'].each do |v|
110
+ out.delete(v)
111
+ end
112
+ out
113
+ end
114
+
115
+ def CleanBank bank
116
+ out = bank.dup
117
+ ['id'].each do |v|
118
+ out.delete(v)
119
+ end
120
+ out
121
+ end
122
+
123
+ def SingleBot http, auth_token, params = {}
124
+ puts "#{auth_token}"
125
+ victims = params.fetch(:victims, [])
126
+ max_victims = params.fetch(:max_victims, 50)
127
+
128
+ #
129
+ user = HackEx::Request.Do(http, HackEx::Request.UserInfo(auth_token))
130
+ user_processes = user['user_processes']
131
+ user_software = user['user_software']
132
+
133
+ #
134
+ HackEx::Action.PrepareToCrackAndSpam http, auth_token, :user_software => user_software
135
+
136
+ #
137
+ bypass_processes = Helper.FilterHashArray user_processes, {'process_type_id' => Helper.ProcessTypeId('bypass')}
138
+ failed_processes = Helper.FilterHashArray bypass_processes, {'status' => Helper.ProcessStatusId('failed')}
139
+ ready_processes = Helper.FilterHashArray bypass_processes, {'status' => Helper.ProcessStatusId('ready')}
140
+ progress_processes = Helper.FilterHashArray bypass_processes, {'status' => Helper.ProcessStatusId('progress')}
141
+ puts "Bypass processes: #{bypass_processes.size} = #{progress_processes.size} progress + #{ready_processes.size} ready + #{failed_processes.size} failed"
142
+ failed_processes.each do |p|
143
+ puts "Retry bypass process #{p['id']}"
144
+ HackEx::Request.Do(http, HackEx::Request.ProcessRetry(auth_token, p['id']))
145
+ end
146
+
147
+ if progress_processes.size == 0 && failed_processes.size == 0
148
+ if bypass_processes.size >= max_victims.to_i
149
+ # cracks
150
+ begin
151
+ HackEx::Action.StartCrack http, auth_token, v['id'], :user_processes => user_processes
152
+ rescue
153
+ puts "Rescued StartCrack: #{$!}"
154
+ end
155
+ else
156
+ # get victim list
157
+ victims = HackEx::Request.Do(http, HackEx::Request.RandomUsers(auth_token))['users'] if victims.empty?
158
+ victims.each do |v|
159
+ v = { 'id' => v } unless v.is_a?(Hash)
160
+ #next if (v.has_key?('software_level') && v['software_level'].to_i > 1)
161
+ begin
162
+ HackEx::Action.StartBypass http, auth_token, v['id'], :user_processes => user_processes, :software_level => v['software_level'], :software_id => v['software_id']
163
+ rescue
164
+ puts "Rescued StartBypass: #{$!}"
165
+ end
166
+ end
167
+ end
168
+
169
+ # spam
170
+ user_spam = HackEx::Action.UserSpam http, auth_token
171
+ users_spam = []
172
+ user_spam.each do |us|
173
+ users_spam << us['victim_user_id'].to_i
174
+ end
175
+
176
+ ready_processes.each do |p|
177
+ next if users_spam.include?(p['victim_user_id'].to_i)
178
+ begin
179
+ HackEx::Action.StartSpam http, auth_token, p['victim_user_id'], :user_software => user_software, :user_processes => user_processes, :level => 1
180
+ rescue
181
+ puts "Rescued StartSpam: #{$!}"
182
+ raise
183
+ end
184
+ end
185
+ end
186
+
187
+ #
188
+ user_bank = HackEx::Action.UserBank http, auth_token
189
+ if user_bank['checking'].to_i > 0
190
+ puts "Bank: #{user_bank['checking'].to_i}"
191
+ #zzzzz
192
+ end
193
+
194
+ end
195
+ end
196
+
197
+ end
@@ -0,0 +1,96 @@
1
+ module HackEx
2
+ class Helper
3
+ class << self
4
+ SOFTWARE_ID_TO_NAME = {
5
+ 1 => 'Firewall',
6
+ 2 => 'Bypasser',
7
+ 3 => 'Password Cracker',
8
+ 4 => 'Password Encryptor',
9
+ 5 => 'Antivirus',
10
+ 6 => 'Spam',
11
+ 7 => 'Spyware',
12
+ 8 => 'Notepad'
13
+ }
14
+
15
+ SOFTWARE_NAME_TO_ID = SOFTWARE_ID_TO_NAME.invert
16
+
17
+ def SoftwareIdToName id
18
+ raise HackExError, "SoftwareIdToName - incorrect id #{id}" unless SOFTWARE_ID_TO_NAME.has_key?(id.to_i)
19
+ SOFTWARE_ID_TO_NAME[id.to_i]
20
+ end
21
+
22
+ def SoftwareNameToId name
23
+ raise HackExError, "SoftwareNameToId - incorrect name #{name}" unless SOFTWARE_NAME_TO_ID.has_key?(name)
24
+ SOFTWARE_NAME_TO_ID[name]
25
+ end
26
+
27
+ def SoftwareId param
28
+ return SOFTWARE_NAME_TO_ID[param] if SOFTWARE_NAME_TO_ID.has_key?(param)
29
+ return param.to_i
30
+ end
31
+
32
+ PROCESS_TYPE_ID_TO_NAME = {
33
+ 1 => 'bypass',
34
+ 2 => 'crack',
35
+ 3 => 'download',
36
+ 4 => 'upload'
37
+ }
38
+
39
+ PROCESS_TYPE_NAME_TO_ID = PROCESS_TYPE_ID_TO_NAME.invert
40
+
41
+ def ProcessTypeIdToName id
42
+ raise HackExError, "ProcessTypeIdToName - incorrect id #{id}" unless PROCESS_TYPE_ID_TO_NAME.has_key?(id.to_i)
43
+ PROCESS_TYPE_ID_TO_NAME[id.to_i]
44
+ end
45
+
46
+ def ProcessTypeNameToId name
47
+ raise HackExError, "ProcessTypeNameToId - incorrect name #{name}" unless PROCESS_TYPE_NAME_TO_ID.has_key?(name)
48
+ PROCESS_TYPE_NAME_TO_ID[name]
49
+ end
50
+
51
+ def ProcessTypeId param
52
+ return PROCESS_TYPE_NAME_TO_ID[param] if PROCESS_TYPE_NAME_TO_ID.has_key?(param)
53
+ return param.to_i
54
+ end
55
+
56
+ PROCESS_STATUS_ID_TO_NAME = {
57
+ 1 => 'progress',
58
+ 2 => 'ready',
59
+ 3 => 'failed'
60
+ }
61
+
62
+ PROCESS_STATUS_NAME_TO_ID = PROCESS_STATUS_ID_TO_NAME.invert
63
+
64
+ def ProcessStatusId param
65
+ return PROCESS_STATUS_NAME_TO_ID[param] if PROCESS_STATUS_NAME_TO_ID.has_key?(param)
66
+ return param.to_i
67
+ end
68
+
69
+ # filter out array of hashes by filter
70
+ # filter item => [a, b]
71
+ def FilterHashArray array, filter = {}, include = true, &proc
72
+ out = []
73
+ array.each do |item|
74
+ #puts "item #{item.inspect}"
75
+ ok = true
76
+ filter.each_pair do |k, v|
77
+ #puts "#{k} = #{v.inspect}"
78
+ if !item.has_key?(k) ||
79
+ v.is_a?(Array) && !v.map(&:to_s).include?(item[k].to_s) ||
80
+ !v.is_a?(Array) && v.to_s != item[k].to_s
81
+ ok = false
82
+ #puts "False"
83
+ break
84
+ end
85
+ end
86
+ if ok && include || !ok && !include
87
+ #puts "Ok"
88
+ out << item
89
+ proc.call(item) unless proc.nil?
90
+ end
91
+ end
92
+ out
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,53 @@
1
+ module HackEx
2
+ module Network
3
+ require 'net/http'
4
+ require 'openssl'
5
+
6
+ private
7
+ def Get urip, params = {}
8
+ auth_token = params.delete(:auth_token)
9
+ Signature(params)
10
+
11
+ uri = URI.join(HackEx::Request::URI_BASE, urip)
12
+ uri.query = URI.encode_www_form(params)
13
+ request = Net::HTTP::Get.new uri.request_uri
14
+ request['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
15
+ request['User-Agent'] = HackEx::Request::USER_AGENT
16
+ request['X-API-KEY'] = auth_token unless auth_token.nil?
17
+ request
18
+ end
19
+
20
+ def Post urip, params = {}
21
+ auth_token = params.delete(:auth_token)
22
+ Signature(params)
23
+
24
+ uri = URI.join(HackEx::Request::URI_BASE, urip)
25
+ request = Net::HTTP::Post.new uri.path
26
+ request['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
27
+ request['User-Agent'] = HackEx::Request::USER_AGENT
28
+ request['X-API-KEY'] = auth_token unless auth_token.nil?
29
+ request.body = URI.encode_www_form(params)
30
+ request
31
+ end
32
+
33
+ public
34
+ def Do http, request
35
+ response = http.request request
36
+ if response.is_a? Net::HTTPOK
37
+ json = JSON.parse(response.body)
38
+ raise HackExError, "Not success: #{json}" unless json['success']
39
+ json
40
+ else
41
+ raise HackExError, "Not OK: #{response.inspect}, #{response.body}"
42
+ end
43
+ end
44
+
45
+ def NetworkDo &proc
46
+ uri_base = URI(HackEx::Request::URI_BASE)
47
+
48
+ Net::HTTP.start(uri_base.host, uri_base.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
49
+ proc.call(http)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,86 @@
1
+ module HackEx
2
+ module Network
3
+ require 'typhoeus'
4
+ require 'uri'
5
+
6
+ private
7
+ def Get urip, params = {}
8
+ auth_token = params.delete(:auth_token)
9
+ Signature(params)
10
+ uri = URI.join(HackEx::Request::URI_BASE, urip)
11
+ Typhoeus::Request.new(
12
+ uri.to_s,
13
+ method: :get,
14
+ params: params,
15
+ headers: {
16
+ 'Accept' => '*/*',
17
+ 'Content-Type' => "application/x-www-form-urlencoded; charset=UTF-8",
18
+ 'User-Agent' => HackEx::Request::USER_AGENT,
19
+ 'X-API-KEY' => auth_token.to_s
20
+ },
21
+ ssl_verifypeer: false
22
+ )
23
+ end
24
+
25
+ def Post urip, params = {}
26
+ auth_token = params.delete(:auth_token)
27
+ Signature(params)
28
+ body = URI.encode_www_form(params)
29
+ uri = URI.join(HackEx::Request::URI_BASE, urip)
30
+ #uri = HackEx::Request::URI_BASE.to_s + urip.to_s
31
+ Typhoeus::Request.new(
32
+ uri.to_s,
33
+ method: :post,
34
+ body: body,
35
+ headers: {
36
+ 'Content-Type' => "application/x-www-form-urlencoded; charset=UTF-8",
37
+ 'User-Agent' => HackEx::Request::USER_AGENT,
38
+ 'X-API-KEY' => auth_token.to_s
39
+ },
40
+ ssl_verifypeer: false
41
+ )
42
+ end
43
+
44
+ public
45
+ def Do http, request
46
+ array = true
47
+ unless request.is_a? Array
48
+ array = false
49
+ request = [request]
50
+ end
51
+
52
+ request.each do |r|
53
+ http.queue r
54
+ end
55
+ http.run
56
+ out = []
57
+ suc = true
58
+ request.each do |r|
59
+ response = r.response
60
+ #puts response.code
61
+ if response.code == 200
62
+ json = JSON.parse(response.body)
63
+ out << json
64
+ unless array
65
+ raise HackExError, "Not success: #{json}" unless json['success']
66
+ end
67
+ #json
68
+ else
69
+ raise HackExError, "Not OK: #{response.inspect}, #{response.body}" unless array
70
+ end
71
+ end
72
+ if array
73
+ out
74
+ else
75
+ out[0]
76
+ end
77
+ end
78
+
79
+ def NetworkDo &proc
80
+ http = Typhoeus::Hydra.hydra # single
81
+ #puts http.inspect
82
+ #puts "Use Hydra"
83
+ proc.call(http)
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,201 @@
1
+ require 'digest/sha1'
2
+ require 'json'
3
+
4
+ module HackEx
5
+ module Request
6
+ URI_BASE = 'https://api.hackex.net/v5/'
7
+ USER_AGENT = 'Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; Nexus 5) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'
8
+
9
+ class << self
10
+ include Network
11
+
12
+ private
13
+ def Signature params
14
+ out_params = {}
15
+ ts = (Time.now.utc.to_f * 1000).to_i.to_s
16
+ params['sig2'] = ts
17
+ keys = params.keys.sort_by { |w|
18
+ w#.downcase
19
+ }
20
+ keys.reverse!
21
+ s = '1101101101'
22
+ keys.each do |k|
23
+ s += k.to_s + params[k].to_s
24
+ out_params[k] = params[k]
25
+ end
26
+
27
+ keys.each do |k|
28
+ params.delete(k)
29
+ end
30
+ keys.each do |k|
31
+ params[k] = out_params[k]
32
+ end
33
+
34
+ sa = 'WqZnwjpaVZNvWDpJhqHCHhWtNfu86CkmtCAVErbQO'
35
+ hash = Digest::SHA1.hexdigest(s + sa)
36
+ params['sig'] = hash
37
+ #puts "#{s + sa}: #{hash}"
38
+ "#{hash}&sig2=#{ts}"
39
+ end
40
+
41
+ public
42
+ def CreateUser username, email, password, facebook_id = nil
43
+ params = { 'username' => username, 'email' => email, 'os_type_id' => '1' }
44
+ params['password'] = password unless password.nil?
45
+ params['facebook_id'] = facebook_id unless facebook_id.nil?
46
+ Post 'user', params
47
+ end
48
+
49
+ def Login email, password
50
+ Post 'auth', 'email' => email, 'password' => password
51
+ end
52
+
53
+ def RandomUsers auth_token, count = 5
54
+ Get 'users_random', 'count' => count, :auth_token => auth_token
55
+ end
56
+
57
+ def VictimInfo auth_token, user_id
58
+ Get 'user_victim', 'victim_user_id' => user_id, :auth_token => auth_token
59
+ end
60
+
61
+ def VictimBank auth_token, user_id
62
+ Get 'victim_user_bank', 'victim_user_id' => user_id, :auth_token => auth_token
63
+ end
64
+
65
+ def StoreInfo auth_token
66
+ Get 'store', :auth_token => auth_token
67
+ end
68
+
69
+ def UpdateVictimLog auth_token, user_id, text
70
+ Post 'victim_user_log', 'victim_user_id' => user_id, 'text' => text, :auth_token => auth_token
71
+ end
72
+
73
+ def UpdateUserLog auth_token, text
74
+ Post 'user_log', 'text' => text, :auth_token => auth_token
75
+ end
76
+
77
+ def UpdateUserNotepad auth_token, text
78
+ Post 'user_notepad', 'text' => text, :auth_token => auth_token
79
+ end
80
+
81
+ def TransferBankFundsToSavings auth_token, amount
82
+ Post 'bank_transfer_savings', 'amount' => amount, :auth_token => auth_token
83
+ end
84
+
85
+ def TransferBankFundsFromVictim auth_token, user_id, amount
86
+ Post 'bank_transfer_from_victim', 'victim_user_id' => user_id, 'amount' => amount, :auth_token => auth_token
87
+ end
88
+
89
+ def TransferBankFundsToContact auth_token, user_id, amount
90
+ Post 'bank_transfer_to_contact', 'contact_user_id' => user_id, 'amount' => amount, :auth_token => auth_token
91
+ end
92
+
93
+ def AddContact auth_token, user_id
94
+ Post 'contact_add', 'contact_user_id' => user_id, :auth_token => auth_token
95
+ end
96
+
97
+ def AcceptContact auth_token, user_id
98
+ Post 'contact_accept', 'contact_user_id' => user_id, :auth_token => auth_token
99
+ end
100
+
101
+ def RemoveContact auth_token, user_id
102
+ Post 'contact_remove', 'contact_user_id' => user_id, :auth_token => auth_token
103
+ end
104
+
105
+ def StorePurchase auth_token, type, type_id
106
+ params = {}
107
+ case type
108
+ when 'software'
109
+ params['software_type_id'] = type_id
110
+ when 'device'
111
+ params['device_type_id'] = type_id
112
+ when 'network'
113
+ params['network_type_id'] = type_id
114
+ else
115
+ raise "Unknown type #{type}"
116
+ end
117
+ params[:auth_token] = auth_token
118
+ Post 'store_purchase', params
119
+ end
120
+
121
+ def UserByIp auth_token, ip
122
+ Get 'user', 'user_ip' => ip, 'process_type_id' => 1, :auth_token => auth_token
123
+ end
124
+
125
+ def UserInfo auth_token
126
+ Get 'user', 'extras' => 'true', :auth_token => auth_token
127
+ end
128
+
129
+ def UserBank auth_token
130
+ Get 'user_bank', :auth_token => auth_token
131
+ end
132
+
133
+ def UserViruses auth_token
134
+ Get 'user_viruses', :auth_token => auth_token
135
+ end
136
+
137
+ def UserSoftware auth_token
138
+ Get 'user_software', :auth_token => auth_token
139
+ end
140
+
141
+ def UserProcesses auth_token
142
+ Get 'user_processes', :auth_token => auth_token
143
+ end
144
+
145
+ def UserSpam auth_token
146
+ Get 'user_spam', :auth_token => auth_token
147
+ end
148
+
149
+ def UserSpyware auth_token
150
+ Get 'user_spyware', :auth_token => auth_token
151
+ end
152
+
153
+ def UserRemoveUploadedVirus auth_token, virus_id, software_type_id
154
+ Post 'user_virus_uploaded_remove', 'virus_id' => virus_id, 'software_type_id' => software_type_id, :auth_token => auth_token
155
+ end
156
+
157
+ def UserAddProcess auth_token, user_id, process_type, software_id, software_level = nil
158
+ params = { 'victim_user_id' => user_id, 'software_id' => software_id }
159
+ case process_type
160
+ when 'scan', 'bypass'
161
+ params['process_type_id'] = '1'
162
+ when 'crack'
163
+ params['process_type_id'] = '2'
164
+ when 'download'
165
+ params['process_type_id'] = '3'
166
+ when 'upload'
167
+ params['process_type_id'] = '4'
168
+ else
169
+ raise "Unknown type: #{process_type}"
170
+ end
171
+ params['software_level'] = software_level unless software_level.nil?
172
+ params[:auth_token] = auth_token
173
+ Post 'process', params
174
+ end
175
+
176
+ def ProcessInfo auth_token, process_id
177
+ Get 'process', 'process_id' => process_id, :auth_token => auth_token
178
+ end
179
+
180
+ def ProcessRetry auth_token, process_id
181
+ Post 'process_retry', 'process_id' => process_id, :auth_token => auth_token
182
+ end
183
+
184
+ def ProcessOverclock auth_token, process_id
185
+ Post 'process_overclock', 'process_id' => process_id, :auth_token => auth_token
186
+ end
187
+
188
+ def ProcessDelete auth_token, process_id
189
+ Post 'process_delete', 'process_id' => process_id, :auth_token => auth_token
190
+ end
191
+
192
+ def ProcessesDelete auth_token, process_ids
193
+ Post 'processes_delete', 'process_ids' => process_ids.join('|'), :auth_token => auth_token
194
+ end
195
+
196
+ def Leaderboard auth_token, offset = 0
197
+ Get 'leaderboards', 'offset' => offset, :auth_token => auth_token
198
+ end
199
+ end
200
+ end
201
+ end
data/lib/libGoo.rb CHANGED
@@ -1,3 +1,7 @@
1
- require "libGoo/version"
2
- require 'libGoo/libGoo'
3
- require 'hackex'
1
+ require_relative 'hackex'
2
+ require_relative 'libGoo/user'
3
+ require_relative 'libGoo/error'
4
+ require_relative 'libGoo/process'
5
+ module LibGoo
6
+ VERSION = '0.1.1'
7
+ end
@@ -0,0 +1,4 @@
1
+ module LibGoo
2
+ class LibGooError < StandardError
3
+ end
4
+ end
@@ -0,0 +1,16 @@
1
+ module LibGoo
2
+ class Processes #Much needed such wow
3
+ attr_reader :id, :params
4
+
5
+ def initialize(params)
6
+ if params.is_a?(Hash) || params.is_a?(JSON)
7
+ raise LibGooError, 'No specified key \'id\' in arguments' unless params.has_key?('id')
8
+ @id, @params = params['id'], params
9
+ elsif params.is_a?(Fixnum)
10
+ @id = params
11
+ else
12
+ raise LibGooError, 'Unavailable type ' + params.class.to_s
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,56 @@
1
+ module LibGoo
2
+ OLD_TO_NEW = {getUser: 'get_user', getUserProcesses: 'UserProcesses', getUserAntivirus: 'UserViruses', addProcess: 'UserAddProcess', getRandomUsers: 'RandomUsers', getVictimInfo: 'VictimInfo', getVictimBank: 'VictimBank', getStore: 'StoreInfo', updateVictimLog: 'UpdateVictimLog', updateUserLog: 'UpdateUserLog', updateUserNotepad: 'UpdateUserNotepad', transferToSavings: 'TransferBankFundsToSavings', transferToVictim: 'TransferBankFundsToVictim', transferToContact: 'TransferBankFundsToContact', addContact: 'AddContact', acceptContact: 'AcceptContact', removeContact: 'RemoveContact', storePurchase: 'StorePurchase', getUserByIp: 'UserByIp', getUserBank: 'UserBank', getUserViruses: 'UserViruses', getUserSoftware: 'UserSoftware', getUserSpam: 'UserSpam', getUserSpyware: 'UserSpyware', removeUploadedVirus: 'UserRemoveUploadedVirus', processInfo: 'ProcessInfo', processOverclock: 'ProcessOverclock', processRetry: 'ProcessRetry', processDelete: 'ProcessDelete', processesDelete: 'ProcessesDelete', getLeaderboard: 'Leaderboard'}
3
+ NEW_TO_OLD = OLD_TO_NEW.invert
4
+ class User
5
+
6
+ def initialize(email, password, auth_token = nil)
7
+ if auth_token
8
+ HackEx.NetworkDo { |http| @http = http; @user = HackEx::Request.Do(http, HackEx::Request.UserInfo(auth_token))['user']}
9
+ @auth_token = auth_token
10
+ else
11
+ HackEx.LoginDo(email, password) {|http, auth_token, user| @auth_token , @http, @user = auth_token, http, user}
12
+ end
13
+ end
14
+
15
+
16
+ def get_user
17
+ @user = HackEx::Request.Do(@http, HackEx::Request.UserInfo(@auth_token))['user']
18
+ end
19
+ #gr
20
+ def method_missing(m, *args)
21
+ m = m.to_s.gsub!(m.to_s, OLD_TO_NEW[m]).to_sym if OLD_TO_NEW.has_key?(m)
22
+ if HackEx::Request.respond_to?(m)
23
+ HackEx::Request.Do(@http, HackEx::Request.method(m).call(@auth_token, *User.params(*args)))
24
+ #elsif HackEx::Request.respond_to?(m)
25
+ # puts m
26
+ # HackEx::Request.Do(@http, HackEx::Request.method(m).call(@auth_token, *args))
27
+ else
28
+ raise LibGooError, "Undefined method '#{m}' for class LibGoo::User or class HackEx::Request"
29
+ end
30
+ end
31
+
32
+ class << self
33
+ public
34
+
35
+ def Do(email, password, auth_token = nil)
36
+ obj = User.new(email, password, auth_token)
37
+ yield obj.http, obj.auth_token, obj.user, obj
38
+ end
39
+
40
+ def params(*objs) #Parameters processor, accepts Array, String, Integer, LibGoo::Processes
41
+ result = []
42
+ objs.each do |obj|
43
+ if obj.is_a?(LibGoo::Processes)
44
+ return obj.id
45
+ elsif obj.is_a?(Fixnum) || obj.is_a?(String) || obj.is_a?(Array)
46
+ result << obj
47
+ else
48
+ raise LibGooError, 'Undefined class object given as one of params: ' + obj.class.to_s
49
+ end
50
+ end
51
+ result
52
+ end
53
+
54
+ end
55
+ end
56
+ end
data/libGoo.gemspec CHANGED
@@ -1,14 +1,15 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'libGoo/version'
4
+ require 'libGoo'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "libGoo"
8
8
  spec.version = LibGoo::VERSION
9
9
  spec.authors = ["Grig O. Betsan"]
10
10
  spec.email = ["griggors@gmail.com"]
11
- spec.summary = %q{libGoo attachment including HackEx api library in gem}
11
+ spec.summary = %q{HackEx LibGoo attachment was developed for ease your scripting}
12
+ spec.description = %q{It has full HackEx API library, and LibGoo. LibGoo is developed to ease your scripting, so you can easily write and manage your scripts!}
12
13
  spec.homepage = ""
13
14
  spec.license = "MIT"
14
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libGoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grig O. Betsan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-07 00:00:00.000000000 Z
11
+ date: 2015-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,20 +38,34 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description:
41
+ description: It has full HackEx API library, and LibGoo. LibGoo is developed to ease
42
+ your scripting, so you can easily write and manage your scripts!
42
43
  email:
43
44
  - griggors@gmail.com
44
- executables: []
45
+ executables:
46
+ - example.rb
45
47
  extensions: []
46
48
  extra_rdoc_files: []
47
49
  files:
48
50
  - .gitignore
49
51
  - Gemfile
52
+ - LICENSE
50
53
  - LICENSE.txt
51
54
  - README.md
52
55
  - Rakefile
56
+ - bin/example.rb
57
+ - lib/hackex.rb
58
+ - lib/hackex/action.rb
59
+ - lib/hackex/error.rb
60
+ - lib/hackex/hackex.rb
61
+ - lib/hackex/helper.rb
62
+ - lib/hackex/net/std.rb
63
+ - lib/hackex/net/typhoeus.rb
64
+ - lib/hackex/request.rb
53
65
  - lib/libGoo.rb
54
- - lib/libGoo/version.rb
66
+ - lib/libGoo/error.rb
67
+ - lib/libGoo/process.rb
68
+ - lib/libGoo/user.rb
55
69
  - libGoo.gemspec
56
70
  homepage: ''
57
71
  licenses:
@@ -76,5 +90,5 @@ rubyforge_project:
76
90
  rubygems_version: 2.0.14
77
91
  signing_key:
78
92
  specification_version: 4
79
- summary: libGoo attachment including HackEx api library in gem
93
+ summary: HackEx LibGoo attachment was developed for ease your scripting
80
94
  test_files: []
@@ -1,3 +0,0 @@
1
- module LibGoo
2
- VERSION = "0.0.1"
3
- end