Thursday, 5 June 2014

HOW TO CREATE A FREE AMAZON WEB SERVER



èSETTING UP A AWS FREE CLOUDè

1.Go to the website à http://aws.amazon.com/ec2/

2.Click on create a free account on the right side.

3.Enter your email address and all the details, then click on “create account and continue”.

4.Then it will ask your credit card number and phone verification (but it will not charge for a free account) .

5.After registering, go to the homepage and click on “EC2 virtual web server”.

6.Now in the create instance , click on “Launch instance”.

7.Now you will see the screen showing the different OS available for the virtual machine.
 **Available OS**
Amazon linux AMI, Red hat interprise linux, Ubuntu server 12.04.3 LTS,Ubuntu 13.10, Microsoft windows server 2012.

8. Select you OS (32 or 64-bit) and after selecting  it will show the details like memory available, instance storage, ECU’s, vCPU’s,  Network performance, etc.
**For a ubuntu server (32-bit)**
                               available memoryà0.613 GB
                                                     ECU’sà2
                                                   vCPU’sà1

9.Now click on “Next: Configure instance details” .

10.For a free server select “no preferences” in subnet and click on “Next: Add storage” and it will show 8 GB storage. Now click on “Next: Tag instances.”

11.Enter a Key(name) and Value and click on “Next:Configure security group”.

12.Here it will show protocol(SSH), type(TCP), port range code(22) and source. Click on “Review and Launch” and after it click on “Launch”.

13.Now it will ask you to create a key pair. Enter the key pair and click on “Download” & then select “Launch instance”.

14. A file will be downloaded in your system, and the screen will show your launch status.

15. Go to “how to connect to your linux instance”.

16.Now in your putty configuration go to sessionàType your host IP addressà Give it a nameà Click on saveà select your name and then click on load.

17.Now go to Connectionsà SSHà Authà Browseà and open the file that had been downloaded to your system.

18.Now again go to sessionàsave it àand then double click on your host name.

19.You should have puTTygen installed in your system before proceeding further.

20.After installing puTTygen in your system go to “Connect using puTTy” in the amazon page.

21.Open “puTTy key generator” in your system and click on Loadà Now open the previously downloaded keyàIt will show a success messageàNow click on “Save private key” and save it with a name say ”Amazon key”.

22.Now go back to puTTy àRight Click on it and select “new session”àselect your host name  and load it.

23.Now go to SSHàAuthàBrowse the key which you have just createdàLoad itàA window of PuTTy will ask “Login as”, here you have to enter the username(i.e for ubuntu the username is ubuntu).

24.Now using command
“apt-get install git” you can install github
“apt-get install apache2” install apache and run it.
( i.e it is a WORKING LINUX BOX).

25.Open AWS pageàNetwork & SecurityàSecurity groupsà Select your hostà InboundàCreate a new rule and select HTTP àApply rule change.

26.Now enter your host IP address in your browser and you can see that your site it running.



                                   
                        



Thursday, 10 April 2014

OpenSSL vulnerability allows hackers to read 64k of memory on target server

                                        

HeartBleed: A potentially critical security vulnerability in OpenSSL has been discovered that allows an attacker to read up to 64kilobytes of memory from the server running a vulnerable OpenSSL version. 

As a normal user, you may not aware what is OpenSSL.  It is cryptographic library which is used for encrypting communication between web server and users - used by plenty of websites including Google, Yahoo, Twitter. The bug( CVE-2014-0160), dubbed as 'HeartBleed', was independently discovered by Neel Mehta from Google Security team and Codenomicon.  The bug appropriately named HeartBleed because vulnerability is located in HeartBeat extension and it leads to memory leak.The attacker can read only up to 64k of memory during one iteration of the attack.  However, according to Heardbleed.com, an attacker can "keep reconnecting or during an active TLS connection keep requesting arbitrary number of 64 kilobyte chunks of memory content until enough secrets are revealed". An attacker can retrieve the private key used for encrypting the communication that will allow to read all information passed to server and user like it wasn't encrypted at all.

How to fix it? 

