Sunday, February 8, 2015

Text To Speech and Translation Application For Ubuntu Linux - Gespeaker

eSpeak is a compact open source software speech synthesizer for English and other languages, for Linux and Windows. eSpeak uses a "formant synthesis" method. This allows many languages to be provided in a small size. The speech is clear, and can be used at high speeds, but is not as natural or smooth as larger synthesizers which are based on human speech recordings.

eSpeak is available as:
 * A command line program (Linux and Windows) to speak text from a file or from stdin.
 * A shared library version for use by other programs.

Gespeaker is a GTK+ front-end for espeak. It allows to play a text in many languages with settings for voice, pitch, volume, speed and word gap. The text played can also be recorded to WAV file.

Gespeaker supports multiple languages, currently English, Italian, French and Spanish. It works well with both Gnome, XFCE, LXDE environments.

Gespeaker Installation:
Open the terminal and type following command to install Gespeaker:

sudo apt-get install gespeaker
Currently Ubuntu packagers does not include mbrola in the official repositories, Ubuntu users will need to install mbrola and the voices from the Ubuntu Trucchi repository in this way from the terminal type following command:
sudo wget -O /etc/apt/sources.list.d/ubuntutrucchi.list http://www.ubuntutrucchi.it/repository/ubuntutrucchi.list
wget -O - http://www.ubuntutrucchi.it/repository/ubuntutrucchi.asc | sudo apt-key add -
sudo apt-get update 
After successful installation you can open the Gespeaker from the Unity 'Dash'


Using Gespeaker is easy, just enter text in the available text box, select a voice type (male or female), and a language from the drop down list. Click on Play button to hear the playback of the entered text in a selected language. You can also record the sound using the Record option.

Gespeaker also allows to play a text in many languages with settings  for voice, pitch, volume, speed and word gap.

Web File Explorer and Manager - eXtplorer

eXtplorer is a web-based File Manager. You can use it to

 * Copy & Move Files and Directories by Drag&Drop
 * Dynamic Directory Tree with on-demand loading of sub directories
 * Edit Files (with Syntax-Highlighting thanks to EditArea)
 * Rename, Delete or Create new Files and Directories
 * Access Files through FTP or directly (using PHP) to totally overcome permission and file ownership issues
 * Upload or Download files just as you like
 * Create and Extract Archives (ZIP, Tar, Tar/GZ, Tar/BZ)
 * User Management with different permission levels like "View only" or "Edit" and "Admin"
 * installs easily as a component for Joomla!.

All these features are packed into an intuitive Layout which makes working with files very easy. Thanks to the great ExtJS Javascript Library you can drag & drop folders and files, filter directories and sort the file list using various criteria.

You can even use eXtplorer to login to the FTP server (like net2ftp) and work as if you were using an FTP client.

eXtplorer is released under a dual-license: You can choose wether you want to use eXtplorer under the Mozilla Public License (MPL 1.1) or under the GNU General Public License (GNU/GPL). Note that if you decide to distribute/use eXtplorer under the MPL, you are not allowed to use the ExtJS Javascript library.

eXtplorer needs at least PHP 4.3 on the server and an up-to-date browser with Javascript enabled to run. 

Installing eXtplorer:
Open the terminal and type following command to install eXtplorer:

sudo apt-get install extplorer
NOTE: You also need to have Apache installed and configured.

Configure eXtplorer
Once the extplorer package is installed, you need to add an Alias directive to your web server configuration. Under Apache, it's done this way by adding following entry in file - /etc/apache2/mods-enabled/alias.conf
Alias /extplorer /usr/share/extplorer 
Once you have the extplorer package installed in your server, you need to initialise the password authentication system, this can be done using following command:
cat /usr/share/doc/extplorer/example.dot.htusers.php >/etc/extplorer/.htusers.php
Then login into eXtplorer's interface. For most it will be through an URL like this one:
http://<YOURSERVER>/extplorer

