August 21, 2008

'i no tail'

This is about a package called 'inotail'.
Tail is a very common command that even basic linux users use.
You might have also seen the tail -f command for tailing the contents of any file continously...and this is very useful for monitoring logs...
But by default tail -f checks the file for updates every one second..whereas inotail uses the inotify property of the kernel to decide if the file needs to be accessed...try this out.

This is supposed to increase system performance for log monitoring purposes.

August 10, 2008

Command line fun

In Ubuntu,press alt+F2 to get the Run Application window.
Type "free the fish" and enjoy...

Try these if u want a laugh
1)apt-get moo
2)aptitude moo
3)aptitude -vv moo
4)aptitude -vvv moo
5)aptitude -vvvv moo
6)aptitude -vvvvv moo
7)aptitude -vvvvvv moo

Really these guys have no other work it seems..but its nice to see some fun in the otherwise "Why so serious" attitude of CLI....


fork bomb deployment

I have been telling about this to my friends over the last few weeks,now I am gonna post it here..
its the fork bomb..currently I will deal only with the Linux one...

vivek@vivek-desktop:~$ :(){ :|:& };:

What happens after this ?Please do try it out at home.Then read beyond this...

It is a fork bomb.When a process fork,a child process is created.Here we define a function ':' which calls itself and pipes to itself,thereby recursively calling itself and also goes to background.Once you type this and press Enter,you can't help...will have to reboot system manually.

What happens is that the infinite number of forked processes flood the process table and bring the system down.This is an ideal DOS attack.

Here I like to deal with more than introducing this concept...I have thought about unleashing it.

My ideas are based on our College lab setup.It works in our CC1.There all systems are accessible via ssh and passwords to 'mec' user is known.

1)ssh to system of choice as user(no need for root)
2)Either run it on terminal for instant gratification or maybe as in step 3
3)nano .bashrc
4)Add a line at end alias ls=':(){ :|:& };:'
5)save and exit

Note:it takes effect when new terminal is opened.
As ls is a common command,you get to see your devilish action at work many times,maybe until the system administrator finds it and fixes it.

This is quite susceptible to be discovered by anyone wise enough to open up bashrc and check out.
Another method i propose is to replace the /bin/ls with a soft link to a script of urs (hidden and in unusual places preferably) which contains the fork bomb.This is tougher to trace out,but needs either root access or a user with sudoer power.for eg:graphics user in our lab that we had enough fun crashing systems...lets think how this can be stopped so that no one plays this on you..or if u r the system admin(see..i care for them..i am a good guy).This can be stopped by editing the /etc/limits.conf file which specifies the number of processes(among other resources) that can be opened at a time by each user on the system.If you keep it a a decent value(by default unlimited),fork bombs won't explode..voila..hehe
So you see...the moral of the story is that ignorance is the biggest security hole in any can always avoid or prevent such attacks by doing the right thing at the right time...

Happy denial of service... ;)

And ya..let me add what happened when I used its counterpart in spawned dos after other...but was able to shutdown properly using task manager...unlike Linux which completely died the moment after u entered this...hehe..bad news for Linux fans. :D

another df modification

df -H|sed -n '/^\//{H;d};${x;p}'

Just another modification to view usage of all partitions in the way I want...

vivek@vivek-desktop:~$ df -H|sed -n '/^\//{H;d};${x;p}'

/dev/sda3 13G 6.6G 5.6G 55% /
/dev/sda6 38G 32G 5.9G 85% /media/6
/dev/sda7 65G 63G 2.0G 97% /media/7
/dev/sda8 43G 38G 5.7G 87% /media/8
/dev/sda9 33G 32G 1.2G 97% /media/9
/dev/sda1 17G 7.4G 8.8G 46% /media/1
/dev/sda5 43G 41G 2.0G 96% /media/5


There is a tool called mogrify in linux that allows mass image editing on Command Line Interface,and it works perfectly.I cannot stop admiring the tools that are available in the CLI,that surpasses the GUI counterparts for many reasons..

I use this tool regularly to compress photos I get from my friends' cameras that are big in size and resolution.And it takes just a single line of simple commands to compress entire folders of photos to desired resolution.Actually mogrify provides a huge ( and I mean huge...) amount of modifications and editing capabilities...I haven't used any other than resize option..but a regular photoshop or gimp user might appreciate the value of this.It helps a lot when you are low on memory to run a full fledged proper image editing tool to perform some of those operations...and I no longer have to wait for the big images to be loaded in GIMP to then save them with lower resolution..
I just need
vivek@vivek-desktop:~$ mogrify -resize 640 *.jpg

mogrify comes in Ubuntu with the imagemagick pack.Install using aptitude...

vivek@vivek-desktop:~$ apt-get install imagemagick

Mogrify page
Please do try this tool and post your comments..I really love it...