Thursday, December 29, 2011

VBS Tricks...

Now you can create your own text to speech converter software to make your computer speak whatever you type. I found this script on some Vietnamese site. It's pretty cool. Just run this script and make it read any funny sentence.Copy the code given below in notepad and save it as anyname.vbs. Make sure that you save it as .vbs file.

Dim message, sapi
message=InputBox(“What do you want me to say?”,”Speak to Me”)
Set sapi=CreateObject(“sapi.spvoice”)
sapi.Speak message

After making a vbs file just double click on that file and type anything you want in the textbox.
VBS Trick

Vishal Vyas

Wednesday, December 28, 2011

How to install squid on redhat linux

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator. It runs on most available operating systems, including Windows and is licensed under the GNU GPL.


On a Red Hat Enterprise Linux or Fedora Core operating system, it is easy to check if Squid is installed using the rpm system. Type the command:

rpm -q squid

If Squid is already installed, you will get a response similar to:


If Squid isn’t installed, then you can use Yum to install it. Thanks to Yum the installation is quite easy.

Just type at a command line:

yum install squid

If you happen to have downloaded the rpm you can also type something like:

rpm -ivh squid-2.5.STABLE6-3.4E.12.i386.rpm

Squid’s main configuration file lives in /etc/squid/squid.conf. The 3,339 line configuration file is intimidating, but the good news is that it is very simple to setup a proxy server that forward http, https, and ftp requests to Squid on the default port of 3128 and caches the data.
Back up the configuration file:-

It is always good policy to backup a configuration file before you edit it. If you haven’t been burned yet, you haven’t edited enough configuration files. Make a backup from the command line or the gui and rename the original file something meaningful. I personally like to append a bck.datestamp. For example:

cp /etc/squid/squid.conf /etc/squid/squid.conf.bck.02052007

If it is the original configuration file you might choose to do:

cp /etc/squid/squid.conf /etc/squid/

Edit the file:-
Open /etc/squid/squid.conf with your favorite text editor. I use vim, but nano is a good beginner’s command line text editor. If you do use nano, make sure you use the nano –nowrap option to turn off line wrapping when editing things like configuration files. A gui editor like Gedit will also work.


The default squid configuration is almost complete, but a few small changes should be made. You will need to either find and uncomment entries, or modify existing uncommented lines in the squid configuration file. Use your favorite text editor or a text find to quickly locate these lines:

visible_hostname machine-name
http_port 3128
cache_dir ufs /var/spool/squid 1000 16 256
cache_access_log /var/log/squid/access.log

In the acl section near the bottom add:

acl mynetwork
http_access allow mynetwork

Let me explain what each of these six lines means:

visible_hostname – Create this entry and set this to the hostname of the machine. To find the hostname, use the command hostname. Not entering a value may cause squid to fail as it may not be able to automatically determine the fully qualified hostname of your machine.

http_port 3128 – Uncomment this line but there is no need to edit it unless you want to change the default port for http connections.

cache_dir ufs /var/spool/squid 1000 15 256 – Uncomment this line. You may want to append a zero to the value 100 which will make the cache size 1000MB instead of 100MB. The last two values stand for the default folder depth the cache will create on the top and subdirectories respectively. They do not need modification.

cache_access_log – Uncomment this line. This is where all requests to the proxy server will get logged.

acl intranet – This entry needs to be added. It should correspond to whatever your local network range is. For example, if your Fedora server is then the entry should be acl intranet

http_access allow intranet – This allows the acl named intranet to use the proxy server. Make sure to put allow directives above the last ‘http_access deny all’ entry, as it will overide any allow directives below it.

Turning on squid

Enable the proper run levels:

chkconfig squid on

Start the service:

service squid start

Verify that squid isrunning:

service squid status

Note, if you have problems starting squid, open a separate shell and run:

tail -f /var/log/messages

Then start the squid service in your original window:

service squid start

The tail command should show an error for squid that can help you solve the problem. One common error is that the swap (cache) directory doesn’t exist. To solve this problem, run squid with the -z option to automatically create the directories:

/usr/sbin/squid -z

Make sure that squid has write permission to the swap directory or this command won’t work.
Configuring the clients

If you are using Firefox or Mozilla you will need to add the proxy server as follows:

Go to Preferences>Network>Settings

Add the name of your new proxy server and port 3128 to the http proxy field (under manual configuration).

Open a shell to your proxy server so you can observe the log file being written to. Use tail, as before:

tail -f /var/log/squid/access.log

