Archives for category: ubuntu
Did you ever feel the desire to show some commands in Unix or Linux to colleagues? Just to demonstrate things? Or, did you ever felt the desire just to show off 
:-)

You can use websites like http://www.screencast-o-matic.com/ or other screencapture software. Maybe the use ffmpeg in Ubuntu/Debian helps you out (p.e: ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg) But it creates video’s which must be uploaded and may become large. A lot of work and it takes a lot of time to create.


http://www.playterm.org/ Could help you out even more. A nice website where you can upload your cool terminal adventures. Type in ttyrec in your terminal, then perform some cool skills in your terminal and to complete this, just type exit. Upload the tty file on http://www.playterm.org/?upload=now and wait to get in the wall of fame on playterm!


ttyrec can be installed in Ubuntu by using apt-get.


However, there is also a nice alternative, which also works great: shelr. 


See http://shelr.tv . Full explanation here: http://shelr.tv/about


Happy shelling! ;-)
Advertisements
It looks like there is no alternatve to wireshark or tshark. But never fear... An alternative is here!
TCPFLOW.

On Ubuntu (ofcourse), you can install it via apt-get install tshark
Some examples:

tcpflow -i eth0 -c -e
With this one you'll see all the traffic for your network card. Add the -s parameter if you see too many gibberish passing by. It will convert non-printable traffic into periods.

tcpflow -i eth0 -c -e port 80
Only interested in datastreams to port 80, use the command above.

Use:
tcpflow -i eth0 -c -e host 192.168.1.1
if you're only interested in traffic from- or ment for 192.168.1.1.

But there is more. If you do not use the -c switch, tcpflow will create for each datastream a separate file. Add the -b parameter and the files created can be limited in filesize. 

Do keep in mind that tcpflow is not in development anymore and it cannot handle fragmented ip packets.
Are you one of the happy few to own a machine with too much RAM and have Ubuntu/Debian installed? Then you might consider use some of that memory to use it to change it to RAM drive. Sometimes it might be useful to decompress files or other file-operations wich can be time consuming on slower disks.

Here's what to do:

sudo -s
create a dir called /tmp/ramdisk
mkdir /tmp/ramdisk; chmod 777 /tmp/ramdisk

mount -t tmpfs -o size=4096M tmpfs /tmp/ramdisk/


Happy RAMDisking! :-)
 
 
Sometimes when you issue a ping to a certain host and you do not get a reply, you think the host is offline, but it is actually being blocked by a firewalll. 
What you can do is issue a ping and right after that run the arp -a command:

:/# ping <ip adress host> PING 192.168.212.103: (192.168.212.103): 56 data bytes  ^C (abort with CTRL - C)  
:/# arp -a | grep <ip adress host>  <hostname> (<ip adress host>) at (incomplete)  

So, if you do not get a MAC address, the machine is really offline

Running Ubuntu on Android.

If you have an (rooted and have busybox installed!) Android device which is fast enough to run Ubuntu you can give it a try.
It works quite well on my Samsung Galaxy s Plus. It has an 1.4ghz ARMv7 processor, which is fast enough to run it, but I think it should be any slower.
(OW men, I wish I had a Galaxy Note, (quadcore 2ghz…)
The second requirement is, you have to have at least an SD card larger than 4gb for optimal use of Ubuntu.
The third requirement is some knowledge of shell scripting. If you’re not at least a little bit familiar with scripting, you’d better not try it.

Steps to follow:

1.Download the following files:

http://sourceforge.net/projects/linuxonandroid/files/Ubuntu/ubuntuV5-image.zip/download
(for the large image, 3.5gb) The smaller one can be downloaded here: http://sourceforge.net/projects/linuxonandroid/files/Ubuntu/ubuntuV5-sm-image.zip/download
I’m not sure, but I think it’s about 400mb)

Install a terminal emulator in android: https://market.android.com/details?id=jackpal.androidterm&feature=search_result#?t=W251bGwsMSwxLDEsImphY2twYWwuYW5kcm9pZHRlcm0iXQ..
and install a decent VNC viewer on your device: https://market.android.com/details?id=android.androidVNC&feature=search_result#?t=W251bGwsMSwxLDEsImFuZHJvaWQuYW5kcm9pZFZOQyJd

2.Unzip the first two files on your SD card, preferrably on the SD card in <sdcardlocation>/ubuntu You should then have an .img file and an .sh file in the directory.
3.Install the terminal emulator and the vnc viewer.
4.It might not work in the first time, but run the script by the following commands:
-CD to the directory where the files are located
-su
-sh ubuntu.sh
-analyze the errors and correct them. But never fear 🙂 The errors are mostly caused by wrong directorynames in the script. Correct them, if it is possible. And be sure that you have busybox installed: http://bit.ly/yskMBB

-Eventually, you should get some questions about screen resolutions. If so, your Ubuntu is close to getting started.
-connect via VNC from the android device (or PC, ofcourse) to the ipaddress. Port 5900 will do.
Note that Ubuntu will not keep running in the background. It stops running when you exit the terminal where you ran the ubuntu.sh script.
Everytime you run ubuntu.sh, you will be able to connect to Ubuntu via vnc. Pretty cool eh?

Ow, the last thing I need to mention is, that when you have logged into your fresh new Ubuntu machine via VNC, you might get some problems that if you press the d key on your keyboard, the Ubuntu desktop will show, if you press d again, then the windows pop up. Go to System, Preferences, Keyboard shortcuts, Look under Window Management and find “Hide all normal windows and set focus to the desktop”. Press <BACKSPACE> on this option and this nasty keyboard shortcut is gone.
Maybe you do not have the same problem, but I did.


Usually at the work office I'm very busy. But I take some time to browse on the internet on some of my favorourite sites. But many of the site I wish to visit are blocked, because they are categorised as “exploit or hacking related”... As I mentioned before, you can make use of a tunnel to your home network and you can browse freely. There is however another way. What if I get a PDF of the website I like to visit. I've built a tiny, and simple script: 

wget http://pdfmyurl.com?url=http://www.tweakers.net 
mv index.* tweakers.pdf 
mutt -s "EzineMailer" blah@blah.com < ~/scripts/tweakersmailer/body.txt -a tweakers.pdf 
rm *.pdf 



The mutt command can be used to send a mail from your commandline.
If you do not have mutt installed on your linux system: sudo apt-get install mutt
Now lets try sending a test mail: # echo testing | mail -s Bla myemail@somewhere.com 
and take a look at /var/log/exim4/mainlog. You should be good to go! If not run dpkg-reconfigure exim4-config and configure a smart host. Smart host for use of another SMTP server. Send attachment? Use mutt (apt-get install mutt) mutt -s "Testing" blahblah@test.com < body.txt -a myfile.txt (-a attachment) 

I am using a internal smart host. You can use an external smart host too. I forgot to mention, that I am using an Ubuntu server for this purpose. :-)
And finally, you can cron this script and you will get an automatically generated pdf in your mailbox. This site could help you with editting the crontab: http://cron.nmonitoring.com/cron-generator.html 
Just a quicky this time :-)

Are you Ubuntu user and ever wanted to ping to a MAC address? Well.. I did :-)

Here's how.

First of all, get the arp-scan package:
 sudo apt-get install arp-scan

Then issue the following command:

ping -c 2 `arp-scan <ipaddress>/<number of network bits> | awk '/<mac address>/ {print $1}'` 

For Example:

ping -c 2 `arp-scan 10.146.0.0/17 | awk '/00:1f:29:44:ad:a4/ {print $1}'`