require 'net/http' | |
require 'json' | |
require 'zlib' | |
require 'stringio' | |
POSSIBLE_CHARACTERS = [*?a..?z] + [*?0..?9] + ["_"] | |
ROBLO_SECURITY = "" #necessary for ROBLOX to allow you to query | |
def valid_username?(username) | |
url = URI.parse("https://auth.roblox.com/v1/usernames/validate?context=UsernameChange&username=#{username}") | |
http = Net::HTTP.new(url.host, url.port) | |
http.use_ssl = true | |
req = Net::HTTP::Get.new(url.request_uri) | |
req["Accept-Encoding"] = "gzip, deflate, br" | |
req["Cookie"] = ".ROBLOSECURITY=#{ROBLO_SECURITY}" | |
begin | |
response = http.request(req) | |
rescue | |
retry | |
end | |
gz = Zlib::GzipReader.new(StringIO.new(response.body.to_s)) | |
JSON.parse(gz.read)['data'] == 0 | |
end | |
def operation(word, i, success_f, fail_f) | |
if valid_username?(word) | |
puts "------ #{i}: #{word}" | |
success_f.write(word + "\n") | |
else | |
puts "#{i}: #{word} failed" | |
fail_f.write(word + "\n") | |
end | |
end | |
def alphanumeric_permutations(input, length, current_str) | |
return [ current_str ] if current_str.length == length | |
ret = [] | |
for i in (0...input.length) do | |
at_str_end = (current_str.length == 0) || (current_str.length + 1 == length) | |
has_underscore = current_str.include?("_") | |
next if ((at_str_end || has_underscore) && input[i] == '_') | |
ret.push(*alphanumeric_permutations(input, length, current_str + input[i])) | |
end | |
return ret; | |
end | |
begin | |
combos = alphanumeric_permutations(POSSIBLE_CHARACTERS, 4, '') | |
success_f = File.open("success", "a") | |
fail_f = File.open("failure", "a") | |
i = 0 | |
until combos[i].nil? | |
threads = [] | |
50.times do | |
break if combos[i].nil? | |
threads << Thread.new(i) do |i| # Local copy of i at time of thread | |
operation(combos[i], i, success_f, fail_f) | |
end | |
i += 1 | |
end | |
sleep(0.1) until threads.each.map { |t| t.alive? }.none? # lazy solution | |
threads.each { |t| t.kill } # no zombies | |
end | |
rescue IOError => e | |
puts e | |
ensure | |
success_f.close unless success_f.nil? | |
fail_f.close unless fail_f.nil? | |
end |
How do you execute this? Ruby on rails isn't working for me
it just says Unexpected string what does that mean?
file gzip not in format but it seems to work when installing ruby on rails correctly but i just dont know how to see the usernames
C:/Users/solsi/AppData/Local/Temp/tempCodeRunnerFile.ruby:23:in initialize': not in gzip format (Zlib::GzipFile::Error) from C:/Users/solsi/AppData/Local/Temp/tempCodeRunnerFile.ruby:23:in
new'
from C:/Users/solsi/AppData/Local/Temp/tempCodeRunnerFile.ruby:23:in valid_username?' from C:/Users/solsi/AppData/Local/Temp/tempCodeRunnerFile.ruby:28:in
operation'
from C:/Users/solsi/AppData/Local/Temp/tempCodeRunnerFile.ruby:59:in `block (2 levels) in
It doesn't work any more because Roblox now asks for a valid birthday in the request, perhaps there are even more things preventing the code from working.
For example "324uhew87237r" is a valid Roblox username and it is available, but when you enter
"https://auth.roblox.com/v1/usernames/validate?context=UsernameChange&username=324uhew87237r"
on a web browser (I am using Firefox) it outputs this:
{"errors":[{"code":2,"message":"A valid birthday or authenticated user is required.","userFacingMessage":"Something went wrong."}]}
Nice thing.