steam-trade 0.0.2
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.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +2 -0
- data/bin/console +13 -0
- data/bin/setup +8 -0
- data/lib/Confirmation.rb +106 -0
- data/lib/Guard.rb +44 -0
- data/lib/LoginExecutor.rb +99 -0
- data/lib/Misc.rb +50 -0
- data/lib/Trade.rb +73 -0
- data/lib/steam-trade.rb +42 -0
- data/steam-trade.gemspec +30 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c75d03399a096ddb7e68a6448c37ab5265f307d8
|
4
|
+
data.tar.gz: 032e2ec9c6d382c5cea3b394026f714c1ef3ad93
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c7e7a5f5fe23cccc2ec4caf4bb1dad525bbbed6f52aff2f082c0eba1d6ce2cf0027d88dd47493a7ba688fd739759f9182cdcd3a1652a9f96d275004b1b0c741d
|
7
|
+
data.tar.gz: 222366d1f7da9df8d3730602edd6b807c103dbaeb98b20314309a9dc4f23445588d6f815b983aabd89f46f4d00219f29a536fcbc8fe15fcb55db03234ff439b5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Adam Boulila
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# steam-trade
|
2
|
+
|
3
|
+
This gem simplifes/allows sending steam trade offers programmatically
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
in your commandline :
|
7
|
+
|
8
|
+
`gem install steam-trade`
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
First you need to require the gem:
|
12
|
+
```ruby
|
13
|
+
require 'steam-trade'
|
14
|
+
```
|
15
|
+
|
16
|
+
then you need to login and optionally set your shared_secret and identity_secret:
|
17
|
+
- `shared_secret` is used to generate steam authentication codes so you won't have to write them manually each time you login.
|
18
|
+
- `identity_secret` is used to confirm trade offers automatically.
|
19
|
+
```ruby
|
20
|
+
require 'steam-trade'
|
21
|
+
|
22
|
+
account = Handler.new('username','password','shared_secret') # share secret is optional
|
23
|
+
#username and password are required, shared_secret is optional
|
24
|
+
|
25
|
+
|
26
|
+
account.mobile_info('identity_secret')
|
27
|
+
#identity_secret is requred
|
28
|
+
|
29
|
+
```
|
30
|
+
|
31
|
+
then you can send your offer
|
32
|
+
- `Myarray` is an array which contains hashes of selected items to send in the offer. (currently you must get this alone)
|
33
|
+
- `Theirarray` is an array which contains hashes of selected items to receive in the offer. (currently you must get this alone)
|
34
|
+
- `trade_offer_link` is the trade link of you partner `ex: https://steamcommunity.com/tradeoffer/new/?partner=410155236&token=H-yK-GFt`
|
35
|
+
- `message` is the comment you want to include in the trade offer
|
36
|
+
|
37
|
+
- `Myarray`, `Theirarray`, `trade_offer_link` are required, `message` is optional
|
38
|
+
```ruby
|
39
|
+
require 'steam-trade'
|
40
|
+
|
41
|
+
account = Handler.new('username','password','shared_secret')
|
42
|
+
account.mobile_info('identity_secret')
|
43
|
+
|
44
|
+
|
45
|
+
account.send_offer(Myarray,Theirarray,trade_offer_link,message)
|
46
|
+
```
|
47
|
+
|
48
|
+
|
49
|
+
## License
|
50
|
+
|
51
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
6
|
+
# with your gem easier. You can also use a different console, if you like.
|
7
|
+
|
8
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
9
|
+
# require "pry"
|
10
|
+
# Pry.start
|
11
|
+
|
12
|
+
require "irb"
|
13
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/Confirmation.rb
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'Guard.rb'
|
2
|
+
|
3
|
+
|
4
|
+
module ConfirmationCommands
|
5
|
+
include GuardCommands
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
def send_trade_allow_request(trade_id) ###FIRST
|
11
|
+
confirmations = get_confirmations() ###second
|
12
|
+
confirmationhash = select_trade_offer_confirmation(trade_id, confirmations) #seventh
|
13
|
+
send_confirmation(confirmationhash) #tenth
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
def get_confirmations() ##SECOND
|
18
|
+
confirmations = []
|
19
|
+
confirmations_page = fetch_confirmations_page()
|
20
|
+
Nokogiri::HTML(confirmations_page).css('#mobileconf_list').css('.mobileconf_list_entry').each { |trade|
|
21
|
+
add = {
|
22
|
+
'id' => trade['id'].sub('conf', ''),
|
23
|
+
'data_confid' => trade['data-confid'],
|
24
|
+
'data_key' => trade['data-key']
|
25
|
+
}
|
26
|
+
confirmations << add
|
27
|
+
}
|
28
|
+
return confirmations
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_confirmation_params(tag_string) #FOURTH FINISHED
|
32
|
+
timestamp = Time.new.to_i
|
33
|
+
confirmation_key = generate_confirmation_key(tag_string,timestamp) # FIFTH other FILE FINISHED
|
34
|
+
android_id = generate_device_id() # SIXTH other FILE FINISHED
|
35
|
+
res = {
|
36
|
+
'p' => android_id,
|
37
|
+
'a' => @steamid,
|
38
|
+
'k' => confirmation_key,
|
39
|
+
't' => timestamp,
|
40
|
+
'm' => 'android',
|
41
|
+
'tag' => tag_string
|
42
|
+
}
|
43
|
+
return res
|
44
|
+
end
|
45
|
+
|
46
|
+
def fetch_confirmations_page() ## THIRD FINISHED
|
47
|
+
tag = 'conf'
|
48
|
+
params = create_confirmation_params(tag) ## FOURTH FIISHED
|
49
|
+
headers = {'X-Requested-With' => 'com.valvesoftware.android.steam.community'}
|
50
|
+
#@session.pre_connect_hooks << lambda do |agent, request|
|
51
|
+
# request['X-Requested-With'] = 'com.valvesoftware.android.steam.community'
|
52
|
+
#end
|
53
|
+
no = nil
|
54
|
+
response = @session.get('https://steamcommunity.com/mobileconf/conf', params, no, headers)
|
55
|
+
html = response.content
|
56
|
+
if html.include?('Steam Guard Mobile Authenticator is providing incorrect Steam Guard codes.')
|
57
|
+
puts "invalid steammguard"
|
58
|
+
exit
|
59
|
+
end
|
60
|
+
return html
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
def select_trade_offer_confirmation(trade_id, confirmations) ## seventh
|
67
|
+
confirmations.each { |confirmhash|
|
68
|
+
confirmation_details_page = fetch_confirmation_details_page(confirmhash) ## eighteth
|
69
|
+
confirm_id = get_confirmation_trade_offer_id(confirmation_details_page) ## nineth
|
70
|
+
if confirm_id == trade_id
|
71
|
+
return confirmhash
|
72
|
+
end
|
73
|
+
}
|
74
|
+
puts "did not find a confirmation"
|
75
|
+
exit
|
76
|
+
end
|
77
|
+
|
78
|
+
def fetch_confirmation_details_page(hash) ##eigth
|
79
|
+
var = hash['id']
|
80
|
+
tag = 'details' + var
|
81
|
+
params = create_confirmation_params(tag) ## EXISTS
|
82
|
+
response = @session.get("https://steamcommunity.com/mobileconf/details/#{var}", params)
|
83
|
+
return JSON.parse(response.content)["html"]
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_confirmation_trade_offer_id(html) ## nineth
|
87
|
+
full_offer_id = Nokogiri::HTML(html).css('.tradeoffer')[0]['id']
|
88
|
+
return full_offer_id.split('_', 2)[1]
|
89
|
+
end
|
90
|
+
|
91
|
+
def send_confirmation(confirmationhash) ## tenth
|
92
|
+
tag = 'allow'
|
93
|
+
params = create_confirmation_params(tag) ## EXISTS
|
94
|
+
params['op'] = tag
|
95
|
+
params['cid'] = confirmationhash["data_confid"]
|
96
|
+
params['ck'] = confirmationhash["data_key"]
|
97
|
+
headers = {'X-Requested-With' => 'XMLHttpRequest'}
|
98
|
+
#@session.pre_connect_hooks << lambda do |agent, request|
|
99
|
+
# request['X-Requested-With'] = 'XMLHttpRequest'
|
100
|
+
#end
|
101
|
+
no = nil
|
102
|
+
page = @session.get('https://steamcommunity.com/mobileconf/ajaxop', params,no ,headers)
|
103
|
+
return JSON.parse(page.content)
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
data/lib/Guard.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
module GuardCommands
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
def fa()
|
8
|
+
timestamp = Time.new.to_i
|
9
|
+
math = timestamp / 30
|
10
|
+
math = math.to_i
|
11
|
+
time_buffer =[math].pack('Q>')
|
12
|
+
|
13
|
+
hmac = OpenSSL::HMAC.digest('sha1', Base64.decode64(@secret), time_buffer)
|
14
|
+
|
15
|
+
start = hmac[19].ord & 0xf
|
16
|
+
last = start + 4
|
17
|
+
pre = hmac[start..last]
|
18
|
+
fullcode = pre.unpack('I>')[0] & 0x7fffffff
|
19
|
+
|
20
|
+
chars = '23456789BCDFGHJKMNPQRTVWXY'
|
21
|
+
code= ''
|
22
|
+
for looper in 0..4 do
|
23
|
+
copy = fullcode #divmod
|
24
|
+
i = copy % chars.length #divmod
|
25
|
+
fullcode = copy / chars.length #divmod
|
26
|
+
code = code + chars[i]
|
27
|
+
end
|
28
|
+
return code
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def generate_confirmation_key(tag_string, time_stamp)
|
33
|
+
buffer = [time_stamp].pack('Q>') + tag_string.encode('ascii')
|
34
|
+
return Base64.encode64(OpenSSL::HMAC.digest('sha1', Base64.decode64(@identity_secret), buffer))
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def generate_device_id()
|
39
|
+
hexed = Digest::SHA1.hexdigest(@steamid.to_s)
|
40
|
+
res = 'android:' + [hexed[0..7],hexed[8..11],hexed[12..15],hexed[16..19],hexed[20..31]].join('-')
|
41
|
+
return res
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module LoginCommands
|
2
|
+
|
3
|
+
########################################################################################
|
4
|
+
def login
|
5
|
+
data = pass_stamp()
|
6
|
+
encrypted_password = data["password"]
|
7
|
+
timestamp = data["timestamp"]
|
8
|
+
repeater = 0
|
9
|
+
until repeater == true
|
10
|
+
if @secret != nil
|
11
|
+
guardcode = fa()
|
12
|
+
else
|
13
|
+
puts "please write your 2FA code"
|
14
|
+
guardcode = gets.chomp
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
send = {
|
19
|
+
'password' => encrypted_password,
|
20
|
+
'username' => @username,
|
21
|
+
'twofactorcode' =>guardcode, #update
|
22
|
+
'emailauth' => '',
|
23
|
+
'loginfriendlyname' => '',
|
24
|
+
'captchagid' => '-1',
|
25
|
+
'captcha_text' => '',
|
26
|
+
'emailsteamid' => '',
|
27
|
+
'rsatimestamp' => timestamp,
|
28
|
+
'remember_login' => 'false'
|
29
|
+
}
|
30
|
+
|
31
|
+
login = @session.post('https://store.steampowered.com/login/dologin', send )
|
32
|
+
response = JSON::parse(login.body)
|
33
|
+
|
34
|
+
if response["success"] == true
|
35
|
+
repeater = true
|
36
|
+
puts response
|
37
|
+
elsif repeater == 3
|
38
|
+
puts "Could not login"
|
39
|
+
puts "exiting"
|
40
|
+
exit
|
41
|
+
else
|
42
|
+
puts "re-trying to login"
|
43
|
+
puts "sleeping for 6 seconds"
|
44
|
+
sleep(6)
|
45
|
+
repeater = repeater + 1
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
if @steamid != nil && @steamid != response["transfer_parameters"]["steamid"]
|
51
|
+
puts "the steamid you provided does not belong to the account you entered"
|
52
|
+
puts "steamid will be overwritten"
|
53
|
+
@steamid = response["transfer_parameters"]["steamid"]
|
54
|
+
|
55
|
+
else
|
56
|
+
@steamid = response["transfer_parameters"]["steamid"]
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
response["transfer_urls"].each { |url|
|
61
|
+
@session.post(url, response["transfer_parameters"])
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
steampowered_sessionid = ''
|
67
|
+
@session.cookies.each { |c|
|
68
|
+
if c.name == "sessionid"
|
69
|
+
steampowered_sessionid = c.value
|
70
|
+
end
|
71
|
+
}
|
72
|
+
|
73
|
+
cookie = Mechanize::Cookie.new :domain => 'steamcommunity.com', :name =>'sessionid', :value =>steampowered_sessionid, :path => '/'
|
74
|
+
@session.cookie_jar << cookie
|
75
|
+
puts "logged-in with steamid: #{@steamid}"
|
76
|
+
end
|
77
|
+
########################################################################################
|
78
|
+
|
79
|
+
|
80
|
+
########################################################################################
|
81
|
+
private
|
82
|
+
def pass_stamp()
|
83
|
+
response = @session.post('https://store.steampowered.com/login/getrsakey/', {'username' => @username})
|
84
|
+
|
85
|
+
data = JSON::parse(response.body)
|
86
|
+
mod = data["publickey_mod"].hex
|
87
|
+
exp = data["publickey_exp"].hex
|
88
|
+
timestamp = data["timestamp"]
|
89
|
+
|
90
|
+
key = OpenSSL::PKey::RSA.new
|
91
|
+
key.e = OpenSSL::BN.new(exp)
|
92
|
+
key.n = OpenSSL::BN.new(mod)
|
93
|
+
ep = Base64.encode64(key.public_encrypt(@password.force_encoding("utf-8"))).gsub("\n", '')
|
94
|
+
return {'password' => ep, 'timestamp' => timestamp }
|
95
|
+
end
|
96
|
+
########################################################################################
|
97
|
+
|
98
|
+
|
99
|
+
end
|
data/lib/Misc.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
module Abilites
|
2
|
+
########################################################################################
|
3
|
+
def copy_session
|
4
|
+
return @session
|
5
|
+
end
|
6
|
+
########################################################################################
|
7
|
+
def overwrite_session(new_session)
|
8
|
+
if new_session.class == Mechanize
|
9
|
+
@session = new_session
|
10
|
+
end
|
11
|
+
end
|
12
|
+
########################################################################################
|
13
|
+
def sessionid_cookie()
|
14
|
+
value = nil
|
15
|
+
begin
|
16
|
+
value = @session.cookie_jar.jar["steamcommunity.com"]["/"]["sessionid"].value
|
17
|
+
rescue
|
18
|
+
value = nil
|
19
|
+
end
|
20
|
+
if value == nil
|
21
|
+
begin
|
22
|
+
@session.cookie_jar.jar["store.steampowered.com"]["/"]["sessionid"].value
|
23
|
+
rescue
|
24
|
+
value = nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if value == nil
|
29
|
+
@session.cookies.each { |c|
|
30
|
+
if c.name == "sessionid"
|
31
|
+
value = c.value
|
32
|
+
end
|
33
|
+
}
|
34
|
+
end
|
35
|
+
return value
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
private
|
41
|
+
def partner_id_to_steam_id(account_id)
|
42
|
+
unknown_constant = 17825793 # or 0x1100001 idk wtf is this but ....
|
43
|
+
first_bytes = [account_id.to_i].pack('i>')
|
44
|
+
last_bytes = [unknown_constant].pack('i>')
|
45
|
+
collect = last_bytes + first_bytes
|
46
|
+
return collect.unpack('Q>')[0].to_s
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
end
|
data/lib/Trade.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
module TradeCommands
|
2
|
+
|
3
|
+
|
4
|
+
def clean_items(items)
|
5
|
+
items.each { |t|
|
6
|
+
t["amount"] = t["amount"].to_i
|
7
|
+
t.delete_if {|k,v| k != 'appid' && k != 'contextid' && k != 'assetid' && k != "amount"}
|
8
|
+
}
|
9
|
+
return items
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def send_offer(mine, they, link, message = '')
|
14
|
+
partner_raw = link.split('partner=',2)[1].split('&',2)[0]
|
15
|
+
|
16
|
+
|
17
|
+
token = link.split('token=', 2)[1]
|
18
|
+
|
19
|
+
|
20
|
+
theirs = clean_items(they)
|
21
|
+
|
22
|
+
|
23
|
+
me = clean_items(mine)
|
24
|
+
|
25
|
+
partner_steamid = partner_id_to_steam_id(partner_raw)
|
26
|
+
|
27
|
+
|
28
|
+
sessionid = sessionid_cookie()
|
29
|
+
|
30
|
+
params = {
|
31
|
+
'sessionid' => sessionid,
|
32
|
+
'serverid' => 1,
|
33
|
+
'partner' => partner_steamid,
|
34
|
+
'tradeoffermessage' => message,
|
35
|
+
'json_tradeoffer' => {
|
36
|
+
"newversion" => true,
|
37
|
+
"version" => 4,
|
38
|
+
"me" => {
|
39
|
+
"assets" => mine, #create this array
|
40
|
+
"currency" => [],
|
41
|
+
"ready" => false
|
42
|
+
},
|
43
|
+
"them" => {
|
44
|
+
"assets" => theirs, #create this array
|
45
|
+
"currency" => [],
|
46
|
+
"ready" => false
|
47
|
+
}
|
48
|
+
}.to_json, ###ADDED TO JSON FIX
|
49
|
+
'captcha' => '',
|
50
|
+
'trade_offer_create_params' => {'trade_offer_access_token' => token}.to_json ## ADDED TO JSON FIX
|
51
|
+
}
|
52
|
+
|
53
|
+
send = @session.post(
|
54
|
+
'https://steamcommunity.com/tradeoffer/new/send',
|
55
|
+
params,
|
56
|
+
{'Referer' => 'https://steamcommunity.com/tradeoffer/new', 'Origin' => 'https://steamcommunity.com'}
|
57
|
+
)
|
58
|
+
response = JSON.parse(send.body)
|
59
|
+
puts "trade offer sent" + response["tradeofferid"])
|
60
|
+
if response["needs_mobile_confirmation"] == true
|
61
|
+
if @identity_secret != nil && @steamid != nil
|
62
|
+
responsehash = response.merge(send_trade_allow_request(response["tradeofferid"]))
|
63
|
+
puts "offer confirmed" + response["tradeofferid"])
|
64
|
+
else
|
65
|
+
puts "cannot confirm trade automatically, informations missing"
|
66
|
+
puts "Please confirm the trade offer manually #{response["tradeofferid"]} "
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
end
|
data/lib/steam-trade.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'mechanize'
|
2
|
+
require 'json'
|
3
|
+
require 'openssl'
|
4
|
+
require 'base64'
|
5
|
+
|
6
|
+
require 'LoginExecutor.rb'
|
7
|
+
require 'Misc.rb'
|
8
|
+
require 'Trade.rb'
|
9
|
+
require 'Confirmation.rb'
|
10
|
+
require 'Trade.rb'
|
11
|
+
|
12
|
+
class Handler
|
13
|
+
include LoginCommands
|
14
|
+
include TradeCommands
|
15
|
+
include ConfirmationCommands
|
16
|
+
include GuardCommands
|
17
|
+
include Abilites
|
18
|
+
|
19
|
+
def initialize(username,password,secret = nil)
|
20
|
+
@username = username
|
21
|
+
@password = password
|
22
|
+
@secret = secret
|
23
|
+
|
24
|
+
@steamid = nil # will be initialized once you login and can be initialized with mobile_info
|
25
|
+
@identity_secret = nil # can and should be initialized using mobile_info
|
26
|
+
@confirmator = nil # will be initialized once steamid and identity secret are set
|
27
|
+
|
28
|
+
@session = Mechanize.new { |agent|
|
29
|
+
agent.user_agent_alias = 'Windows Mozilla'
|
30
|
+
agent.follow_meta_refresh = true
|
31
|
+
}
|
32
|
+
login
|
33
|
+
end
|
34
|
+
|
35
|
+
def mobile_info(identity_secret, steamid = nil)
|
36
|
+
@identity_secret = identity_secret
|
37
|
+
if @steamid == nil && steamid != nil
|
38
|
+
@steamid = steamid
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
data/steam-trade.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "steam-trade"
|
8
|
+
spec.version = '0.0.2'
|
9
|
+
spec.date = '2018-04-21'
|
10
|
+
spec.authors = ["OmG3r"]
|
11
|
+
spec.email = ["adam.boulila@live.fr"]
|
12
|
+
spec.files = Dir['lib/ *.rb'] + Dir['bin/*']
|
13
|
+
spec.summary = %q{Manage steam trading offers. }
|
14
|
+
spec.description = %q{Send steam trading offers, generate steam 2FA codes, confirm steam trade offers}
|
15
|
+
spec.homepage = "https://github.com/OmG3r/steam-trade/"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
|
+
f.match(%r{^(test|spec|features)/})
|
22
|
+
end
|
23
|
+
spec.bindir = "exe"
|
24
|
+
spec.executables = []
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_runtime_dependency "mechanize", '~> 2.7', '>= 2.7.0'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: steam-trade
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- OmG3r
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-21 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.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mechanize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.7'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 2.7.0
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '2.7'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.7.0
|
61
|
+
description: Send steam trading offers, generate steam 2FA codes, confirm steam trade
|
62
|
+
offers
|
63
|
+
email:
|
64
|
+
- adam.boulila@live.fr
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- ".gitignore"
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE.txt
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- bin/console
|
75
|
+
- bin/setup
|
76
|
+
- lib/Confirmation.rb
|
77
|
+
- lib/Guard.rb
|
78
|
+
- lib/LoginExecutor.rb
|
79
|
+
- lib/Misc.rb
|
80
|
+
- lib/Trade.rb
|
81
|
+
- lib/steam-trade.rb
|
82
|
+
- steam-trade.gemspec
|
83
|
+
homepage: https://github.com/OmG3r/steam-trade/
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.5.2
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Manage steam trading offers.
|
107
|
+
test_files: []
|