Find Malware in the current and sub directories by MD5 hashes

IFS=$'\n' && for f in `find . -type f -exec md5sum "{}" \;`; do echo $f | sed -r 's/^[^ ]+/Checking:/'; echo $f | cut -f1 -d' ' | netcat hash.cymru.com 43 ; done
Command makes use of the Malware Hash Registry (http://www.team-cymru.org/Services/MHR/). It parses the current directory and subdirectories and calculates the md5 hash of the files, then prints the name and sends the hash to the MHR for a lookup in their database. The 3rd value in the result is the detection percentage across a mix of AV packages.
Sample Output
Checking:  ./yffix3Qs.zip
d95a72eb35820cc1dc3d750b53090b78 1318649640 NO_DATA
Checking:  ./B_Malware_210911/soft.exe
52ca815d29da154fc1dff687505feab3 1318649641 NO_DATA
Checking:  ./B_Malware_210911/sistem_nod.exe
6325547dd016d2e47e258396dc695ed7 1316696641 18
Checking:  ./B_Malware_210911/yabotovrot.exe
33b76caf40a7ac013fded283b0f87c1e 1317442076 39
Checking:  ./cat
332fc925297433af694c835afb8609f7 1318649646 NO_DATA
Checking:  ./alot_symbolleiste_lexika_installer.exe
7cf02c378e195a85f586bbb83f7f4660 1318649647 NO_DATA

11
By: Neo23x0
2011-10-15 03:38:47

1 Alternatives + Submit Alt

  • This command does something similar using dig which is usually more available. Show Sample Output


    0
    for i in $(find . -type f); do echo -n "$i " ;dig +short $(md5sum $i | cut -d' ' -f1).malware.hash.cymru.com TXT; echo ; done
    cerasus · 2015-07-28 09:58:04 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: