Thursday, September 11, 2008

Arabic subtitle, how to make it work under Ubuntu.

I had been using dual boot of Microsoft windows and linux for a long time as I couldn't completely migrate to Linux because of immature Arabic support. booting to windows to watch subtitled movies was not uncommon thing I was doing.
Now with complete linux arabic subtitle support , I rarely boot to windows only to play MS flight simulator.
Most of arabic subtitles files are written in windows-1256 character set encoding and very scarse of them are written UTF-8 encoding.


Ubuntu comes with Totem media player that already support arabic subtitles out of the box
just select Edit > Preferences > General > Encoding > Arabic (WINDOWS-1256)
and make sure to select a font that support arabic, mine is set to "Nimbus sans L". Also make sure that the .sub or .srt file has the same file name as the media files without extensionp; ie. for foo.avi .


Mplayer and VLC require fribidi liberary to support arabic, but the stable version is not mature enough to support arabic joining, that why you will get unjoined arabic charcters on subtitles, so you have to install version 2 of fribidi from CVS repository and compile it yourself or if you are using ubuntu or debian , you can download and install a .deb package from here or zshare mirror here.
Then edit $HOME/.mplayer/gui.conf with your favourite text editor and append the following line at the end of the file

sub_cp = "cp1256"

Now subtitles should properly work, just make sure the video file foo.avi has foo.sub, or subtitle file in the same directory.


For VLC you have to install fribidi version 2 as mentioned before and edit $HOME/.vlc/vlcrc with your favourite text editor, and find the following line and comment it


and change the line that begins with "subsdec-encoding" to


save your file and fireup your vlc opening a subtitled media now you should have a working subtitle with arabic joining.
I have VLC 0.8.6e Janus (wxWidgets interface) installed from ubuntu hardy repository and it looks that it suffer from a bug preventing it from loading subtitles having charcters other than letters and numbers in its location and its filename, for example a file location includes something like this "Chaos.Theory[2007]DvDrip[cut].AC3-aXXo" will not work, just rename the video and subtitles filenames and directory names if needed.


A good thing about fridbidi version 2 is that it will fix arabic shaping/joining problems for other applications that use it like amsn.

Install the arabic fonts package ttf-arabeyes from repository by

sudo apt-get install ttf-arabeyes

Friday, August 1, 2008

arptables, and ARP poisoning(Netcut, Switchspoofer, ..)

Netcut , WinARPspoofer, Switchsniffer,WinARPattacker , and other ARP poisoners are becoming popular now with the growing number of the free wifi hotspots and shared broadband connections, and are being used either for taking advatage of the whole network internet speed , or sniffing sensitive informations, emails, chat conversations, .. etc
i tried many ways to stop attacks on my linux like what mentioned here but i failed to stop the attacks
after several trials and forensics, I found that arptables is the solution
i installed arptables package

$sudo apt-get install arptables

the i have added these lines to my firewall script
provided that "" is the gateway IP and "00:1D:0F:A9:F0:45" is the mac address of the gateway

#arptables -P INPUT DROP
#arptables -P OUTPUT DROP
#arptables -A INPUT -s --source-mac 00:1D:0F:A9:F0:45 -j ACCEPT
#arptables -A OUTPUT -d --destination-mac 00:1D:0F:A9:F0:45 -j ACCEPT

#arp -s 00:1D:0F:A9:F0:45

First line to set the policy of INPUT chain to DROP.
Second line to set the policy of OUTPUT chain to DROP.
Third line to only ACCEPT connections from trusted gateway.
Forth line to send replies only to the trusted hosts.
Fifth line to add static entry into the ARP table to link your trusted host to its own MAC.
What i liked in this this solution that your box will only be visible to the trusted hosts in your network, even when the attacker try to scan the network by anykind of software. A good combination between arptables and iptables makes you safe in untrusted switched networks.

Saturday, July 26, 2008

Voice chat under linux

I have been searching for a voice chat solution under Linux to contact my family while I'm abroad , cause i am doing almost all my work under Linux and i hate to boot xp for only chatting, here is my experience

- ofcourse voice chat will not work under linux

Yahoo messenger:
- i couldn't make it work with wine

Google talk
- it is my favorite voice chat client as it have good audio quality but unfortunately didn't work at all with wine or even crossover
- I couldn't setup Landell, and i didn't hear any success stories about installing it
- i could install Empathy successfully and it worked with me , voice chat worked too , tested the voice quality once, it was inferior to the original software, but it was usable

i had installed skype before on ubuntu dapper and ubuntu edgy but it didn't work properly , i could only make one call per session, and i had to restart the application for it to work again, there was a fix for that But i have installed skype under ubuntu 8.04 (Hardy)

It worked from the beginning, used xten-xlite as a client on both sides, worked fine with the SIP gizmo service (sipphone), good audio quality, rare disconnections, minimal delay

if you are a Linux fan try to avoid properiatory solutions tailored mainly for windows, try to use a standard protocol like SIP you will find it well supported by not only Linux community but also other platforms and hardware manufacturers.

Changing hostname in linux

to change the hostname:
Method 1:

from terminal run this command

$sudo echo "your_new_hostname" > /etc/hostname

Method 2"

System > Administration > Network > General (tab)

and change "Host name" value to whatever you want

a good tip is to add your new hostname to /etc/hosts

$sudo echo " your_new_hostname" >> /etc/hosts

p.s. tested on Ubuntu Hardy 8.04 LTS