Skip to content

Instantly share code, notes, and snippets.

@gangelo
Last active June 5, 2020 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gangelo/6f30e36babded5028f78dbb0dd3ff6bf to your computer and use it in GitHub Desktop.
Save gangelo/6f30e36babded5028f78dbb0dd3ff6bf to your computer and use it in GitHub Desktop.
Takes in_file that has lines in the format <username><:token><password> (e.g. user1:p@ssw0rd) and writes the passwords to out_file.
# Takes in_file that has lines in the format
# <username><:token><password> (e.g. user1:p@ssw0rd)
# and writes the passwords to out_file.
#
# Helpful for extracting the passwords from files
# found in /usr/share/seclists/Passwords/
in_file = 'ssh-betterdefaultpasslist.txt'
out_file = '/tmp/passwords.txt'
token = ':'
lines = File.open(in_file).read
lines.gsub!(/\r\n?/, "\n")
File.open(out_file, 'w') do |out|
lines.each_line do |line|
_, password = line.split(token)
out.puts(password)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment