|Keep It Simple, Stupid|
Parsing a line of textby TCPDump (Initiate)
|on Mar 13, 2013 at 16:57 UTC||Need Help??|
TCPDump has asked for the
wisdom of the Perl Monks concerning the following question:
First off, I am not attempting to crack passwords here....
As everyone knows most Unix systems put their passwords in a file usually /etc/shadow.
Each line has 9 fields including the fields that say when the password was last changed, and how long the password is good for.
Several of our poor old abused Unix boxes have over 2,000 user names on it but we think only about 500 use the system. I am looking for a way to take the shadow file and:
Read the /etc/shadow file line by line (9 fields seperated by a ':' )
Take the contents of field 1 which is the user name
Take the first 3 characters of the second field which can be a * meaning locked, or a !! meaning expired, or a $X$ with type of encryption used.
Take the third field which is the day the password was last changed, convert it to a real date since it is the number of days since Jan 1 1970
Take the value of the fifth field and add it to the third field and convert it to a date which would then tell me the date of the next password change
Then display the user name, account status, date of last password change and the date of the next one. Better yet, some sort of notation that the account is expired if it is.
I have been requested to write a script in my spare time that will provide some diagnostics on a box so this is the first part. Since I am not anywhere ner a programmer, I am pretty sure I will have more questions in the future