Monday, 12 August 2013

Getting users passwords in a system

#Author: CtechZ
#Organization: OR
#Date: 30-07-2013
#Purpose: Get passwords of all users and store it in a seperate file called "pass", also check this file "pass"
# is already their in that location or not, if yes not create any file else appent the passwords into it,if file is not their create a file
# called "pass" and add into it. It will only print root user's and normal users passwod, will not print any system user's


:> $location/$file2


# Checking the pass file is their in location or not

if [ -f $location/$file2 ]

cut -f2 -d: $file > $location/$file2 else    
touch $location/$file2 | cut -f2 -d: $file > $location/$file2


# Remove the system users password from the file "pass", Only need root user and normal users passwords
sed -i '/^*/d' $location/$file2 &&  sed -i '/^!!/d' $location/$file2


No comments:

Post a Comment