#!/usr/bin/ruby # # author: nein # date: 2005 # desc: reads an aix /etc/security/passwd file and converts it to the # traditional /etc/shadow format for use in john, etc. usage = "./aixpwd_parse.rb " aix = ARGV[0] if !aix puts usage exit end user, pass = nil aixFile = File.open(aix,"r") class MyPrint def output(user,pass) puts "#{user}:#{pass}:::::::" end end aixFile.each do |line| pass = nil p = MyPrint.new() line = line.chomp next if line =~ /^$/ next if line =~ /lastupdate/ next if line =~ /flags/ if line =~ /:$/ user = line.split(":") end if line =~ /password/ pass = line.split("password = ") pass = pass[1] end if pass user.each do |user| p.output(user,pass) end end end