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.

Friday, August 24, 2012

Customizing terminal theme with bashish

Feel bored with your dry looking, non intuitive PS1 terminal? Try bashish. It really rocks up to you feel wants to cry.

I just used the tarball from here, as the link for *.deb is dead. Just initialize "bashish" the moment you finished installed it into your system.

To use the various theming, run bashish list and bashish <your theme of choice>. Cool ha?

Friday, August 17, 2012

Installing Linux on Mac Mini

I finally decided to install Linux on Mac Mini 2009. It runs Intel Core 2 Duo and has around 1GB RAM + 100GB+ HDD storage. Yes, not a decent specs. I also planning to upgrade the RAM but since it's using DDR3 which is quite rare to find it in Lowyat, I decided to stay with the specs.

1) Since Mac is advanced enough and not relying to normal BIOS, we have to do some workaround with its EFI. What we need to do is by using rEFIt. You can use the command line installation or install by using Mac's DMG file.

2) First of all, we need to repartition the hard disk. Use bootcamp (Application->Utilities->Bootcamp). Like in my case I need to use DiskUtility as well to segregate the partition. If you plan to use GParted, you need to insert your installation CD first then reboot, after that go to your live CD session and use GParted to repartition your Mac HDD

3) Then install. For my Mac Mini, it was painfully slow. But with some patience(actually.. a lot!) I managed to install Linux Mint Maya on my Mac Mini. However, unlike Ubuntu 12.04 LTS, it does not come with Wireless Driver (I guess, propietary). Hence we need to use Ethernet cable to install it or in my case I use my phone through USB tethering. You will also noticed during the installation you need to create at least 2 partitions. One small partition, 1MB for grub installation. Another one is for your root.. and you may create your swap partition as well. In my case I created:

  • partition for Grub/BIOS
  • / (root) partition
  • /home (in case I want to change to other distro.. I can just wipe my / partition and retain this
  • swap

4) The rest is pretty straightforward.

Intel Core 2 Duo is equivalent to 64 bit architecture. If nothing was wrong you could see two processors append in /proc/cpuinfo 

You can also mount you Mac partition from your Linux. Mac is using HFS+ filesystem. If you want to automount, just edit your /etc/fstab. In the filesystem type use "hfsplus" for the filesystem option.


Thursday, August 9, 2012

Editing boot up service in Linux Mint

Last time when I had the "Redhat" time, I comfortably use chkconfig to edit which service to boot up at which init level.

Now that I left my old job, I don't really much bother which service starts during the boot up and what not.

In Linux Mint, you ca n use "sysv-rc-conf" to accomplish this:

Check in your repo:

$ apt-cache search sysv-rc-conf
sysv-rc-conf - SysV init runlevel configuration tool for the terminal

It's there, then install

sudo apt-get install sysv-rc-conf

Fire up the tool, 

sudo sysv-rc-conf

You will get this display:

You can toggle which service that you want to boot up in which level. As simple as that.

Have fun! Tested on Linux Maya 13 based on Ubuntu 12.04

Monday, August 6, 2012

Fetch md5sum

I dealt with a lot of Windows malware sample for my PhD work, hence I need a simple way to copy these files. Here goes

for i in `ls|grep -e "^[0-9a-f]\{32\}"`; do cp $i ~/Desktop/testbed/ -vi;done

This will basically fetch all filenames which has 32 characters (md5sum, which consist numbers and small letters a through f)