HackT 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in HackT.gemspec
4
+ gemspec
data/HackT.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'HackT'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "HackT"
8
+ spec.version = HackT::VERSION
9
+ spec.authors = ["grig191"]
10
+ spec.email = ["griggors@gmail.com"]
11
+
12
+ spec.summary = %q{HackT ruby lib api}
13
+ spec.description = %q{HackT game ruby api library (test version)}
14
+ spec.homepage = "http://melgarn.xyz/"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.10"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Grig
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.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ desc 'Open an development console'
4
+ task :console do
5
+ sh 'irb -rubygems -I lib -r HackT.rb'
6
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "HackT"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/lib/HackT.rb ADDED
@@ -0,0 +1,9 @@
1
+ module HackT
2
+ require 'hackt/net'
3
+ require 'hackt/error'
4
+ require 'hackt/request'
5
+
6
+
7
+ VERSION = '0.0.1'
8
+ URL = 'http://melgarn.xyz/'
9
+ end
@@ -0,0 +1,4 @@
1
+ module HackT
2
+ class HackTError;
3
+ end
4
+ end
data/lib/hackt/net.rb ADDED
@@ -0,0 +1,41 @@
1
+ module HackT
2
+ class HackTNet
3
+ require 'net/http'
4
+ require 'json'
5
+ class << self
6
+
7
+ def Get(uri, params, prevent_errors = false)
8
+ uri = URI(HackT::URL + uri)
9
+ uri.query = URI.encode_www_form(params)
10
+ response = Net::HTTP.get_response(uri)
11
+
12
+ if response.is_a?(Net::HTTPSuccess)
13
+ JSON.parse(response.body)
14
+ else
15
+ raise HackT::HackTError, "Not OK: #{response.inspect}" unless prevent_errors
16
+ end
17
+ end
18
+
19
+ def Post(uri, params, prevent_errors = false)
20
+ uri = URI(HackT::URL + uri)
21
+ response = Net::HTTP.post_form(uri, params)
22
+ if response.is_a?(Net::HTTPSuccess)
23
+ JSON.parse(response.body)
24
+ else
25
+ raise "Not OK: #{response.inspect}" unless prevent_errors
26
+ end
27
+ end
28
+
29
+ def Do(http)
30
+ yield HTTP
31
+ end
32
+
33
+ def HTTP
34
+ uri = URI(HackT::URL)
35
+ Net::HTTP.start(uri.host, uri.port) do |http|
36
+ http
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,160 @@
1
+ module HackT
2
+
3
+ class Request
4
+ class << self
5
+
6
+ def Login(email, password)
7
+ HackTNet::Post '/player/login', email: email, password: password
8
+ end
9
+
10
+ def UserInfo(auth_token, id = 'my')
11
+ HackTNet::Get '/player/info', auth_token: auth_token, id: id
12
+ end
13
+
14
+ def Scan(auth_token)
15
+ HackTNet::Get '/player/scan', auth_token: auth_token
16
+ end
17
+
18
+ def SoftwareInfo(auth_token, id = 'my')
19
+ HackTNet::Get '/software/info', auth_token: auth_token, id: id
20
+ end
21
+
22
+ def SoftwarePurchase(auth_token, software_id)
23
+ HackTNet::Post '/software/purchase', auth_token: auth_token, software_id: software_id
24
+ end
25
+
26
+ def DeviceInfo(auth_token, id = 'my')
27
+ HackTNet::Get '/device/info', auth_token: auth_token, id: id
28
+ end
29
+
30
+ def DevicePurchase(auth_token)
31
+ HackTNet::Post '/device/purchase', auth_token: auth_token
32
+ end
33
+
34
+ def NetworkInfo(auth_token, id = 'my')
35
+ HackTNet::Get '/network/info', auth_token: auth_token, id: id
36
+ end
37
+
38
+ def NetworkPurchase(auth_token)
39
+ HackTNet::Post '/network/purchase', auth_token: auth_token
40
+ end
41
+
42
+ def ContactInfo(auth_token, id = 'my')
43
+ HackTNet::Get '/contact/info', auth_token: auth_token, id: id
44
+ end
45
+
46
+ def ContactRequests(auth_token)
47
+ HackTNet::Get '/contact/requests', auth_token: auth_token
48
+ end
49
+
50
+ def SendContactRequest(auth_token, contact_id)
51
+ HackTNet::Post '/contact/add', auth_token: auth_token, contact_id: contact_id
52
+ end
53
+
54
+ def AcceptContactRequest(auth_token, request_id)
55
+ HackTNet::Post '/contact/accept', auth_token: auth_token, request_id: request_id
56
+ end
57
+
58
+ def DeclineContactRequest(auth_token, request_id)
59
+ HackTNet::Post '/contact/decline', auth_token: auth_token, request_id: request_id
60
+ end
61
+
62
+ def RemoveContact(auth_token, contact_id)
63
+ HackTNet::Post '/contact/delete', auth_token: auth_token, contact_id: contact_id
64
+ end
65
+
66
+ def BankInfo(auth_token, id = 'my')
67
+ HackTNet::Get '/bank/info', auth_token: auth_token, id: id
68
+ end
69
+
70
+ def CheckPin(auth_token, pin)
71
+ HackTNet::Get '/bank/true', auth_token: auth_token, pin: pin
72
+ end
73
+
74
+ def TransferBankFundsToSavings(auth_token, amount)
75
+ HackTNet::Post '/bank/to_savings', auth_token: auth_token, amount: amount
76
+ end
77
+
78
+ def TransferBankFundsToContact(auth_token, contact_id, amount)
79
+ HackTNet::Post '/bank/transfer', auth_token: auth_token, contact_id: contact_id, amount: amount
80
+ end
81
+
82
+ def TransferBankFundsFromVictim()
83
+ end
84
+
85
+ def LogInfo(auth_token, id = 'my')
86
+ HackTNet::Get '/log/info', auth_token: auth_token, id: id
87
+ end
88
+
89
+ def LogWrite(auth_token, text, id = 'my')
90
+ HackTNet::Post '/log/write', auth_token: auth_token, id: id, text: text
91
+ end
92
+
93
+ def VncInfo(auth_token)
94
+ HackTNet::Get '/vnc/info', auth_token: auth_token
95
+ end
96
+
97
+ def VncPurchase(auth_token)
98
+ HackTNet::Post '/vnc/buy', auth_token: auth_token
99
+ end
100
+
101
+ def ClanInfo(auth_token, clan_id = 1)
102
+ HackTNet::Get '/clan/info', auth_token: auth_token, clan_id: clan_id
103
+ end
104
+
105
+ def Clans(auth_token)
106
+ HackTNet::Get '/clan/clans', auth_token: auth_token
107
+ end
108
+
109
+ def SendJoinClanRequest(auth_token, clan_id, message)
110
+ HackTNet::Post '/clan/send_request', auth_token: auth_token, text: message, clan_id: clan_id
111
+ end
112
+
113
+ def AcceptClanRequest(auth_token, clan_request_id)
114
+ HackTNet::Post '/clan/accept_request', auth_token: auth_token, id: clan_request_id
115
+ end
116
+
117
+ def UserViruses(auth_token)
118
+ HackTNet::Get '/virus/info', auth_token: auth_token
119
+ end
120
+
121
+ def CollectVirus(auth_token, virus_id, amount = nil) #if amount is nil, it will collect all available
122
+ HackTNet::Post '/virus/collect', auth_token: auth_token, virus_id: virus_id, amount: amount
123
+ end
124
+
125
+ def Antivirus(auth_token)
126
+ HackTNet::Get '/antivirus/info', auth_token: auth_token
127
+ end
128
+
129
+ def AntivirusDelete(auth_token, virus_id)
130
+ HackTNet::Post '/antivirus/delete', auth_token: auth_token, virus_id: virus_id
131
+ end
132
+
133
+ def AntivirusDeleteAll(auth_token)
134
+ HackTNet::Post '/antivirus/delete_all', auth_token: auth_token
135
+ end
136
+
137
+ def AddProcess(auth_token, victim_user_id, process_type, software_type_id = nil, level = nil)
138
+ #process_type can be 'download', 'crack', 'upload', 'download'
139
+ #level arg is available only for upload process type
140
+ #software_type_id is specified only for download or upload processes
141
+ #software type id for upload can be 4 (reaper) or 5 (spam)
142
+
143
+ HackTNet::Post '/process/add', auth_token: auth_token, victim_id: victim_user_id, type: process_type, software_type: software_type_id, level: level
144
+ end
145
+
146
+ def DeleteProcess(auth_token, process_id)
147
+ HackTNet::Post '/process/delete', auth_token: auth_token, process_id: process_id
148
+ end
149
+
150
+ def UserProcesses(auth_token)
151
+ HackTNet::Get '/process/info', auth_token: auth_token
152
+ end
153
+
154
+ def EndProcess(auth_token, process_id)
155
+ HackTNet::Post '/process/end', auth_token: auth_token, process_id: process_id
156
+ end
157
+
158
+ end
159
+ end
160
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: HackT
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - grig191
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: HackT game ruby api library (test version)
42
+ email:
43
+ - griggors@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".idea/.name"
50
+ - ".idea/.rakeTasks"
51
+ - ".idea/HackT.iml"
52
+ - ".idea/misc.xml"
53
+ - ".idea/modules.xml"
54
+ - ".idea/vcs.xml"
55
+ - ".idea/workspace.xml"
56
+ - Gemfile
57
+ - HackT.gemspec
58
+ - LICENSE
59
+ - Rakefile
60
+ - bin/console
61
+ - bin/setup
62
+ - lib/HackT.rb
63
+ - lib/hackt/error.rb
64
+ - lib/hackt/net.rb
65
+ - lib/hackt/request.rb
66
+ homepage: http://melgarn.xyz/
67
+ licenses: []
68
+ metadata:
69
+ allowed_push_host: https://rubygems.org
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 2.4.8
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: HackT ruby lib api
90
+ test_files: []