2013 | openGLUG

Pages

Sunday 29 September 2013

We got a new home.!!!

We have been shifted to our new home http://curiousfolk.org
If you have java script enabled in your browser, you'll be redirected automatically our domain.  If you are facing any problem with redirection or you are not being redirected just navigate manually by entering http://curiousfolk.org in your browser.

THANKS FOR BEING WITH US!!

Friday 2 August 2013

A tiny introduction to Regular Expressions

In this tiny post I am going to give you some information about regular expressions.
A Regular expression in computer science is a  specialized string of characters representing one or more strings of characters having a special format. In other words, a regular expression is a generalised representation of a particular family of strings.
For example the regular expression "^([a-z])([0-9])$" represents a set of strings containing two characters, first letter being a lower case alphabet and the second one being a digit between 0 and 9. That means a set containing strings like a6, a3, s5 and so on.
So what those symbols mean? :
In the above example you can see some special characters like '^' and '$'. But what's that weird string mean?. If this is your question, the answer is simple. They mean what they meant to. Well, don't worry, I will help you to get out of this doubt. The caret symbol( '^' ) tells the regular expression engine about what character should be at the beginning of the string to qualify it as the correct match for the regular expression under consideration. Now coming to the next character '('. The parenthesis is used for grouping in regular expressions as you do in mathematics. Nothing more interesting about it. Let's move to the next character '['. This has a special meaning in regular expressions. The things enclosed inside '[ ]' are called ranges. They are called so because the regular expression engine expands it before matching. For example the range [0-3] will be expanded to (0|1|2|3). Here you can see one more special character '|' or pipe symbol. This is an operator and it is called 'OR'. This tells the engine to match any of the character among all the members inside the range. Let's not go in deep about it and let me continue with our example. So far we have one rule which says the string should start with one of the lower case alphabets. I hope you are getting the picture. Now let's continue to the next group. Next group contains a range '[0-9]'. You know what it means. The next character is '$' or the dollar symbol. This does the exact opposite of the caret symbol. That means, it defines what should be the last character. So now from the range 0-9 and the dollar symbol we have another rule which says that the string should end with a single digit integer. Now from the two rules we have, you can easily understand why the regular expression above represents a3, k3 etc.
Uses of Regular Expressions :
Regular Expressions play a vital role in almost all branches of computer science. Compilers do the extensive usage of regular expressions to check the syntax and even for parsing the source code written by a programmer. Also in web development regular expressions are used for verifying URLs, email addresse etc.
So far we had just a small introduction to regular expressions. There are lot of things in regular expressions and it is impossible to put it all in one post. I suggest you to search on internet for information about this particular topic if you are interested about it.
That's all folks!
Thank you for visiting and don't forget to come back. Also I welcome you for commenting if I deserve anything (good or bad, just comment).
HACK ALL YOU CAN!

Saturday 1 June 2013

Basic Terminal Commands

Today i am going to show some of basic terminal commands for doing some basic tasks.


Creating Files:

The 'touch' utility sets the modification and access times to the current time of day. If the file doesn't exist, it is created with the default permissions and attributes.

touch /path/filename

    Above command will create an empty text formatted file in the path and filename provided. If a file with same name already exist, that file will be overwrittenand all it's contents will be lost.
To prevent this following command can be used.

touch /path/filename >> /path/filename


The above command will only alter the the modification date and time settings if the file specified is already exist. Otherwise a new empty file will be created.

Creating Folders/Directories: 

For creating Folders, command 'mkdir' can be used. The general syntax is as below.
mkdir /path/folder_name/

If the command provided only with the directory name without the path, then a directory with the given name will be created in the current directory.

Copying Files/Folders:

'cp' is the command for copying Files and Folders. The general command given below can be used to copy files by replacing the source and destination.

cp /source_file /destination_file

Note: In order to copy directories, '-r' should be used which copies a directory along with it's subdirectories also. i.e., '-r' invokes the recursive copying process.

Removing Files/Folders :

'rm' is the command to remove Files/Folders in UNIX like systems (at-least in Ubuntu). To remove a file located at 'path' use the following command.

rm path/file_name
Note: Use -r if you want to delete a directory tree as you do while copying files and subdirectories of a folder. Here also '-r' invokes recursive execution of 'rm' command for all contents of the parent directory supplied as the path argument.  


Installing Packages:

Installalling packages in Ubuntu is very easy with  "apt-get" and "dpkg" commands. "apt-get" can be used to download and install softwares.
==> If you have already downloaded the debian(*.deb) packages and want to install it then you can use command 'dpkg' as

sudo dpkg -i package_name 
Where
  sudo - Gives Super User or root permissions for the command 'dpkg'
  dpkg - Debian Package Manager
  -i   - Instructs the 'dpkg' to install the specified package
  package_name - Path to your downloaded *.deb package file.

==> If you don't have the software package you want to install then you can use 'apt-get' command to download and install the package from the Ubuntu repositories.
sudo apt-get install package_name

where 
  sudoGives Super User or root permissions for the command 'apt-get'
  apt-get - A simple command line interface for downloading and
installing packages.
  install - Option to instruct the 'apt-get' util to install the downloaded package.
  package_name - Name of the package that you want to download and install from the Ubuntu repositories.

Note:- The package name for apt-get command should be exactly as in the repositories. Otherwise apt-get command will fail with errors.

         


Wednesday 3 April 2013

Synaptic Package Manager

What is Synaptic Package Manager?

Synaptic Package Manager is a graphical front-end for the Ubuntu package management system 'apt'. Synaptic brings a very user friendly software management environment combining the power of 'apt' and the simplicity in usage of graphical user interface. Using Synaptic user can install, remove, configure, or upgrade software packages, browse, sort and search the list of available software packages, manage repositories, or upgrade the whole system. And also can queue up a number of actions before executing them. Synaptic will inform the user about dependencies (additional packages required by the software package you have chosen) as well as conflicts with other packages that are already installed on the system. 



How to get Synaptic Package Manager?

Synaptic Package Manager can be installed from both terminal and from Ubuntu Software Center very easily.
1. To Install it from Terminal:
      Open Terminal and type "sudo apt-get install synaptic"
2. To install it from Software Center:
      i. Search for Synaptic or Synaptic Package Manager
      ii. And install the Synaptic Package Manager


For more information on how to use Synaptic Package Manager, you can refer to the Ubuntu Official Documentation.

Updating Ubuntu Package Repositary


What is Repositary?

Repositories are servers which contain sets of packages. In other words Package Repositary is a database where informations about all the softwares available for Ubuntu is stored.
Software in Ubuntu's repository is divided into four categories or components - main, restricted, universe and multiverse.





  • Main - The main component contains applications that are free software, can be freely redistributed and are fully supported by the Ubuntu team.

  • Restricted - Supported software that is not available under a completely free license and also not complete support may not be available.

  • Universe - The universe component is a snapshot of the free, open-source, and Linux world. It houses almost every piece of open-source software, all built from a range of public sources. Canonical does not provide a guarantee of regular security updates for software in the universe component

  • Multiverse - The multiverse component contains software that is not free, which means the licensing requirements of this software do not meet the Ubuntu main component licence policy. The onus is on you to verify your rights to use this software and comply with the licensing terms of the copyright holder. This software is not supported and usually cannot be fixed or updated.  Use it at your own risk.


Why updating is necessary?

There are many situations or reasons where you need to update Ubuntu software repositary. One common reason is that, by updating the repositary, you can have a quick access to latest softwares available for Ubuntu. Also in some situations the Ubuntu software repositary may get deleted. When the software repositary is erased you can't install the required softwares from terminal. So in that case to put everything up, you have to update your repositary.

So how to update from Terminal?

It is very easy to update your software repositary through terminal. Just follow the steps.
  1. Open the terminal.
  2. You should have a internet connection to update your repositary.
  3. Then in the terminal enter the command apt-get update
  4. Then the 'apt-get' command will ask you for the admin password.
  5. After entering the admin password the update process starts. 

Monday 1 April 2013

Downloading a whole website via Terminal in Ubuntu



In this tutorial i am going to explain how to download a whole website into your computer. After doing the steps i explained below you can use the downloaded website offline!!.  That also without any third-party software.
To download the website and to convert it to offline edition, i am going to use a commandline utility called 'wget'.

These are the steps to download an offline edition of any website.
  1. Open the terminal
  2. Now enter the following command.
                        wget --mirror -p --convert-links -p destination_path website_URL
 
Now i will tell what those words mean.
  • wget - This is the utility which does all this great stuff
  • --mirror - Turns on options suitable for mirroring
  • -p - Instructs to download all the files required to the page to load properly
  • --convert-links - Converts all the links in the each web pages to the offline path so that offline navigation between pages is possible.
  • destination_path - This is the local path where the downloaded files should be stored. When you are executing the actual command, you have to replace this by a local path. (i.e. Path to any folder that exist in your computer.)
  • website_URL - This is the web site address.
So now you know the general command. If you want an example here it is.
                    wget --mirror -p --convert-links -p /home/user/Documents http://en.wikipedia.org
The above command will download Wikipedia frontpage along with the pages linked from the frontpage and all the downloaded files will be stored in the Documents/en.wikipedia.org folder.
                        

Sunday 31 March 2013

Comparison Between Ubuntu and Windows

In this post i will give you a basic comparison between Ubuntu and Windows Operating Systems. And in particular i am going to take Ubuntu 12.04 LTS and Windows 7 for comparison.


1. Graphics and User Interface:

Even though, graphics is a personal choice i will give a small comparison between Windows 7 graphics and Ubuntu 12.04 graphics. Both being very popular Operating Systems, have better graphics.
But when we compare Ubuntu 12.04 graphics with the Windows 7 graphics, taking performance into account, we come to know that though Windows 7 gives better graphics using Windows Aero technology it consumes system resources and memory thereby reducing the system performance. On the same system with same configuration Ubuntu can run smoothly along with it's nice graphics and User Interface designs. So as i experienced my vote goes to Ubuntu for graphics.

2.  Preinstalled Softwares:

About preinstalled or bundled softwares, Windows 7 comes with very minimum bundled softwares. The very basic softwares like a word processor, spread sheet and a presentation softwares are not present by default. To get these minimal features, we have to purchase Microsoft Office Suite.
But unlike Windows, Ubuntu 12.04 comes with preloaded software bundle LibreOffice which has LibreOffice Word for word processing, LibreOffice Calc for SpreadSheets and LibreOffice Impress for presentations and along with these some additional tools like LibreOffice Formula etc. Also Ubuntu has a preinstalled chat client called 'Empathy - Instant Messaging'.

3. Drivers:

Another biggest advantage of Linux distros(distributions like Ubuntu) is that they have built-in drivers for almost all types of normally used hardwares  such as Wi-Fi, Ethernet controllers, USB drivers, BroadBand routers, printers, scanners etc. Ubuntu also has a feature to download and install the built-in drivers with proprietary drivers whenever necessary. But unlike Ubuntu, in Windows 7 drivers should be manually downloaded and installed. But now Windows also comes with some basic drivers like USB drivers, Bluetooth drivers etc.

4. MultiMedia:

The common drawback of both the Operating Systems is that, in both operating systems we have to download codecs for playing multimedia files such as Xvid etc. But Windows comes with Windows Media Player which can be used to play common media files like *.avi, *.mp3 etc. But in Ubuntu 12.04 every codec should be downloaded manually and installed. So in this case Windows 7 over takes Ubuntu 12.04
But as VLC Media Player is available for both WIndows and Ubuntu it is easy to overcome this drawback.

5. Third Party Software Installation:

When it comes to installation of 3rd party softwares in Ubuntu , the installation procedure is comparatively less than that in Windows. This is because of the large software repositary system setup by Canonical Inc and Ubuntu community, which gives tremendous software support via Ubuntu Software Center. But in Windows there is no such software center system and you have to get all softwares from the 3rd party websites where there are possibilities of injection of harmful programs to the user's system.

6. Security:

Linux by default does not run as a root (the Windows ‘administrator’ equivalent). This ensures that any automated program or script cannot make changes to the system without explicit privileges from the user. Windows 7 also implemented a similar concept called 'User Account Control' System, according to some survey it is not as robust as Ubuntu/Linux distros. So it is clear that Ubuntu or Linux distros are more secure than Windows.


7. Gaming:

When it comes to gaming support by the operating system, although Ubuntu has many games, it   can't beat Windows. Most of the high-end games are built for Windows platform as Windows gives DirectX support for efficient graphics rendering. But recently a commercial game engine called Steam is released for Ubuntu which will lead to a tremendous development in gaming features. The very famous game Counter-Strike has already striked the Ubuntu operating system using Steam engine.

8. Cost:

Another biggest advantage of Ubuntu and Linux distros over Windows is that, Ubuntu is totally free and it is open-source at the same time giving almost all features of Windows which is a commercial operating system.

Saturday 30 March 2013

Bless Hex Editor


Hex Editor:

A hex editor or binary file editor or byte editor is a program which allows the users to manipulate binary data which as a whole constitutes to a computer file. The name 'hex' comes from the 'hexadecimal'( A numerical system consisting of 16 fundamental digits).

Bless Hex Editor:

Bless Hex Editor is one such hex editor for ubuntu. It is written in mono/Gtk# and its primary platform is GNU/Linux. However it should be able to run without problems on every platform that mono and Gtk# run. Bless Hex Editor, in addition to all features that a hex editor must have like editing files as a sequence of bytes, allowing read/write, also offers many other features such as search, pattern finding, efficient query-replace, multi-tabbing, customized data-views, plugins etc.


Bless currently provides the following features:
  • Efficient editing of large data files and block devices.
  • Multilevel undo - redo operations.
  • Customizable data views.
  • Fast data rendering on screen.
  • Multiple tabs.
  • Fast find and replace operations.
  • A data conversion table.
  • Advanced copy/paste capabilities.
  • Highlighting of selection pattern matches in the file.
  • Plugin based architecture.
  • Export of data to text and html (others with plugins).
  • Bitwise operations on data.
  • A comprehensive user manual.
System Requirements for Bless Hex Editor:
  • Mono runtime (version 1.1.14 or higher)
  • Gtk#2 (version 2.8 or higher)
Both mono runtime, and Gtk# can be downloaded from Mono-Project site or from Ubuntu Software Center or also from terminal by running command, "sudo apt-get install mono-runtime"

Friday 29 March 2013

XOR Encryption and It's implementation in C

As you might know, encryption is hiding data by masking them with some other data. There are many exncryption algorithms used for encrypting any confidential data. XOR, SHA, MD5, RSA and DSA etc. are few of them. Today i am going to explain what is XOR encryption and how it works and also implementation of XOR in C programming Language.
About XOR Encryption Method:
In Cryptography, the XOR cipher is a type of additivecipher, and an encryption algorithm. Operation of XOR Encryption Algorithm is based on following four principles.
  1. A XOR 0 = A
  2. A XOR A = 0
  3. (A XOR B) XOR C = A XOR (B XOR C)
  4. (B XOR A) XOR A = B XOR 0 = B
where A, B and C are called boolean varibales which can have values 0 and 1 which represents a bit. And XOR is called Exclusive-OR operation in Boolean algebra. Exclusive-OR(XOR):- As it's name suggests, XOR is exclusively OR operation which means that, if there are two varibales op11110011erated using XOR operation then the result is 1(In some cases refered as true), only when any one and only one of the two varibales has value eaqual to 1.
Example: If A=1 and B=0 then A XOR B = 1
If A=1 and B=1 then A XOR B = 0
How XOR Encryption Works?
XOR Encryption works by repeating XOR operation on each character of the given string and the key string. So to decrypt the encrypted data, just pass the decrypted text as the string input and the same key used for the encryption as the key.
Example:(From Wikipedia)
In 8-bit ASCII, the string 'Wiki' can be represented as '01010111 01101001 01101011 01101001', where each 8-bit word represents the letters W, i, k and i respectively.
 The XOR operation is carried out in the follwing manner using the key '11110011'.
01010111 XOR 11110011 = 10100100
01101001 XOR 11110011 = 10011010
01101011 XOR 11110011 = 10011000
01101001 XOR 11110011 = 10011010
So the encrypted output will be ascii text equivalent of '10100100 10011010 10011000  10011010'
This is the simplest working example of the XOR encryption. There are other implementations too, which stands different because of their iteration steps.
Note:- XOR encryption can be made very strong(Even unbreakable) by using true random numbers. But normally XOR encryption is considered to be very weak. This is because encrypted data can be subjected to plaintext attacks to get the key and there by leading to the possibility of decryption of confidential data. So no standards recommend XOR Encryption for data protection.
Implementation of XOR Encryption In C
As i have already explained the basic technique of XOR Encryption, i am not going to explain much about the program and it's working wherever it is not necessary to do so. Also remember that while using the below specified code to encrypt textual data, the key should have atleast the length of the string to be encrypted. Otherwisse there might be some data lose after decrypting again.
Here goes a simple C Code:-
#include <stdio.h>
#include <string.h>
int main()
{
  int i;
  char string[100]="";
  char key[100]="!@#$%^&*()_"; //Default key.
   printf("\n Enter the string to be ciphered: ");
  scanf("%s",&string); //Read the string to be encrypted and store it in 'string' variable
  printf("\n Enter the key: ");
  scanf("%s",&key); //Read the string to be used as key and store it in 'key' variable
  printf("\n Ciphered text :  ");
  for(i=0; i<strlen(string); i++)
{
string[i]=string[i]^key[i]; //Perform the XOR operation on i'th caharcter of the string and i'th character of the key.
  }
  printf("%s\n",string); //print the ciphered text to the screen.
  return 0;
}

Thursday 28 March 2013

Installing LAMP on Ubuntu




 LAMP Stands for Linux Apache MySQL and PHP ( Sometimes Perl or Python also)
 LAMP is a package consisting of a elemental components of a general purpose web server.

Installation of LAMP is splitted up into four steps.

Step 1. Installation of Apache HTTP Server 2:
  To install Apache 2 on your system, Open terminal. Then enter the following command.                 
                                                
                                                  'sudo apt-get install apache2'   
                                       
 You have to enter the admin password to install any softwares. So enter your admin password and complete the installation.
To test your apache installation, open any browser of your choice and navigate to 'http://localhost/' or '127.0.0.1' 

Step 2. Installation of PHP 5:
  To install PHP5 on your Ubuntu system, open terminal and enter the following command.

                                    'sudo apt-get install php5 libapache2-mod-php5'
This command will install PHP5 in your system along with the required libraries to work with Apache2.
To activate PHP5 you have to restart the Apache server. To do so, execute the following terminal command.
                   
                   'sudo /etc/init.d/apache2 restart'

Step 3. Installation of MySQL:

 Again, to install MySQL open terminal and run the command given 

                  'sudo apt-get install mysql-server' 

 After finishing all the 3 steps explained above, you have LAMP system on your computer.

MySQL we installed is a console based DataBase Management System which is little difficult to handle. So we need a light weight, easy-to-use utility to do all our DBM(Database Management) jobs. Most commonly used and the recommended one is the phpMyAdmin.

Installation of phpMyAdmin is very easy. All that you need to do is, just execute the command given below via terminal.

          'sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin'