| openGLUG

Pages

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'