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

These Might Interest You

  • If this matches any files on your web server expect to find allot of malware spread throughout your server folders. Seems to target wordpress sites. Be sure to check your themes/theme-name/header.php files manually for various redirect scripting usually in the line right above the close head tag. Good luck! Show Sample Output


    0
    find / -name \*.php -exec grep -Hn .1.=.......0.=.......3.=.......2.=.......5.= {} \;
    UnklAdM · 2015-10-28 20:58:53 0
  • This command is for producing GNU sha256sum-compatible hashes on UNIX systems that don't have sha256sum but do have OpenSSL, such as stock IBM AIX. 1.- Saves a wrapper script for UNIX find that does the following: A.- Feeds a file to openssl on SHA256 hash calculation mode B.- Echoes the output followed by the filename 2.- Makes the file executable 3.- Runs find on a directory, only processing files, and running on each one the wrapper script that calculates SHA256 hashes Pending is figuring out how to verify a sha256sum file on a similar environment. Show Sample Output


    0
    echo '#! /usr/bin/ksh\necho `cat $1 | openssl dgst -sha256` $1' > sslsha256; chmod +x sslsha256; find directory -type f -exec ./sslsha256 \{\} \;
    RAKK · 2013-09-18 17:37:50 0
  • Does an 'ls' on just the files and directories in the current directory with an execute bit turned on. This version will list directories. Just tack on "-type f" to the start of the find to omit listing directories and list only files.


    1
    ls -dF `find . -maxdepth 1 \( -perm -1 -o \( -perm -10 -o -perm -100 \) \) -print`
    wam · 2009-02-05 16:59:38 0
  • This command will tell you the 20 biggest directories starting from your working directory and skips directories on other filesystems. Useful for resolving disk space issues.


    7
    du -xk | sort -n | tail -20
    dopeman · 2009-03-30 11:37:43 1

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: