Skip to content

Instantly share code, notes, and snippets.

@ccammilleri
Created January 29, 2017 20:48
Show Gist options
  • Save ccammilleri/4a627188c44490cb6c6d3d104c9ae77a to your computer and use it in GitHub Desktop.
Save ccammilleri/4a627188c44490cb6c6d3d104c9ae77a to your computer and use it in GitHub Desktop.
require 'json'
require 'smbhash'
require 'open-uri'
require 'digest/md5'
# get data from here
# wget https://api.randomuser.me/?results=1000&password=4,15&nat=us
open('seed.json', 'wb') do |file|
file << open('https://api.randomuser.me/?results=1000&password=4,15&nat=us').read
end
f = File.read("seed.json")
json = JSON.parse(f)
def pwdump(json)
json["results"].each do |item|
user = item["login"]["username"]
uid = rand(500..9999)
hash = Smbhash.ntlm_hash(item["login"]["password"].chomp)
puts "#{user}:#{uid}:NO PASSWORD*********************:#{hash}:::"
end
end
def ntlm_raw(json)
json["results"].each do |item|
hash = Smbhash.ntlm_hash(item["login"]["password"].chomp)
puts "#{hash}"
end
end
def md5_raw(json)
json["results"].each do |item|
pass = item["login"]["password"].chomp
puts Digest::MD5.hexdigest(pass)
include_stupids("md5")
end
end
def sha1_raw(json)
json["results"].each do |item|
pass = item["login"]["password"].chomp
puts Digest::SHA1.hexdigest(pass)
include_stupids("sha1")
end
end
def include_stupids(type)
['Summer16', 'Fall2016', 'Changem3', 'changeme', 'Welcome1', 'Summer2016', 'Password1'].each do |pass|
num = rand(5..40)
num.times do
if type == "md5"
puts Digest::MD5.hexdigest(pass)
elsif type == "sha1"
puts Digest::MD5.hexdigest(pass)
elsif type == "ntlm"
puts pass
puts Smbhash.ntlm_hash(pass.chomp)
end
end
end
end
pwdump(json)
#md5_raw(json)
#sha1_raw(json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment