Saturday, August 25, 2012

Creating tarball with timestamp

I have several samples of malware that I got from my Dionaea sensor. Now if somebody asked, how to get all my sample is bulky file - which is simpler to download - then I need to create a tarball.

For me, I see it's important to have a timestamp at the tarball so that I'll quickly noticed whether something screwed in my script or whatsoever.

In the same directory, there as some other files too. TXT file. So I only want to grab the MD5SUM files.

Here goes.

rm *.tar.bz2;tar cjvf `date +"%d%b%y-%H%M%p"`.tar.bz2 `ls|grep -e "[0-9a-f]\{32\}"`; gpg --passphrase infected -c *.bz2

1- It will delete the previous tarball. Since my storage is limited
2- Use tar with c flag to create bunzup. Use the appropriate timestamp. 
3- Use grep as pipe to fetch ONLY MD5SUM files
4- Use GPG to encrypt the file.
5- You may use cronjob to automate the process as you want. I created this file every day by using cron script.

The purpose of GPG is to encrypt the file, just in case any user having difficulty to download the tarball due to their anti virus blockage.

No comments:

Post a Comment