Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Script to search file systems for Hash Values


    Hi Guys,

    Firstly, Im a complete newbie when it comes to scripting, so thanks in advance for your patience

    Im looking to create a Linux script which searches the whole file system for a particular list of MD5 and SHA1 HASH values (approx 20 values in total, 10 of each).

    Is there an easy way to achieve this using a script?

    I was toying around with the following, but not sure if im even on the right track:

    find / -type f | md5sum | grep 5b8667e6f466d8f26d39bf3a9d4c6154

    Do i need a cron job also?

    Thanks guys

    Dave

  2. #2
    hi,

    what do you think a cron job would be useful for ?

    Code:
    find / -type f -exec md5sum {} \; | grep "$md5Val"
    be clear on the steps that are needed to reach your goal.

  3. #3
    Thanks for response man.

    So ignore cron job comment. My bad.

    Ultimately I want to put the 20 MD5 / SHA1 hashes into a script and run the script against my various linux servers, providing me matching hashes. I donít want to have to search for the hashes one by one.

    Ffollow up question, would running a script like this be massively resource intensive?

  4. $spacer_open
    $spacer_close
  5. #4
    at a moment or another hashes will be parsed one by one...

    you could fill a file with them and grep each file's md5sum, and if it matches, then output filename.

  6. #5
    Quote Originally Posted by watael View Post
    you could fill a file with them and grep each file's md5sum, and if it matches, then output filename.
    Ok cool. How would I configure that? How would the find statement look to reference file? And would the file just be line by line hashes and nothing more?

  7. #6
    Linux Guru
    Join Date
    Dec 2013
    Posts
    2,747
    watael already gave you 50% of the script by replacing the md5sum with a variable.
    do some research on scripting, it's not that hard.
    i'd use an array of defined md5sums, and iterate over that.
    BashGuide/Arrays - Greg's Wiki
    i'd feel uncomfortable simply writing it for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •