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

Thanks

TCPDump


In reply to Parsing a line of text by TCPDump

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.