Exploit-DB updates

Saturday, June 4, 2011

Notify-Send - On Screen text display

To start off, download the following package with your repositories;

apt-get install libnotify-bin

After that you can test it like so;

notify-send "Resist Monsanto"

That will create a popup on your screen displaying the text you entered.

Now if you were to try to enter a command within the quotes, or even without, it will simply be displayed as text. The way of telling notify-send to display the results of a command is by encapsulating the command withing " ` ". For example;

notify-send "` w `"

Though that's a big jumbled up on this netbook, so I'm going to pipe it to awk to shorten it a bit and just display what I want to see.

notify-send "` w | awk '{print $1 " -> " $8}'`"

So now that will show me whos logged onto this system and what they're currently doing. I could have this process automated with a while loop in order to have some desired notification displayed to me every however amount of minutes I've chosen. For example;

while [ 1 ]; do notify-send "` w | awk '{print $1 " -> " $8}'`"; sleep 10; done

That would create a pop-up every 10 seconds showing me who's logged on and what they're currently doing. If we wanted something a big longer than a few seconds than you can add a "m" in the sleep command we issued to make it 10 minutes instead.

while [ 1 ]; do notify-send "` w | awk '{print $1 " -> " $8}'`"; sleep 10m; done

You can also alter the amount of time the popup is displayed by specifying a time in milliseconds that you'd like it to be displayed before expiring.

notify-send -t 5 "` w | awk '{print $1 " -> " $8}'`" 

Another feature of notify-send is the ability to display icons, and a title. This is demonstrated below;

notify-send "Monsanto" "Genetically Modifying People Near YOU" -i /usr/share/pixmaps/terminator.xpm -t 5000

You may not have that icon if you don't have the terminal emulator "terminator" in which case I highly suggest giving a try. It's by far my favorite terminal. 

Now that just about covers this brief "how-to" on notify-send, and as you can see there's quite a few things this tool can be used for. I'm sure you'll think of plenty of your own ideas. Feel free to share the things you use notify-send for, and maybe share your own scripts and ideas.

No comments:

Post a Comment