dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

dailylogin.rb (1483B)


      1 #!/usr/bin/env ruby
      2 require 'net/http'
      3 require 'uri'
      4 require 'rexml'
      5 require 'io/console'
      6 
      7 print 'email: '
      8 email = gets.chomp
      9 print 'pass: '
     10 password = $stdin.noecho(&:gets).chomp
     11 
     12 # For windows see here https://github.com/MaikEight/ExaltAccountManager/blob/9435db6c63a4fb6fd93e594d1cff7a7879b35bb1/EAM%20Daily%20Login%20Service/DailyLogin.cs#L706
     13 unique_id = `ioreg -d2 -c IOPlatformExpertDevice | awk -F\\" '/IOPlatformUUID/{printf $(NF-1)}'`
     14 
     15 def send_req(url, form_data)
     16   url = URI(url)
     17   https = Net::HTTP.new(url.host, url.port)
     18   https.use_ssl = true
     19   req = Net::HTTP::Post.new url.path
     20   req.content_type = 'application/x-www-form-urlencoded'
     21   req.set_form_data(form_data)
     22   https.request(req)
     23 end
     24 
     25 puts 'Logging in...'
     26 values = {
     27   guid: email,
     28   password: password,
     29   clientToken: unique_id,
     30   game_net: 'Unity',
     31   play_platform: 'Unity',
     32   game_net_user_id: ''
     33 }
     34 
     35 response = send_req('https://www.realmofthemadgod.com/account/verify', values)
     36 abort 'Error in getting access token' unless response.code_type == Net::HTTPOK
     37 
     38 doc = REXML::Document.new response.body
     39 access_token = doc.elements['/Account/AccessToken'].text
     40 values = {
     41   do_login: 'false',
     42   accessToken: access_token,
     43   game_net: 'Unity',
     44   play_platform: 'Unity',
     45   game_net_user_id: '',
     46   muleDump: 'true',
     47   __source: 'jakcodex-v965'
     48 }
     49 
     50 response = send_req('https://www.realmofthemadgod.com/char/list', values)
     51 abort 'Error in getting login' unless response.code_type == Net::HTTPOK
     52 
     53 puts response.body