If your server is using OpenSSL 1.0.1 and 1.0.1f, then better upgrade to 1.0.1g. If you are using 1.0.0 and 0.9.8, you are not vulnerable to this bug.  As a temporary fix, users can remove HeartBeat extension by recompiling OpenSSL with -DOPENSSL_NO_HEARTBEATS

Check whether Your server is vulnerable or not:"http://filippo.io/Heartbleed/" allows to find whether your server is vulnerable to this bug or not.Details about the Bug:TLS Heartbeat extension is to ping from one end to another end - a specific message with size of it is being sent from client to server and server responds with the same message.But, if an attacker send a small size of data(Let's say 1 kilo byte) and claims it's large size(64k), then the server(running vulnerable OpenSSL) will respond with 1 kilo byte of attacker's data + 63 kilobytes of data read from memory of the server.Technical details of this bug can be found here .(read only if you are good in 'C' program).Here is POC script written in Python: https://gist.github.com/ixs/10116537 


SOURCE=> http://www.ehackingnews.com/

BJP Junagadh website hacked by Pakistani hackers




Local news organizations reports that BJP Junagadh unit's website (bjpjunagadh.org) was hacked and defaced by some unknown hackers.
The hackers who defaced the website posted comments against BJP and RSS. The defacement also contains several images of people burning and standing on the Indian tricolor. We have referred some defacement-mirror websites, the hack appears to have taken place in February.  It is unclear whether these local reports referring this incident or the website got defaced again today. According to the defacement-mirror record(hxxp://dark-h.org/deface/id/12604), this website was defaced by a Pakistani hacker going by handle "Sniper haxXx" who is responsible for many Indian websites' hacks. "As soon as I reached office, our IT cell employees told me that someone has hacked our website http://www.bjpjunagadh.org and uploaded photographs and comments to malign reputation of BJP, RSS and Narendra Modi,"Indian Express quoted In-charge of BJP Junagadh office Raju Jivani as saying. A complaint has reportedly been lodged against the unknown hacker, police are trying to find the hacker who is responsible for the breach. Meanwhile, Gujarat Pradesh Congress Committee's President Arjun Modhwadia told reporters that "This is purely an attempt to get votes by playing the communal card ahead of the election".


SOURCE=> http://www.ehackingnews.com/

MAKE A SIMPLE CLOCK WITH JAVASCRIPT

                                                   

CODE=>

<html>
<head>
</head>
<body>
<script type="text/javascript">
function printtime()
{
var now=new Date();   
var hours=now.getHours();
var mins=now.getMinutes();
var seconds=now.getSeconds();
document.write(hours+":"+mins+":"+seconds+"<br>");
}
setInterval("printtime()",1000);
</script>
</html>

HOW IT WORKS=>
1.We made a function printtime() having variables now,hours,mins and seconds.
2.Variable now will get the current date.
3.The variables hours,mins,seconds will get the hour,minutes and seconds of the current date.
4.setInterval will call the function printtime repeatedly after every one second.

OUTPUT=>





Thursday, 27 March 2014

FINDING COMMON ELEMENTS IN GIVEN LINK LIST

QUES=>  Printing the common elements in two given linked lists.

CODE

#include<stdio.h>
#include<conio.h>
#include<malloc.h>
typedef struct nodetype
{  int info;
      struct nodetype *next;
}node;

void common (node *head1, node *head2)
{  node *p;
   p=head2;
   printf("\n common elements are :");
   while(head2!=NULL || head1!=NULL)
   {
   head2=p;
   while(head2!=NULL)
   {
     if(head1->info==head2->info)
     printf(" %d ",head1->info);
     head2=head2->next;
   }
     head1=head1->next;
   }
}


void main()
{  node *head1,*head2,*ptr1,*ptr2,*p,*q,*h1,*h2;
int i,j;
   clrscr();
   ptr1=(node*)malloc(sizeof(node));
   ptr2=(node*)malloc(sizeof(node));
   head1=ptr1;
   head2=ptr2;
   h1=ptr1;
   h2=ptr2;
   ptr1->info=1;
   ptr2->info=7;

   for(i=2,j=2; i<=6; i++,j=j+2)
   { p=(node*)malloc(sizeof(node));
     q=(node*)malloc(sizeof(node));
     p->info=i;
     q->info=j;

     ptr1->next=p;
 ptr1=ptr1->next ;

     ptr2->next=q;
 ptr2=ptr2->next ;


   }
   ptr1->next=NULL;
   ptr2->next=NULL;
printf("The link list is : ");
   while(head1!=NULL)
   {   printf(" %d ",head1->info);
       head1=head1->next;
   }
   printf("\nThe link list is : ");
   while(head2!=NULL)
   {   printf(" %d ",head2->info);
       head2=head2->next;
   }
   common(h1,h2);
   getch();

   }


OUTPUT


MERGING OF TWO LINKED LIST

QUES=>Two linked lists are given as
       A: 1, 2, 3, 4, 5, 6
 B:  7, 8, 9, 10, 11, 12
Make a third linked list so that it is in the following order.

 C: 1,7,2,8,…..,6,12


                                           CODE

#include<stdio.h>
#include<conio.h>
#include<malloc.h>
typedef struct nodetype
{  int info;
      struct nodetype *next;
}node;

void merg (node *head1, node *head2)
{
node *curr,*temp;
   curr=head1;
   temp=head1;
   while(head2!=NULL || head1!=NULL)
   {   head1=head1->next;
    curr->next=head2;
     head2=head2->next;
    curr->next->next=head1;


    curr=head1;
   }
   curr=NULL;
   puts("\nThe merged link list is :");
   while(temp!=NULL)
   {   printf(" %d ",temp->info);
       temp=temp->next;
   }

}


void main()
{  node *head1,*head2,*ptr1,*ptr2,*p,*q,*h1,*h2;
int i,j;
   clrscr();
   ptr1=(node*)malloc(sizeof(node));
   ptr2=(node*)malloc(sizeof(node));
   head1=ptr1;
   head2=ptr2;
   h1=ptr1;
   h2=ptr2;
   ptr1->info=1;
   ptr2->info=7;

   for(i=2,j=8; i<=6,j<=12; i++,j++)
   { p=(node*)malloc(sizeof(node));
     q=(node*)malloc(sizeof(node));
     p->info=i;
     q->info=j;

     ptr1->next=p;
 ptr1=ptr1->next ;

     ptr2->next=q;
 ptr2=ptr2->next ;


   }
   ptr1->next=NULL;
   ptr2->next=NULL;
printf("The link list is : ");
   while(head1!=NULL)
   {   printf(" %d ",head1->info);
       head1=head1->next;
   }
   printf("\nThe link list is : ");
   while(head2!=NULL)
   {   printf(" %d ",head2->info);
       head2=head2->next;
   }
   merg(h1,h2);
   getch();
   }


                                                   OUTPUT



Wednesday, 19 March 2014

PROGRAM TO CREATE,ADD,DELETE,DISPLAY,REVERSE & SEARCH AN ELEMENT IN SINGLY LINKED LIST


#include<stdio.h>
#include<conio.h>
#include<malloc.h>
#include<process.h>

//Structure declaration for the node

struct node
{
int info;
struct node *link;
}*start;

//This function will create a new linked list

void Create_List(int data)
{
struct node *q,*tmp;

//Dynamic memory is been allocated for a node

tmp= (struct node*)malloc(sizeof(struct node));
tmp->info=data;
tmp->link=NULL;

if(start==NULL) /*If list is empty*/
start=tmp;
else
{ /*Element inserted at the end*/
q=start;
while(q->link!=NULL)
q=q->link;
q->link=tmp;
}

}/*End of create_list()*/

//This function will add new element at the beginning of the linked list

void AddAtBeg(int data)
{
struct node *tmp;
tmp=(struct node*)malloc(sizeof(struct node));
tmp->info=data;
tmp->link=start;
start=tmp;
}/*End of addatbeg()*/

//This function will add new element at any position

void AddAfter(int data,int pos)
{
struct node *tmp,*q;
int i;
q=start;
//Finding the position to add new element to the linked list
for(i=0;i<pos-1;i++)
{
q=q->link;
if(q==NULL)
{
printf ("\n\n There are less than %d elements",pos);
getch();
return;
}
}/*End of for*/
tmp=(struct node*)malloc(sizeof (struct node));
tmp->link=q->link;
tmp->info=data;
q->link=tmp;
}/*End of addafter()*/

//Delete any element from the linked list
void Del(int data)
{
struct node *tmp,*q;
if (start->info == data)
{

tmp=start;
start=start->link; /*First element deleted*/
free(tmp);
return;
}
q=start;
while(q->link->link != NULL)
{
if(q->link->info == data) /*Element deleted in between*/
{
tmp=q->link;
q->link=tmp->link;
free(tmp);
return;
}
q=q->link;
}/*End of while */
if(q->link->info==data) /*Last element deleted*/
{
tmp=q->link;
free(tmp);
q->link=NULL;
return;
}
printf ("\n\nElement %d not found",data);
getch();
}/*End of del()*/

//This function will display all the element(s) in the linked list
void Display()
{
struct node *q;
if(start == NULL)
{
printf ("\n\nList is empty");
return;
}
q=start;
printf("\n\nList is : ");
while(q!=NULL)
{
printf ("%d ", q->info);
q=q->link;

}
printf ("\n");
getch();
}/*End of display() */
//Function to count the number of nodes in the linked list
void Count()
{
struct node *q=start;
int cnt=0;
while(q!=NULL)
{
q=q->link;
cnt++;
}
printf ("Number of elements are %d\n",cnt);
getch();
}/*End of count()*/
//This function will reverse the linked list
void Rev()
{
struct node *p1,*p2,*p3;
if(start->link==NULL) /*only one element*/
return;
p1=start;
p2=p1->link;
p3=p2->link;
p1->link=NULL;
p2->link=p1;
while(p3!=NULL)
{
p1=p2;
p2=p3;
p3=p3->link;
p2->link=p1;
}
start=p2;
}/*End of rev()*/

//Function to search an element from the linked list

void Search(int data)
{

struct node *ptr = start;
int pos = 1;
//searching for an element in the linked list
while(ptr!=NULL)
{
if (ptr->info==data)
{
printf ("\n\nItem %d found at position %d", data, pos);
getch();
return;
}
ptr = ptr->link;
pos++;
}
if (ptr == NULL)
printf ("\n\nItem %d not found in list",data);
getch();
}

void main()
{
int choice,n,m,position,i;
start=NULL;
while(1)
{
clrscr();
printf ("1.Create List\n");
printf ("2.Add at beginning\n");
printf ("3.Add after \n");
printf ("4.Delete\n");
printf ("5.Display\n");
printf ("6.Count\n");
printf ("7.Reverse\n");
printf ("8.Search\n");
printf ("9.Quit\n");
printf ("\nEnter your choice:");
scanf ("%d",&choice);
switch (choice)
{
case 1:
printf ("\n\nHow many nodes you want:");
scanf ("%d",&n);

for(i = 0;i<n;i++)
{
printf ("\nEnter the element:");
scanf ("%d",&m);
Create_List(m);
}
break;
case 2:
printf ("\n\nEnter the element : ");
scanf ("%d",&m);
AddAtBeg(m);
break;
case 3:
printf ("\n\nEnter the element:");
scanf ("%d",&m);
printf ("\nEnter the position after which this element is inserted:");
scanf ("%d",&position);
AddAfter(m,position);
break;
case 4:
if (start == NULL)
{
printf("\n\nList is empty");
continue;
}
printf ("\n\nEnter the element for deletion:");
scanf ("%d",&m);
Del(m);
break;
case 5:
Display();
break;
case 6:
Count();
break;
case 7:
Rev();
break;
case 8:
printf("\n\nEnter the element to be searched:");
scanf ("%d",&m);

Search(m);
break;
case 9:
exit(0);
default:
printf ("\n\nWrong choice");
}/*End of switch*/
}/*End of while*/
}/*End of main()*/