#!/bin/bash
#Author: CtechZ
#Organization: ctechz.blogspot.com OR ctechz.com
#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
file=/etc/shadow
location=/Results/
file2=pass
:> $location/$file2
# Checking the pass file is their in location or not
if [ -f $location/$file2 ]
then
cut -f2 -d: $file > $location/$file2 else
touch $location/$file2 | cut -f2 -d: $file > $location/$file2
fi
# 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
#EOF
#Author: CtechZ
#Organization: ctechz.blogspot.com OR ctechz.com
#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
file=/etc/shadow
location=/Results/
file2=pass
:> $location/$file2
# Checking the pass file is their in location or not
if [ -f $location/$file2 ]
then
cut -f2 -d: $file > $location/$file2 else
touch $location/$file2 | cut -f2 -d: $file > $location/$file2
fi
# 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
#EOF
No comments:
Post a Comment