Last active
June 5, 2020 19:32
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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