Then login as admin / admin. You will then be prompted to change this default password.

Using eXtplorer
On the left of the main screen you can see the directory tree. If you click on a directory in that tree, eXtplorer checks for subdirectories and loads them if existent.

In the Internet Explorer and Firefox you can right-click on a directory and access a context menu with actions you can perform on it. A double-click on a directory allows you to rename it.

The grid in the center of the main screen lists the first 50 files of the currently selected directory. You can display directories in the list by clicking Show Directories in the toolbar. If the directory contains more than 50 files and dirs, you can use the page navigation in the footer of the grid to go to the next page or jump to a page of your choice.

The grid allows you to perform right-clicks on certain files. A right-click opens the context menu - as well as a double-click. Actions which couldn't be executed are grayed out.
You can select multiple files at once using the Ctrl-Key while selecting items in the grid with the mouse or the up- and down- arrow keys.

Web Based Linux Command Line SSH Terminal - Ajaxterm

Ajaxterm is a web based terminal written in python and some AJAX JavaScript for client side.  It can use almost any web browser and even works through firewalls.. It was totally inspired and works almost exactly like http://anyterm.org/ except it's much easier to install.


Ajaxterm Installation:
Ubuntu users can use following command to install Ajaxterm:

sudo apt-get install ajaxterm
Other distribution:
Open the terminal and type following command to install  Ajaxterm:
wget http://antony.lesuisse.org/ajaxterm/files/Ajaxterm-0.10.tar.gz
tar zxvf Ajaxterm-0.10.tar.gz
cd Ajaxterm-0.10
./ajaxterm.py
After successful installation, open your browser and go to http://localhost:8022/ and you should see a SSH terminal screen ...


By default Ajaxterm only listen at 127.0.0.1:8022. For remote access, it is strongly recommended to use '''https SSL/TLS''', and that is simple to configure if you use the Apache web server with mod_proxy module enable.

Here is an configuration example:
Listen 443
NameVirtualHost *:443
    <VirtualHost *:443>
       ServerName localhost
       SSLEngine On
       SSLCertificateKeyFile ssl/apache.pem
       SSLCertificateFile ssl/apache.pem

       ProxyRequests Off
       <Proxy *>
               Order deny,allow
               Allow from all
       </Proxy>
       ProxyPass /ajaxterm/ http://localhost:8022/
       ProxyPassReverse /ajaxterm/ http://localhost:8022/
    </VirtualHost>

Perl Script: Reading the list of files from Directory

There are couple of ways to get the list of files from withing directory.

#1 - Using the built-in Perl glob function
#2 - Using opendir, readdir and closedir

Below Perl script demonstrate the usage of above methods to get the list of files, feel free to copy and use this code.


Source: read_dir.pl
#!/usr/bin/perl

# Method #1 - using the built-in Perl glob function
@filelist = <*>;
foreach $filename (@filelist) {
  print $filename;


# Method #2 - Using opendir, readdir and closedir

$dir = "/home/poison";
opendir(DIR, $dir) || die "Problem reading the dir. \n";

# Read the entire file names into a array
#@filelist = readdir(DIR);

while ($filename = readdir(DIR)) {
  print $filename , "\n";
}
closedir(DIR);

Read more: http://linuxpoison.blogspot.kr/2013/01/perl-script-reading-list-of-files-from.html#ixzz3R9E1JrWt

Perl Script: How to use system defined Error message

There are many Perl defined system variables that you can use in your script, one of them is "$!", When used in a numeric context, holds the current value of errno. If used in a string context, will hold the error string associated with errno.

Below is simple Perl script which prints all available system error message and their corresponding error codes.



Source: error_message.pl

#!/usr/bin/perl
for ($! = 1, $i = 1; $! <= 25; $!++, $i++) {
    $errormsg = $!;
    chomp($errormsg);
    print "$i : $! \n";
}
Output: perl error_message.pl
0001: Operation not permitted
0002: No such file or directory
0003: No such process
0004: Interrupted system call
0005: Input/output error
0006: No such device or address
0007: Argument list too long
0008: Exec format error
0009: Bad file descriptor
0010: No child processes
0011: Resource temporarily unavailable
0012: Cannot allocate memory
0013: Permission denied
0014: Bad address
0015: Block device required
0016: Device or resource busy
0017: File exists
0018: Invalid cross-device link
0019: No such device
0020: Not a directory
0021: Is a directory
0022: Invalid argument
0023: Too many open files in system
0024: Too many open files
0025: Inappropriate ioctl for device

There are many more system error messages, if you want to list all of them, just increase the above loop from 25 to 1000.

Read more: http://linuxpoison.blogspot.kr/2013/01/perl-script-how-to-use-system-defined.html#ixzz3R9DgCzGp

Howto check disk drive for errors and badblocks

badblocks is a Linux utility to check for bad sectors on a disk drive (A bad sector is a sector on a computer's disk drive or flash memory that cannot be used due to permanent damage or an OS inability to successfully access it.). It creates a list of these sectors that can be used with other programs, like mkfs, so that they are not used in the future and thus do not cause corruption of data. It is part of the e2fsprogs project.

It can be a good idea to periodically check for bad blocks. This is done with the badblocks command. It outputs a list of the numbers of all bad blocks it can find. This list can be fed to fsck to be recorded in the filesystem data structures so that the operating system won’t try to use the bad blocks for storing data. The following example will show how this could be done.

From the terminal, type following command:

$ sudo badblocks -v /dev/hda1 > bad-blocks
The above command will generate the file bad-blocks in the current directory from where you are running this command.

Now, you can pass this file to the fsck command to record these bad blocks
$ sudo fsck -t ext3 -l bad-blocks /dev/hda1
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Check reference counts.
Pass 5: Checking group summary information.

/dev/hda1: ***** FILE SYSTEM WAS MODIFIED *****

/dev/hda1: 11/360 files, 63/1440 blocks
If badblocks reports a block that was already used, e2fsck will try to move the block to another place. If the block was really bad, not just marginal, the contents of the file may be corrupted.

Looks at badblocks man pages for more command line options.

Opensource load balancing Software

Linux Virtual Server
The Linux Virtual Server Project is a project to cluster many real servers together into a highly available, high-performance virtual server. The LVS load balancer handles connections from clients and passes them on the the real servers (so-called Layer 4 switching) and can virtualize almost any TCP or UDP service, like HTTP, HTTPS, NNTP, FTP, DNS, ssh, POP3, IMAP4, SMTP, etc. It is fully transparent to the client accessing the virtual service.
Homepage: http://www.LinuxVirtualServer.org/

BalanceNG
BalanceNG is a modern software IP load balancing solution. It is small, fast, and easy to use and setup. It offers session persistence, different distribution methods (Round Robin, Random, Weighted Random, Least Session, Least Bandwidth, Hash, Agent, and Randomized Agent) and a customizable UDP health check agent in source code. It supports VRRP to set up high availability configurations on multiple nodes. It supports SNMP, integrating the BALANCENG-MIB with Net-SNMPD. It implements a very fast in-memory IP-to-location database, allowing powerful location-based server load-balancing.
Homepage:http://www.inlab.de/balanceng/

HAproxy 
HAproxy is a high-performance and highly-robust TCP and HTTP load balancer which provides cookie-based persistence, content-based switching, advanced traffic regulation with surge protection, automatic failover, run-time regex-based header control, Web-based reporting, advanced logging to help trouble-shooting buggy applications and/or networks, and a few other features. Its own event-driven state machine achieves 20,000 hits per second and surpasses GigaEthernet on modern hardware, even with tens of thousands of simultaneous connections.
Homepage:http://haproxy.1wt.eu/

Pen 
Pen is a load balancer for "simple" TCP-based protocols such as HTTP or SMTP. It allows several servers to appear as one to the outside. It automatically detects servers that are down and distributes clients among the available servers. This gives high availability and scalable performance.
Homepage:http://siag.nu/pen/

Crossroads Load Balancer
Crossroads is a daemon running in user space, and features extensive configurability, polling of back ends using wake up calls, status reporting, many algorithms to select the 'right' back end for a request (and user-defined algorithms for very special cases), and much more. Crossroads is service-independent: it is usable for any TCP service, such as HTTP(S), SSH, SMTP, and database connections. In the case of HTTP balancing, Crossroads can provide session stickiness for back end processes that need sessions, but aren't session-aware of other back ends. Crossroads can be run as a stand-alone daemon or via inetd.
Homepage:http://crossroads.e-tunity.com/

balance 
Balance is a simple but powerful generic TCP proxy with round-robin load balancing and failover mechanisms. Its behavior can be controlled at runtime using a simple command line syntax. Balance supports IPv6 on the listening side, which makes it a very useful tool for IPv6 migration of IPv4 only services and servers.
Homepage:http://www.inlab.de/balance.html

Distributor load balancer
Distributor is a software TCP load balancer. Like other load balancers, it accepts connections and distributes them to an array of back end servers. It is compatible with any standard TCP protocol (HTTP, LDAP, IMAP, etc.) and is also IPv6 compatible. It has many unique and advanced features and a high-performance architecture.
Homepage:http://distributor.sourceforge.net/

Pure Load Balancer
Pure Load Balancer is a high-performance software load balancer for the HTTP and SMTP protocols. It uses an asynchronous non-forking/non-blocking model, and provides fail-over abilities. When a backend server goes down, it automatically removes it from the server pool, and tries to bring it back to life later. Pure Load Balancer has full IPv6 support and works on OpenBSD, NetBSD, FreeBSD and Linux.
Homepage:http://plb.sunsite.dk/

Load Balancer Project
The Load Balancer Project is a tool that allows you to balance requests using clusters of servers. The goal is to achieve high availability load balancing with a simple configuration for the load balancer and the network topology. It leaves the servers untouched so the configuration only resides on the load balancer, and it allows you to manage any type of service via a plugin model design and a transparent proxy feature.
Homepage:http://www.jmcresearch.com/projects/loadbalancer/

mod_athena 
mod_athena is an Apache-based application load balancer for large systems. It allows the HTTP server to act as a load balancer either internally to Apache's own mod_proxy (for reverse proxying), or externally to machines querying it. Arbitrary statistics are sent to the engine via a simple GET plus query-string interface, from which it will then make decisions based on chosen algorithms.
Homepage:http://ath.sourceforge.net/

udpbalancer 
Udpbalancer is a reverse proxy that sorts UDP requests from your clients to your servers. It may operate in round-robin, volume balance, and load balance modes.
Homepage:http://dev.acts.hu/udpbalancer/

MultiLoad 
MultiLoad is a load balancer that redirects HTTP requests to pre-defined servers/locations. It gives the provider a way to balance the traffic and hides the real download location. It allows you to manage different version of each download. It is also a load balancing server extension. You can distribute files on some servers so that a downloaded file can be loaded form different servers. These servers can have different priorities to control the active traffic.

How to protect your server from DDos Attack

What is DDos attack:
On the Internet, a distributed denial-of-service (DDoS) attack is one in which a multitude of compromised systems attack a single target, thereby causing denial of service for users of the targeted system. The flood of incoming messages to the target system essentially forces it to shut down, thereby denying service to the system to legitimate users.

There is a perl script which prevent this:
First do the Installation of a simple perl script:

wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh

Uninstalling:
wget http://www.inetbase.com/scripts/ddos/uninstall.ddos
chmod 0700 uninstall.ddos
./uninstall.ddos

When you run this Perl script, it will then run an netstat command check how many times each IP is connected and if there are more then the number of connections you specified then it will automatically run a command in APF for the IP to be banned.