Now surf the web through your proxy server. You should see entries flying by in real time as you surf different http addresses. Congratulations, you now have a caching proxy server setup!

Sunday, December 25, 2011

How to check and open ports in Linux

The most common host-based tool for checking for open ports on Windows or Unix systems is the netstat command.

To see open TCP Network Ports :- 
vishal@vyas:~# netstat -vatn

To see DNS Hostnames :- 
vishal@vyas:~# netstat -vat

To see open UDP Network Ports:- 
vishal@vyas:~# netstat -vaun


Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. Nmap can provide further information on targets, including reverse DNS names, operating system guesses, device types, and MAC addresses.

vishal@vyas:~# nmap -sS

Starting Nmap 4.53 ( ) at 2011-12-26 12:35 IST
Interesting ports on (
Not shown: 1703 closed ports
22/tcp    open  ssh
80/tcp    open  http
110/tcp   open  pop3
111/tcp   open  rpcbind
139/tcp   open  netbios-ssn
143/tcp   open  imap
445/tcp   open  microsoft-ds
993/tcp   open  imaps
995/tcp   open  pop3s
3306/tcp  open  mysql
10000/tcp open  snet-sensor-mgmt

Nmap done: 1 IP address (1 host up) scanned in 0.404 seconds.

general structure of a nmap command is
#nmap <options> <ip address>
Some of important nmap command line options are
-A : which is used for telling Nmap to use advance options of Nmap(like OS finger printing).
-O : For OS finger printing ie finding out Operating system running in the remote host. 


Friday, December 23, 2011

How to install php in linux from Source

This article explains how to install PHP5 from source on Linux, Apache web server should already be installed.

Download PHP:-

Download the latest source code from link. Move the source to /usr/local/src and extract is as shown below.

# cd /usr/local/src

# wget

# tar xvf php-5.3.8.tar

Install Php:-

View all configuration options available for PHP using ./configure
–-help (two hyphen in front of help). The most commonly used option is
–-prefix={install-dir-name} to install PHP on a user defined directory.

# cd php-5.3.8
# ./configure --help

In the following example, PHP will be compiled and installed under the default location /usr/local/lib with Apache configuration and MySQL support.

# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql

# make

# make install

# cp php.ini-dist /usr/local/lib/php.ini

Configure httpd.conf for PHP:-

Modify the /usr/local/apache2/conf/httpd.conf to add the following:

<FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php

Make sure the httpd.conf has the following line that will get automatically inserted during the PHP installation process.

LoadModule php5_module modules/

Restart the apache as shown below:

# /usr/local/bin/apache2/apachectl restart

Verify PHP Installation:-

Create a test.php under /usr/local/apache2/htdocs with the following content

# vi vishalvyas.php
<?php phpinfo(); ?>

Go to http://localhost/vishalvyas.php , which will show a detailed information about all the PHP configuration options and PHP modules installed on the system.

Vishal Vyas

Monday, December 19, 2011

How to Install MySQL on Linux

I will explain how to install MySQL on Linux [Redhat, Fedora] platform.

Type the following command as root user:
# yum install mysql-server mysql

Start MySQL Service:-
To start mysql server type the following command:-
# chkconfig mysqld on
# /etc/init.d/mysqld start

 Setup mysql root password:-
# mysqladmin -u root password yourpass

Connecting to MySQL:-
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7369

Vishal Vyas

Friday, December 16, 2011

Organize Your Shows with Sickbeard

Sickbeard is a server-based application that runs on your file server, and it can manage and sort all of your television shows. If you have a collection of TV episodes you've recorded with MythTV, ripped from DVD, pulled from TiVo or however you might have procured them, organizing them in a way that programs like Boxee or XBMC understand can be daunting. Sickbeard is a program that can sort, organize and rename episodes automatically. It lets you know if you are missing episodes, and it can download metadata and cover art. It even can notify you with a pop-up on your XBMC home-theater device when a new episode is added to your library.

Again, Sickbeard was designed with nefarious intentions in mind, but even if you don't want to pirate television shows from Usenet, it's a great way to keep your XBMC database organized. Check it out at

  1. Install python (2.5, 2.6, or 2.7)

    To check if it is installed just type "python -V" in a terminal window
    In the unlikely event it's not already installed you can simply install it with your OSes package manager.
  2. Install cheetah

    Use your package manager: sudo apt-get install python-cheetah
    Or install from source:
  3. Retrieve the Sick Beard source

    If you have git installed (use "git --version" to check):
    • git clone git:// my-sickbeard-install
    If not:
  4. Start Sick Beard

    • cd my-sickbeard-install
    • python
Vishal Vyas

Control your laptop with your clap

Here i will make my Laptop perform certain action while you clap. You can shutdown or restart your system or even launch a program by just clapping. Well enough talks it’s show time. So get this cool app from this download link. Now just install it. Once you install it then start the app to take the thrill to its peak.

You can clap your hands, yell, howl or make whatever sound you like to trigger the action; or you can exploit the mobile technology and use the mobile phone to do all of these things, either by appealing to Bluetooth or connecting it to a wireless network.

Vishal Vyas

Thursday, December 15, 2011

How to configure syslog server in Linux

Setting Up A Central Syslog Server:-

how to set up a syslog server for one or more Unix systems, on Fedora Core and Ubuntu/Debian.

Linux systems already have syslog installed.

Configure the Server Computers:-

#service syslog stop

and if it fails again, go for the old-school kill command

#ps axfu | grep syslog
copy the PID (number from second column) from the syslog line and

#kill -9 PID
Open /etc/sysconfig/syslog with your favorite text editor
and  Find the line

Replace it with


Restart the syslog daemon

#service syslog restart

you should see a message similar to “syslog restarted (remote reception) when executing the command

#tail /var/log/messages
you should either find the RC syslog file, edit it and add the “-r” flag to the syslog options or, if you’ve used

the old-school kill command, simply start syslog manually

#syslogd -r

In the final step, you’ll have to make sure the firewall isn’t blocking any incoming packets. Simply run this

iptables command so any rule will be overridden

#iptables -I INPUT -p udp -i eth0 -s -d --dport 514 -j ACCEPT
This rule will ensure that the syslog server ( will receive UDP packets (containing log events) from the CLIENT (

You MUST replace these IP addresses with the correct ones. Also, you will have to re-execute this command for every other client PC you may have (, etc).

Configure the CLIENT computers:-

The client computers are configured to send any logged event to the syslog server, immediately as the events occur. To do this, edit the file /etc/syslog.conf on every client computer and add this line in  the file

*.* @

Again, replace the example IP address with the syslog server’s correct IP address.

restart the syslog on every client you’ve edited.

#service syslog restart

make sure the client machine is allowed by the firewall to send UDP packets. Again, you can easily override any rule by running the iptables command.

#iptables -I OUTPUT -p udp -i eth0 -s -d --dport 514 -j ACCEPT

This is it. If everything was done correctly, you should start receiving log events to the syslog server. To view them, run.

#tail -f /var/log/messages

Vishal Vyas

How to install svn on linux

Howto install SVN (Subversion) server on Fedora , Red Hat (RHEL).

 Install Packages:-

# yum install mod_dav_svn subversion

Modify Subversion config file /etc/httpd/conf.d/subversion.conf

Add following config to /etc/httpd/conf.d/subversion.conf file:-

LoadModule dav_svn_module     modules/
LoadModule authz_svn_module   modules/

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   AuthType Basic
   AuthName "Subversion repositories"
   AuthUserFile /etc/svn-auth-users
   Require valid-user

How to Add SVN  users:-

Use  command:

## Create user vishal ##
htpasswd -cm /etc/svn-auth-users vishal
New password:
Re-type new password:
Adding password for user vishal

## Create testuser2 ##
htpasswd -m /etc/svn-auth-users vyas
New password:
Re-type new password:
Adding password for user vyas

How to Create and configure SVN repository:-

mkdir /var/www/svn
cd /var/www/svn

svnadmin create reponame
chown -R apache.apache reponame

chcon -R -t httpd_sys_content_t /var/www/svn/reponame

## Following enables commits over http ##
chcon -R -t httpd_sys_rw_content_t /var/www/svn/reponame
Goto http://localhost/svn/reponame address and you should see something like following, write username and password:  SVN testrepo revision 0:

Create trunk, branches and tags structure under testrepo:-

Create “template” directories with following command:

mkdir -p /opt/vishal{trunk,branches,tags}

Then import template to project repository using “svn import” command:

svn import -m 'Initial import' /opt/vishal/ http://localhost/svn/reponame
Adding         /tmp/svn-structure-template/trunk
Adding         /tmp/svn-structure-template/branches
Adding         /tmp/svn-structure-template/tags

Committed revision 1.

Check results on browser and see testrepo revision 1:-


Install Darkstat - a network traffic analyzer

Darkstat is a opensource network monitoring tool, It is a packet sniffer which runs as a background process and serves its statistics to a ...