Skip to content

Instantly share code, notes, and snippets.

@Wittiest
Last active March 13, 2024 18:47
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Wittiest/9ffe7ab83d60a5423e9aca1de3243f79 to your computer and use it in GitHub Desktop.
ROBLOX Name Generator / Checker
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
@WharkOddity
Copy link

Nice thing.

@Felios22
Copy link

Felios22 commented May 4, 2020

How do you execute this? Ruby on rails isn't working for me

@marinagebrail
Copy link

it just says Unexpected string what does that mean?

@zak1juststart3d
Copy link

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

@zak1juststart3d
Copy link

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

'

@Ad4mu
Copy link

Ad4mu commented Jun 26, 2023

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."}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment