Thursday, 13 December 2012

Difference Between Virus,Worms,Trojan and Spyware


We all have heard the terms Virus,Worms,trojans and spyware but only a few of us know the difference between them.We genreally consider everything that is detected by an antivirus as virus but this is not the case.The antivirus not only provides protection against viruses but it also protects us from trojans,worms and spywares.All these can be harmful to your computer hardware and software.Today I will differentiate all these terms from each other .

Ok lets start from the introduction of viruses

Virus :- A virus is a self replicating program that attaches itself to an executable file.When the file is executed the virus automatically gets executed and enters into system memory .Once it enters into system memory it either searches for other files that can be infected or stays in the background and infect the files that are uses the virus infected program.

Worms : Worms are very similar to viruses but differ in way that they donot bind themselves to executable files instead to replicate themselves they uses the network.If you find excessive use of your network bandwidth then you may be infected by a worm.So,a worm donot require a user to execute any file for its execution it can work without user intervention.

Trojan Horse :- A trojan horse is harmful program which may seem harmless to the user before its installation but instead it is programmed or reverse engineered to facilitate unauthorised remote access to the computer.Trojan’s donot replicate themselves.

Spyware :- A spyware is a program that secretly monitor and collects pieces of information.They usually run in stealth mode and cannot be detected easily.Keyloggers is a great example of spyware software.These are not limited to just spying but can also send data to remote computers .

Sunday, 28 October 2012

Apache Hadoop

Hadoop, an Apache open-source project, is a framework written in Java for running applications on large clusters of commodity hardware and incorportates features to manage unstructured, semi-structured, and structured data.It is a collection of open-source components built on top of a distributed file system that was designed specifically for very large-scale data operations.

Apache Hadoop detailed Presentation . Download it here. if you want more material then post comments...

Access Blocked Website from any wifi router of colleges



Spotflux harnesses the power of the cloud to conduct millions of real-time checks for invasive tracking, advertisements, malware, and other bugs that pose a threat to your identity or your data.


1. Just enable spotflux and continue enjoying the internet as you always do.
2. Your internet traffic is encrypted and sent through the spotflux cloud.
3. Spotflux's cloud runs millions of calculations to remove ads, tracking cookies, and other things that follow you around the web.
4. Viruses and malware are zapped and destroyed.
5. The location and identity of your devices are concealed.
6. Your connection to the internet is safer, more private, and unrestricted.



Just Download and Install Spotflux utility to access any website from anywhere.

Sunday, 21 October 2012

Increase Internal Memory of Samsung Galaxy Y


  1.  You will need to root your Samsung Galaxy Y.
  2.  We need to create a partition on your SD Card or your microSD card.
  3.  To create a partition in our microSD Card, we will be needing a free tool called MiniTool.
  4.  After you have download the MiniTool Partition Wizard, install it in your computer and Run MiniTool.
  5. If your microSD card is new then you can proceed with creating a partition. If not, be sure to back up everything in your microSD card. Creating a partition will delete every data in your microSD card.
  6.  Plug your microSD card to your computer. While in MiniTool, right click your microSD card drive and format it. REMEMBER: Be sure it is the correct drive and do this after you have backup every data in your card. Select fat32 as file system, hit ok and hit the apply button found in the upper left corner of MiniTool (the one with the big blue check mark)
  7. After you have formatted it, right click on the microSD drive again and select Move/Resize.The unallocated size will serve as the additional internal memory of your android smartphone. Hit ok after you have set the partition size.
  8. You will see in the MiniTool window an unallocated size in your microSD card.. Right click and create a partition for it, it will be formatted at the same time. Choose EXT3 as its file system. Hit the Apply button again after. Again be sure to hit the big check “Apply” buttonotherwise the changes would not be implemented.
  9. After partition, you will only see the FAT32 portion of the microSD in your Windows Computer. But in Minitool you will see that there is a FAT32 and EXT3 partition. Now your done with the partitioning.
  10. You will also be needing another app called link2sd.
  11. Install link2sd in your smartphone, run link2sd and it will ask you to mount script. Choose ext3 and hit OK
  12. After you have successfully done that, reboot your android smartphone.
  13. Once your phone returns from reboot, Run link2sd, go to its settings and check everything to auto-link. That should do it!

Radio Frequency Identification

Download it here....

Intel 80486 Microprocessor - Report

Intel 80486 Microprocessor report in IEEE format .Download It here.

Power Aware Routing In Wireless Sensor Networks

Download Complete Report and Presentation On Power Aware Routing In Wireless Sensor Networks....

Admission Management System in asp

The Complete Project of Admission Management System developed in asp.net. You can Download it here...

Ad hoc Networks - Complete Report

You can Download Ad hoc Networks : report as well as ppt.

Thursday, 18 October 2012

Ubuntu Install From USB


    Download Syslinux, which is the bootloader we will be using to make the stick bootable. Just get the latest version in zip format, and extract it to the Desktop – right-click, select 7-zip, then extract to syslinux-7.1.1 (or whatever) and then rename that folder to “syslinux”.
    Open a command prompt (on the Start Menu under Accessories, or run “cmd”) and cd to the syslinux folder:
    cd Desktop/syslinux/win32
    Run this command to install the syslinux bootlader to the thumbdrive:
    syslinux -ma f: (where f: is the letter of your USB thumbstick)
    Now we need to extract the Ubuntu ISO – Right click on the ISO file, and select 7-zip/extract to ubuntu-8.04…

Drag all of the files you just extracted from the ISO into the empty USB drive.
Move everything from the isolinux folder into the root of the drive. So, if your USB thumbdrive’s letter is F, as in our earlier example, move all the files from F:\isolinux\ into F:\
Rename the isolinux.cfg file to syslinux.cfg
Eject the drive, insert into the computer you wish to install Ubuntu onto, and boot!


Free Airtel 3G : Working Proxy


Working proxys for Airtel free 3g :-

Home Page :fb.me
Proxy:interrobangpath.org
Port :80

Home Page: fb.me
Proxy: 176.9.126.177
Port: 80

homepage=http://fb.me
proxy=anobrowse.com
port=80

Apn: airtelgprs.com
Port: 80
Proxy: 174.142.196.230
(or)
Apn : airtelgprs.com
Port - 80
Proxy - 69.162.137.227
Homepage : fb.me or live.airtelworld.com
( or )
85.214.50.141
or
66.90.76.90 (Old but working fast)
or
176.31.222.34 (Old but working)
Homepage:  fb.me or any free site.

Facebook, YouTube and Many more Now With Free Airtel 3G


1. First Activate 3G and Balance should be less than 5.
2.change proxy settings in Firefox:
Proxy:  208.77.23.4
Port : 80
3. Change Home Page to : http://fb.me/index.php
4. open home page and Enter any URL in that page only.

Free Internet on Airtel 3G

  1. First Activate 3G and Balance should be less than 5.
  2. Change proxy settings in Firefox:
    Proxy: 150.161.2.9
    Port : 80
  3. Change Home Page to :  http;//59.160.229.40/~mgr/proxy.php
  4. Open home page and Enter any URL in that page only.

Tuesday, 16 October 2012

Sliding Window Protocols using C



#include<fstream.h>
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<process.h>
void receiver(char a,int& flag)
{

fstream fil;
fil.open("Z:\write.txt",ios::in|ios::app);
cout<<"\nThe receive bit is :"<<a;
fil<<a;
flag=1;
fil.close();
getch();

}
void sender()
{
int flag=0;
fstream f;
f.open("Z:\send.txt",ios::in|ios::app);
char a=1;
while(!f.eof())
{
     f>>a;
     cout<<"\nsending bit is:";
     cout<<a;
     receiver(a,flag);
     if(flag==0)
     {
getch();
exit(0);
     }
     cout<<"\nacknowledgement complete NEXT BIT :\n";
     flag=0;
}
}
void main()
{
clrscr();
remove("Z:\CN\write.txt");
sender();
getch();
}

/* OUTPUT:
sending bit is:G
The receive bit is :G
acknowledgement complete NEXT BIT :

sending bit is:O
The receive bit is :O
acknowledgement complete NEXT BIT :

sending bit is:O
The receive bit is :O
acknowledgement complete NEXT BIT :

sending bit is:D
The receive bit is :D
acknowledgement complete NEXT BIT :

sending bit is:M
The receive bit is :M
acknowledgement complete NEXT BIT :

sending bit is:O
The receive bit is :O
acknowledgement complete NEXT BIT :

sending bit is:R
The receive bit is :R
acknowledgement complete NEXT BIT :

sending bit is:I
The receive bit is :I
acknowledgement complete NEXT BIT :

sending bit is:N
The receive bit is :N
acknowledgement complete NEXT BIT :

sending bit is:G
The receive bit is :G
acknowledgement complete NEXT BIT :

*/
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             

Socket Programming in C

Client :-


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>

#define PORT 3400 // the port client will be connecting to

#define MAXDATASIZE 100 // max number of bytes we can get at once

int main(int argc, char *argv[])
{
    int sockfd, numbytes;
    char buf[MAXDATASIZE];
    struct hostent *he;
    struct sockaddr_in their_addr; // connector's address information

    if (argc != 2) {
        fprintf(stderr,"usage: client hostname\n");
        exit(1);
    }

    if ((he=gethostbyname(argv[1])) == NULL) {  // get the host info
        perror("gethostbyname");
        exit(1);
    }

    if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
        perror("socket");
        exit(1);
    }

    their_addr.sin_family = AF_INET;    // host byte order
    their_addr.sin_port = htons(PORT);  // short, network byte order
    their_addr.sin_addr = *((struct in_addr *)he->h_addr);
    memset(&(their_addr.sin_zero), '\0', 8);  // zero the rest of the struct

    if (connect(sockfd, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1) {
        perror("connect");
        exit(1);
    }

    if ((numbytes=recv(sockfd, buf, MAXDATASIZE-1, 0)) == -1) {
        perror("recv");
        exit(1);
    }

    buf[numbytes] = '\0';

    printf("Received: %s",buf);

    close(sockfd);

    return 0;
}

Server :-


/*erver.c -- a stream socket server demo
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include <signal.h>

#define MYPORT 3400    // the port users will be connecting to

#define BACKLOG 10     // how many pending connections queue will hold

/*void sigchld_handler(int s)
{
    while(waitpid(-1, NULL, WNOHANG) > 0);
}*/

int main(void)
{
    int sockfd, new_fd;  // listen on sock_fd, new connection on new_fd
    struct sockaddr_in my_addr;    // my address information
    struct sockaddr_in their_addr; // connector's address information
    socklen_t sin_size;
    struct sigaction sa;
    int yes=1;

    if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
        perror("socket");
        exit(1);
    }

  /*  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) {
        perror("setsockopt");
        exit(1);
    }*/

    my_addr.sin_family = AF_INET;         // host byte order
    my_addr.sin_port = htons(MYPORT);     // short, network byte order
    my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP
    memset(&(my_addr.sin_zero), '\0', 8); // zero the rest of the struct

    if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1) {
        perror("bind");
        exit(1);
    }

    if (listen(sockfd, BACKLOG) == -1) {
        perror("listen");
        exit(1);
    }

    /*sa.sa_handler = sigchld_handler; // reap all dead processes
    sigemptyset(&sa.sa_mask);
    sa.sa_flags = SA_RESTART;
    if (sigaction(SIGCHLD, &sa, NULL) == -1) {
        perror("sigaction");
        exit(1);
    }
*/
    while(1) {  // main accept() loop
        sin_size = sizeof(struct sockaddr_in);
        if ((new_fd = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size)) == -1) {
            perror("accept");
            continue;
        }
        printf("server: got connection from %s\n",inet_ntoa(their_addr.sin_addr));
      /*  if (!fork()) { // this is the child process
            close(sockfd); // child doesn't need the listener*/
            if (send(new_fd, "Hello, world!\n", 14, 0) == -1)
                perror("send");
            close(new_fd);
            exit(0);
        //}
        close(new_fd);  // parent doesn't need this
    }

    return 0;
}



LEACH in NS2 using Mannasim Frame-work

The code in the editor below shows how to simulate LEACH protocol
using MannaSim patch with ns2. A summary of the simulation settings is
given below:

Area: 500 m X 500m
Duration: 550 sec
# of nodes: 11
# of clusters: 4
New cluster formation interval: 100 sec (fixed)
Initial energy: 10 joules
Disseminating interval: 10 sec
Transmission range: 50 m
Channel type: Wireless
Transport protocol: UDP
Layer: Physical
Antenna: OmniAntenna
Radio Propagation:TwoRayGround
Sensing interval: 5 sec
Data generator type: Temperature
Sensing type: Programmed

The no. of access points has been set to be 0 for our simulation and
all the nodes are static.

The ratio P that has been referred to while describing LEACH in the
theory section is obtained in our case as k/N, where k is the # of
desired cluster heads, and N is the total # of nodes in the network.

Now, answer the following and verify them from the simulation results:

For the given simulation time, how many rounds of cluster formation take place?
What is the number of cluster heads per round?
Does the average number of cluster heads per round equal the desired
number of cluster heads (line #475)? (See the discussion on LEACH in
Theory section)
Vary the number of nodes (line #474) and expected number of cluster
heads (line #475), and once again verify the output


# Generated by MannaSim


puts "Initializing MannaSim Script..."

#Consumo de energia do sensor node - Dados do Mica Motes
set mica(sensing_power) 0.015 ;# i = 5mA, V = 3 --> P = ixV = 15 mW = 0.015 W
set mica(processing_power) 0.024 ;# i = 8mA, V = 3 --> P = ixV = 24 mW = 0.024 W
set mica(instructions_per_second) 8000000 ;# Atmel 128L 8MHZ --> 8MIPS

#Consumo de energia do sensor node - Dados do WINS
set wins(sensing_power) 0.064 ;# 64 mW = 0.064 W
set wins(processing_power) 0.360 ;# 360 mW = 0.360 W
set wins(instructions_per_second) 150000000 ;# Intel StrongArm 1100 133 MHZ --> 150 MIPS

#Seta valores para consumo de energia com o radio
set mica(consumo_transmissao) 0.036 ;#i = 12mA, V = 3 --> P = ixV = 36mW = 0.036W
set mica(consumo_recepcao) 0.024 ;#i = 8mA, V = 3 --> P = ixV = 24mW = 0.024W

set wins(consumo_transmissao)   3.75 ;# 3.75 250m, 0.6 600 mW - 100m
set wins(consumo_recepcao) 1.875 ;# 1.875 250m,  0.3 300 mW

#seta a taxa de transmissao
#Phy/WirelessPhy set  bandwidth_
set mica(taxa_transmissao) 28.8*10e3 ;#28.8 kbps
set wins(taxa_transmissao) 100*10e3 ;#100 kbps

proc setup_mica2 { antenna range }  {
        puts "Setting up mica 2 mote with $antenna and range = $range"      

        Phy/WirelessPhy set Pt_ 0.281838
        Phy/WirelessPhy set freq_ 2.4e09
        Phy/WirelessPhy set L_ 1.0
        Phy/WirelessPhy set lambda_ 0.125
        Phy/WirelessPhy set RXThresh_ [TwoRay 0.281838 [$antenna set Gt_] [$antenna set Gr_] 0.8 0.8 1.0 $range 0.125]
        Phy/WirelessPhy set bandwidth_ 28.8*10e3        ;#28.8 kbps

        Node/MobileNode/SensorNode set sensingPower_ 0.015
        Node/MobileNode/SensorNode set processingPower 0.024
        Node/MobileNode/SensorNode set instructionsPerSecond_ 8000000

}

##########################################
# CONSTANTES
#########################################
# Continuo: 0
# Programada: 1
# Sob Demanda: 2
########################################

proc create_common_app {destination_id disseminating_type disseminating_interval} {
    global val
    #puts "executing create_common_app\n"
    if { $val(commonApp) == "Application/SensorBaseApp/CommonNodeApp/LeachApp" } {
          if { $val(n_ch) == 0 } {
                   puts "NO CLUSTER HEADS HAS BEEN DEFINED! Assuming 20% of common nodes."
                   set val(n_ch) [expr int($val(n_common) * 2 / 10)]
          }
          #puts "Debug: val(n_ch): $val(n_ch)\n";
          set app_ [new $val(commonApp) $val(nn) $val(n_ch) [expr sqrt($val(x) * $val(x) + $val(y) * $val(y))]]
    } else {
          set app_ [new $val(commonApp)]
          $app_ set destination_id_ $destination_id
    }
    $app_ set disseminating_type_ $disseminating_type
    $app_ set disseminating_interval_ $disseminating_interval
    return $app_
}

set val(commonApp) "Application/SensorBaseApp/CommonNodeApp"
set val(chApp)     "Application/SensorBaseApp/ClusterHeadApp"
set val(apApp)     "Application/AccessPointApp"

proc create_cluster_head_app {destination_id disseminating_type disseminating_interval} {
    global val
    set app_ [new $val(chApp)]
    $app_ set destination_id_ $destination_id
    $app_ set disseminating_type_ $disseminating_type
    $app_ set disseminating_interval_ $disseminating_interval
    return $app_
}

proc create_access_point_app {outside_network} {
    global val
    set app_ [new $val(apApp)]
    $app_ set outside_network_ $outside_network
    return $app_
}

proc create_temp_data_generator {sensing_interval sensing_type avg_measure std_deviation maximumTemperatureAllowedValue} {
    set temp_gen_ [new DataGenerator/TemperatureDataGenerator]
    $temp_gen_ set sensing_interval_ $sensing_interval
    $temp_gen_ set sensing_type_ $sensing_type
    $temp_gen_ set avg_measure $avg_measure
    $temp_gen_ set std_deviation $std_deviation
    $temp_gen_ set maximumTemperatureAllowedValue_ $maximumTemperatureAllowedValue
    return $temp_gen_
}

proc create_data_generator {generator sensing_interval sensing_type avg_measure std_deviation maximumTemperatureAllowedValue} {
    set temp_gen_ [new DataGenerator/$generator]
    $temp_gen_ set sensing_interval_ $sensing_interval

    if {$sensing_type=="continuous"} {
          $temp_gen_ set sensing_type_ 0
    } elseif {$sensing_type=="programmed"} {
          $temp_gen_ set sensing_type_ 1
    } elseif {$sensing_type=="on demand"} {
          $temp_gen_ set sensing_type_ 2
    } else {          
          $temp_gen_ set sensing_type_ $sensing_type
    }
    $temp_gen_ set avg_measure $avg_measure
    $temp_gen_ set std_deviation $std_deviation
    $temp_gen_ set maximumTemperatureAllowedValue_ $maximumTemperatureAllowedValue
    return $temp_gen_
}

proc create_common_node { iniEnergy x y z father_addr start stop } {
    global val ns_ node_ topo udp_ app_ gen_ contador_nodos rng trace

    if { [llength $start] == 0 }  {
            set start [expr $val(start) + [$rng uniform 0 1]]
            set stop $val(stop)
    }

    $ns_ node-config -sensorNode ON \
        -adhocRouting $val(rp) \
        -llType $val(ll) \
        -macType $val(mac) \
        -ifqType $val(ifq) \
        -ifqLen $val(ifqlen) \
        -antType $val(antenna) \
        -propType $val(prop) \
        -energyModel $val(en) \
        -phyType $val(netif) \
        -channelType $val(chan) \
        -topoInstance $topo \
        -agentTrace $trace(agent) \
        -routerTrace $trace(router) \
        -macTrace $trace(mac) \
        -rxPower 0.024 \
        -txPower 0.036 \
        -initialEnergy $iniEnergy \
        -movementTrace $trace(movement)

        set node_($contador_nodos) [$ns_ node]
        $node_($contador_nodos) random-motion 0

        $node_($contador_nodos) set X_ $x
        $node_($contador_nodos) set Y_ $y
        $node_($contador_nodos) set Z_ $z

        puts "* Node [$node_($contador_nodos) node-addr] = $contador_nodos created in ($x, $y, $z)"

        set app_($contador_nodos) [create_common_app $father_addr $val(disseminating_type) $val(disseminating_interval)]

        if { $val(leach) == 1 } {
              set agent [new Agent/RCAgent]

              $agent set sport_ 0
              $agent set dport_ 0

              $node_($contador_nodos) attach $agent 0
              $app_($contador_nodos) attach-agent $agent

              $agent add-ll [$node_($contador_nodos) set ll_(0)] [$node_($contador_nodos) set mac_(0)]
        } else {
                set udp_($contador_nodos) [new Agent/UDP]
                $node_($contador_nodos) attach $udp_($contador_nodos) $val(port)
        }
        $node_($contador_nodos) add-app $app_($contador_nodos)

        set processing_($contador_nodos) [new $val(processing)]

        $app_($contador_nodos) node $node_($contador_nodos)

        if { $val(leach) != 1 } {
                $app_($contador_nodos) attach-agent $udp_($contador_nodos)
        }

        $app_($contador_nodos) attach-processing $processing_($contador_nodos)
        $processing_($contador_nodos) node $node_($contador_nodos)

        for { set i 0 } { $i < [llength $start] } { incr i } {
                $ns_ at $start "$app_($contador_nodos) start"
        }

        for { set i 0 } { $i < [llength $stop] } { incr i } {
                $ns_ at $stop "$app_($contador_nodos) stop"
        }

        #[create_temp_data_generator  5.0 0 27.0 10.0 50]
        set gen_($contador_nodos) $val(data_generator)

        $app_($contador_nodos) attach_data_generator $gen_($contador_nodos)

        incr contador_nodos

}

proc create_cluster_head_node { iniEnergy x y z father_addr start stop } {

        global val ns_ node_ topo udp_ app_ gen_ contador_nodos rng trace

        if { [llength $start] == 0 }  {
                set start [expr $val(start) + [$rng uniform 0 1]]
                set stop $val(stop)
        }

        $ns_ node-config -sensorNode ON \
            -adhocRouting $val(rp) \
            -llType $val(ll) \
            -macType $val(mac) \
            -ifqType $val(ifq) \
            -ifqLen $val(ifqlen) \
            -antType $val(antenna) \
            -propType $val(prop) \
            -energyModel $val(en) \
            -phyType $val(netif) \
            -channelType $val(chan) \
            -topoInstance $topo \
             -agentTrace $trace(agent) \
            -routerTrace $trace(router) \
            -macTrace $trace(mac) \
            -rxPower 0.024 \
            -txPower 0.036 \
            -initialEnergy $iniEnergy \
            -movementTrace $trace(movement)

        #puts "Debug Cluster head iniEnergy: $iniEnergy\n";

        set node_($contador_nodos) [$ns_ node]
        $node_($contador_nodos) random-motion 0


        $node_($contador_nodos) set X_ $x
        $node_($contador_nodos) set Y_ $y
        $node_($contador_nodos) set Z_ $z

        puts "* Cluster head [$node_($contador_nodos) node-addr] = $contador_nodos created in ($x, $y, $z)"

        set udp_($contador_nodos) [new Agent/UDP]
        set app_($contador_nodos) [create_cluster_head_app $father_addr $val(disseminating_type) $val(disseminating_interval)]

        $node_($contador_nodos) attach $udp_($contador_nodos) $val(port)
        $node_($contador_nodos) add-app $app_($contador_nodos)

#CN#        set processing_($contador_nodos) [new $val(processing)]

        $app_($contador_nodos) node $node_($contador_nodos)
        $app_($contador_nodos) attach-agent $udp_($contador_nodos)

#CN#        $app_($contador_nodos) attach-processing $processing_($contador_nodos)
        $processing_($contador_nodos) node $node_($contador_nodos)

        for { set i 0 } { $i < [llength $start] } { incr i } {
                $ns_ at $start "$app_($contador_nodos) start"
        }

        for { set i 0 } { $i < [llength $stop] } { incr i } {
                $ns_ at $stop "$app_($contador_nodos) stop"
        }

#CN#        set gen_($contador_nodos) $val(data_generator)
#CN#        $app_($contador_nodos) attach_data_generator $gen_($contador_nodos)

        incr contador_nodos

}

proc create_access_point { iniEnergy x y z start stop} {
        global ns_ val node_ app_ udp_ contador_nodos topo trace rng

        if { [llength $start] == 0 }  {
                set start [expr $val(start) + [$rng uniform 0 1]]
                set stop $val(stop)
        }

        $ns_ node-config -sensorNode ON \
            -adhocRouting $val(rp) \
            -llType $val(ll) \
            -macType $val(mac) \
            -ifqType $val(ifq) \
            -ifqLen $val(ifqlen) \
            -antType $val(antenna) \
            -propType $val(prop) \
            -energyModel $val(en) \
            -phyType $val(netif) \
            -channelType $val(chan) \
            -topoInstance $topo \
             -agentTrace $trace(agent) \
            -routerTrace $trace(router) \
            -macTrace $trace(mac) \
            -rxPower 0.5 \
            -txPower 0.5 \
            -initialEnergy $iniEnergy \
            -movementTrace $trace(movement)

        #puts "Debug AP iniEnergy: $iniEnergy\n";

        set node_($contador_nodos) [$ns_ node]
        $node_($contador_nodos) random-motion 0
        set app_($contador_nodos) [create_access_point_app [$node_(0) node-addr]]

        if { $val(leach) == 1 } {
              set agent [new Agent/RCAgent/LeachAgent]

              $agent set sport_ 0
              $agent set dport_ 0

              $node_($contador_nodos) attach $agent 0
              $app_($contador_nodos) attach-agent $agent

              $agent add-ll [$node_($contador_nodos) set ll_(0)] [$node_($contador_nodos) set mac_(0)]
        } else {
              set  udp_($contador_nodos) [new Agent/UDP]
              $node_($contador_nodos) attach $udp_($contador_nodos) $val(port)
              $app_($contador_nodos) attach-agent $udp_($contador_nodos)
        }
        $node_($contador_nodos) set X_ $x
        $node_($contador_nodos) set Y_ $y
        $node_($contador_nodos) set Z_ $z

        puts "* Access point [$node_($contador_nodos) node-addr] = $contador_nodos created in ($x, $y, $z)"

        for { set i 0 } { $i < [llength $start] } { incr i } {
                $ns_ at $start "$app_($contador_nodos) start"
        }

        for { set i 0 } { $i < [llength $stop] } { incr i } {
                $ns_ at $stop "$app_($contador_nodos) stop"
        }

        incr contador_nodos

}

###
# Grid distribution.

proc get_next_x {} {

        global val
        set aux [expr int(sqrt($val(nn)))]
        return [expr (($contador_nodos) % $aux) * $val(x) / ($aux - 1)]

}

proc get_next_y {} {

        global val
        set aux [expr int(sqrt($val(nn)))]
        return [expr (($contador_nodos) / $aux) * $val(y) / ($aux - 1)]

}

####
# Calculating the receiving threshold (RXThresh_ for Phy/Wireless)
# Wei Ye, weiye@isi.edu, 2000

proc Friis { Pt Gt Gr lambda L d} {
  set M [expr $lambda / (4 * 3.14159265359 * $d)]
  return [expr ($Pt * $Gt * $Gr * ($M * $M)) / $L]
}

proc TwoRay { Pt Gt Gr ht hr L d lambda } {
        set crossover_dist [expr (4 * 3.14159265359 * $ht * $hr) / $lambda]

        if { $d < $crossover_dist } {
                return [Friis $Pt $Gt $Gr $lambda $L $d]
        } else {
                return [expr $Pt * $Gt * $Gr * ($hr * $hr * $ht * $ht) / ($d * $d * $d * $d * $L)]
       }
}

###

proc set_default_settings {} {

        global val

        ####
        # Default network settings
        set val(antenna) "Antenna/OmniAntenna"
        Antenna/OmniAntenna set X_ 0 ;
        Antenna/OmniAntenna set Y_ 0 ;
        Antenna/OmniAntenna set Z_ 1.5 ;
        Antenna/OmniAntenna set Gt_ 1.0 ;
        Antenna/OmniAntenna set Gr_ 1.0 ;

        ###

        # Using Mica 2 Mote settings


        set val(range) 100
        setup_mica2 $val(antenna) $val(range)
        set val(bandwidth) [Phy/WirelessPhy set bandwidth_]
        set val(mac)    Mac/802_11
        set val(ifq)    Queue/DropTail
        set val(ifqlen) 200
        set val(ll) LL
        set val(rp) "LEACH"


        # Configuration adjustment

        if { $val(rp) == "LEACH" } {

                set val(rp) DumbAgent
                set val(leach) 1

                if { $val(ll) != "RCALinkLayer" } {
                        puts "LEACH requires RCALinkLayer! Forcing it!!!"                   
                        set val(ll) RCALinkLayer
                }

                if { $val(netif) != "Phy/WirelessPhy/LeachWirelessPhy" } {
                        puts "LEACH requires LeachWirelessPhy! Forcing it!!!"
                        set val(netif) Phy/WirelessPhy/LeachWirelessPhy
                }

                if { $val(mac) != "Mac/Sensor" } {
                        puts "LEACH requires Mac/Sensor! Forcing it!!!"
                        set val(mac) Mac/Sensor
                }

                set val(port) 0

                Agent/RCAgent set sport_           $val(port)
                Agent/RCAgent set dport_           $val(port)
                Agent/RCAgent set packetMsg_       0
                Agent/RCAgent set distEst_         0
                Agent/RCAgent set packetSize_      0

                RCALinkLayer set delay_            25us
                RCALinkLayer set bandwidth_        [Phy/WirelessPhy set bandwidth_]
                RCALinkLayer set off_prune_        0
                RCALinkLayer set off_CtrMcast_     0
                RCALinkLayer set macDA_            0
                RCALinkLayer set debug_            0
        } else {
                set val(leach) 0
        }
        if { $val(rp) == "DIRECTED DIFFUSION" } {
                set val(rp) "Directed_Diffusion"
        }       
}

set val(father_addr) 0 
set val(port)   2020

set val(netif)  Phy/WirelessPhy

set_default_settings

# Global network settings
set contador_nodos 0
set val(chan)   Channel/WirelessChannel

# Propagation
set val(prop)   Propagation/TwoRayGround

# Energy model
set val(en) EnergyModel/Battery

# Nodes
set val(n_pas)  0
set val(n_common) 11
set val(n_ch) 4
set val(nn) [expr $val(n_pas) + $val(n_common) + $val(n_ch)]

puts "\nNodes count:"
puts " - $val(n_pas) access points"
puts " - $val(n_common) common nodes"
puts " - $val(n_ch) cluster heads"
puts " - $val(nn) nodes"
puts " - $val(rp) routing protocol"
puts " - $val(ll) link layer"
puts " - $val(netif) network interface"

# Scenario size
set val(x)  500.0
set val(y)  500.0

puts "\nScenario size: $val(x) x $val(y)"

set val(start)  0.0
set val(stop)   [expr $val(start) + 550.0]

set ns_     [new Simulator]


# Trace
puts "\nUsing trace.tr as trace file"
set traceFile   [open trace.tr w]
$ns_ trace-all $traceFile
$ns_ use-newtrace

set trace(mac) ON
set trace(router) ON
set trace(agent) ON
set trace(movement) ON


set topo    [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
set rng [new RNG]
$rng seed [clock seconds]

#-------------------------------------------------------------------------------------------



# Creating an access point
puts "Creating an access point..."

set_default_settings


# Using Mica 2 Mote settings

puts "Using mica 2 mote settings"
set val(range) 100
setup_mica2 $val(antenna) $val(range)
set local(x) 50.0
set local(y) 50.0
set local(z) 0.0
set local(start) ""
set local(stop) ""
set local(energy) 100.0
set val(apApp) Application/AccessPointApp/AccessPointLeachApp

create_access_point $local(energy) $local(x) $local(y) $local(z) $local(start) $local(stop)



# Creating common node
puts "Creating common node..."

set_default_settings


# Using Mica 2 Mote settings
puts "Using mica 2 mote settings"

set val(range) 100
setup_mica2 $val(antenna) $val(range)

# Disseminating settings
set val(disseminating_type) 0       ;# Programmed
puts "Setting disseminating type to programmed"
set val(disseminating_interval) 10.0
puts "Setting disseminating interval: $val(disseminating_interval)"

set local(start) ""
set local(stop) ""
set local(energy) 10.0
set local(father_addr) $val(father_addr)

set val(processing) Processing/AggregateProcessing
set val(data_generator) "[create_data_generator {TemperatureDataGenerator} {5.0} {programmed} {25.0} {5.0} {30.0}]"


for { set common_node_i 0 } { $common_node_i < 10 } { incr common_node_i } {
    set local(x) [$rng uniform 0.0 $val(x)]
    set local(y) [$rng uniform 0.0 $val(y)]
    set local(z) 0.0

    set val(commonApp) Application/SensorBaseApp/CommonNodeApp/LeachApp
    create_common_node $local(energy) $local(x) $local(y) $local(z) $local(father_addr) $local(start) $local(stop)
}


$ns_ at [expr $val(stop)] "flush stdout"
$ns_ at [expr $val(stop)+0.0001] "finish"


proc finish {} {
    global ns_ traceFile namtrace tempoInicio val

    $ns_ flush-trace
    #    close $namtrace
    $ns_ halt
    $ns_ flush-trace
    #$ns_ nam-end-wireless $val(stop)
    close $traceFile
    #close $namtrace
    flush stdout

    exit 0
}

puts "Starting Simulation..."
$ns_ run

How to use a trial program forever without activation


  • RunAsDate is a small utility that allows you to run a program in the date and time that you specify. This utility doesn't change the current system date, but it only injects the date/time that you specify into the desired application.
  • RunAsDate intercepts the kernel API calls that returns the current date and time (GetSystemTime, GetLocalTime, GetSystemTimeAsFileTime), and replaces the current date/time with the date/time that you specify It works with Windows 2000, XP, 2003 and Vista.
  • You have to follow these tips carefully to successfully “hack” a software and make it run in it’s trial mode forever
1. Note down the date and time, when you install the software for the first time.
2. Once the trial period expires, you must always run the software using RunAsDate.
3. After the trial period is expired, do not run the software(program) directly. If you
run the software directly even once, this “hack” may no longer work.
4. It is better and safe to inject the date of the last day in the trial period.
For example, if the trial period expires on jan 30 2009, always inject the date as jan
29 2009 in the RunAsDate.

RunAsDate can be downloaded from here:
http://www.nirsoft.net/utils/run_as_date.html

How to kick someone of a wireless network


Step 1: Open cmd.
Step 2: Write shutdown -i
Step 3: Choose a Victim from the list
Step 4: Choose to shutdown their computer
Step 5: Make the warning pop up 1 sec before shutting down.
Step 6: Click Ok.
Done! :)


How to grab IP address with PHP


I’ll be showing you how to grab somebodies IP address when they visit a page.
The variable to use is $_SERVER['REMOTE_ADDR'] - It’s that simple. You can use it
for just about anything, here are a few examples.
Printing the Users IP Address:
<?php
print ($_SERVER['REMOTE_ADDR'], "I'm Watching You!");
?>
Printing it to a File:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$handle = fopen('ipaddresses.txt'', 'a+);
fwrite($handle, $ip); fwrite($handle, "\n");
fclose($handle);
?>
All you have to do, is to make a text file and insert any of these codes or one of your
own and save it as anythingyouwant.php
Then upload it to your website and it'll do the trick :P
The Possibilities for what you can use this to are endless.
Good luck :D

How to Crack a WEP Encrypted Wireless Network on Windows Vista / 7


First you can only use this method to crack a WEP encrypted network. WEP has been
replaced by WPA encryption which is stronger but can still be cracked, just not as
easily. To find out if the network you want to crack is WEP encryption, simply view
the wireless networks in the Connect to a network box and hold your mouse over the
network of choice. A little box will tell you the encryption. If it say WEP - good we
can proceed, if it says anything else this tutorial wont help.


First to understand what you will be doing. You will be using a program to capture
packets and then use another program to analyze those packets and crack the key,
thus allowing you to have access to their network. To capture packets (data from the
network we are trying to crack) you must have the program running on your computer
and you must capture about 200 000 or more IV packets (a special type of packet). I
will show you how to capture the correct type of packets.
Also ONLY certain types of wireless cards can actually capture wireless packets. In
order to capture packets your wireless card must be able to go into monitor mode,
not every driver or every wireless card supports monitor mode. In most cases you will
have to download a special driver designed for your wireless card to put it into
monitor mode. I had to purchase a new wireless card because mine was not supported.
The program you will be using has a list of supported wireless cards and comes with
the drivers needed (Lucky you)
Ok, down to business. First the program you need to capture packets can be
downloaded from this link http://www.tamos.com/download/main/ca.php
Next the program to analyze the packets and finger out the password can be
downloaded from my own site. I got it to work for windows vista and then zipped it all
into a folder for you. To get this to run all you have to do is extract it, open the
aircrack folder, then open the bin folder, then double click on Aircrack-ng GUI.exe.
Here is the download linkhttp://www.howtovideos.ca/images/aircrackVista.rar just
click it and save the file.

packets. First install the Commview for Wifi program. You do this by extracting the
setup file from the file we downloaded earlier (ca6.zip) Then double click setup.exe
and follow the prompts. When Commview opens for the first time it has a driver
installations guide. This replaces the old driver with a newer, better, and more
improved version! Hooray. Follow the prompts to install your new driver and now we
are ready to capture. If everything has gone as planned when you open Commview for
Wifi the little play button in the top left corner will be blue. If it is not blue the
driver has not been installed properly. Moving on…
Click the blue button in the top left corner and then click Start Scanning. Commview
for Wifi now starts scanning each channel looking for data that is being sent. It will
list each network it finds. Now click each host until you find the name of the network
key you are trying to find. Now select the appropriate channel (my network is
broadcasting on channel 6 so I will start capturing all data on channel 6) Click
capture.
Commview for Wifi is now capturing all the packets being sent over channel 6. Once
Commview for Wifi collects enough packets aircrack can analyze them and crack the
wireless key. The thing is, you only need certain packets, and if you collect too many
unneeded packets aircrack may get confused. To help make things easier follow the
next few steps.
First of all we only want packets from one host, not all of them. As you can see from
my screenshot below I am collecting packets from 7 different network. (see
screenshot below)A few are WPA encrypted so they and a few are WEP. I really only
want to collect data being sent from one network, so in order to do this all you have
to do is right click on the wireless network you want to crack and select copy mac
address.
Now click on the rules tab. On the left side under simple rules click MAC Addresses.
For action select Capture, and for Add Record select both. Now click inside the entry
form box and hit ctrl+v (to paste the mac address) or right click and select paste.
Now hit add MAC Address.
What we just did is make a rule so that Commview for Wifi will only capture packets
coming from a certain MAC Address (the one we want) Great almost done.
Now to make things even easier for Aircrack you only want to capture DATA packets.
There are 3 types to select from Management packets, Data Packets and Control
Packets. We only want Data packets because that is where the information is that
Aircrack needs to crack the wireless encryption passkey. Simply select the D, and
unselect the M and the C.
Now Commview for Wifi is only capturing Data Packets. To be more specific
Commview for Wifi is only capturing Data Packets to and from a specific MAC
address. Now that everything is set up to capture the right types of packets we
should start saving the logs.
You have to save all of the packets into a log for Aircrack to analyze them. You can
set Commview for Wifi to save them automatically, or just save them yourself
periodically. It is a good idea to have them auto save because it splits them into nicely
sized logs, and if you accidentally close Commview for Wifi they will save and you
wont lose all your packets! To do that just go to the logging tab and enable auto
saving. You can change the settings if you would like (I recommend increasing the
maximum directory size to something like 100000).
And now we wait… We have to capture over 15000 IV packets. Because we set up
some rules most of the packets we capture will be IV packets (these are a certain
type of Data packet with information used to crack the wireless key). It took me
about 4 days to capture enough packets, but I was not running Commview for Wifi non
stop. If you are close to the network and there is heavy traffic, it may only take you
a few hours. Ok what do you do now?
Alright, so now 20000 packets (or more) later we are ready to crack the WEP
wireless key. First lets converts all of the log files to .cap format (shown in
screenshot below) When I cracked my first WEP key with this method I had 4 log
files and about 220 000 packets.Go to wherever you have your log files saved and
double click to open it. Now click on file -> Export Logs -> Tcpdump Format
Save it as 1.cap do the rest of your logs, saving them in sequential order 1.cap, 2.cap,
3.cap etc.
Now that you have all of your log files saved in .cap format lets open Aircrack. Open
the aircrack folder (wherever you extracted it) then open the Bin folder, now double
click Aircrack-ng GUI.exe. Aircrack will open, click the choose button and navigate to
where you have your log files saved. To select all of your log files ( saved in .cap
format) Hold down CTRL and click each file, Then hit open.
Now click launch, Aircrack shows you all of the different BSSID’s that it captured
data from and assigns an index number to each one, then it asks you Index number of
target network? You want to enter the number of the network you want to crack.
Mine is called CrackMePlease so I am selecting 15.
Enter the index number and then press enter, if you have enough IV’s then it should
give you the WEP key. If not go back and capture more and try again.
That’s all


Crack A Router For Username and Password


(I will be using Brutus to crack a D-Link route.)
1.When we want to access our router,it will be password protected.We can try the
default username and password.


As you can see,it is password protected.
2.I will open up my Brutus.




3.Configure Brutus.Put the target as the router's IP address.Put in the userlist and
the passlist.After everything is OK,press on START.


As you can see from the picture above, Brutus is cracking the router.
4.Wait for Brutus to finish cracking the router.You will get this result.




You can see that i have get my username and password for the router.
5.Go to the page and type in the username and password.






How To Close Ports on Your PC


This'll only work for windows users (unless your unix version OS has netsh).
it's actually quite simple. here's the command for it:

" netsh firewall delete portopening TCP portnumber "


i wrote it all out in a vbs script for you so that it's
automatically run-able. as well as a batch script. so here you are fellas:

.VBS Script

set ss = createobject("wscript.shell")
set ws = wscript
dim PORT
PORT = InputBox("Enter the port you wish to close:")
ss.run "netsh.exe"
ws.sleep 1000
ss.sendkeys "firewall delete portopening TCP " & PORT
ss.sendkeys "{enter}"
ws.sleep 500
'ss.sendkeys "exit"
'ss.sendkeys "{enter}"

.BAT Script

@echo off
title Port Closer
echo Port Closer
echo.
set /p port=Type the port number you wish to close here:
netsh firewall delete portopening TCP %port%
msg /w * Port %port% has been closed.
exit

Sunday, 23 September 2012

Free GPRS/3G for TATA DOCOMO

Account Name : docomo divein
APN: = TATA.DOCOMO.DIVE.IN
Proxy address:10.124.94.7
port :8080
Data bearer : GPRS/ Packet Data

Free BSNL 3G Internet


Service Type : WAP
Gateway IP : 1 10.100.3.2
Port no  : 9209.
Timeout: Never

APN setting :
wapwest.cellone.in

it's working in some states.....

Balance Transfer in Vodafone,BSNL,Idea,etc..


BSNL :-

Just Type the Sms as GIFT MOBILE NO AMOUNT and send it to 53733.
Ex ;- Type GIFT 9408730260 55 and send it to 53733 .
55 Rupees of Balance is Transferred.
 This trick  is useful to transfer/exchange balance between your friends.

Vodafone :=

Dial *131*AMOUNT*MOBILE NO#. 
E.x:- *131*50*9408730260# 
UNINOR:-

To Transfer Balance In Uninor Just Dial *202*MobileNumber*Amount#.
E.g. *202*9408730260*30# To Transfer 30 Rupees.

How to change your folders background


  • Have the Folder you want to put the background on open!
  • Open up Notepad, then simply paste in this code: 
[{BE098140-A513-11D0-A3A4-00C04FD706EC}]
iconarea_image=***Picture Location Here!***\***Name of File!***
  • Go to your picture (the picture you want to use!) and right click and select properties and find the file location & copy the location!
  • Now go back to ur text document (notepad) and where it says ***Picture Location Here!*** paste the location...u copied in the previous step!
  • Now after u've done that where it says ***Name of File!*** type the name of the file including the .jpg .bmp .bip. jpeg etc
  • Save the text document as "desktop.ini" be sure to remember the .ini extension! click Save as "All Files" not "Text Document" and save the document in the folder where u want the background to be!
  • Now just close the folder and open it again it should show the picture as a background!

Saturday, 25 August 2012

Trace File Format in NS2

In the previous post, I showed you how to create a “trace file” in NS2. In this post, I will show you the interpretation of an NS2 trace file.

Example of trace files :-

When using trace-all in NS2, a trace string is created in a trace file. The trace file would look like this.


Trace file format :-

The format of a trace string is shown below:




where 12 fields of the trace string are as follows.

1. Type Identifier:

 • “+”: a packet enque event
 • “-”: a packet deque event
 • “r”: a packet reception event
 • “d”: a packet drop (e.g., sent to dropHead_) event
 • “c”: a packet collision at the MAC level

2. Time: at which the packet tracing string is created .

3-4. Source Node and Destination Node: denote the IDs of the source and the destination nodes of the tracing object.

5. Packet Name: Name of the packet type

6. Packet Size: Size of the packet in bytes.

7. Flags: A 7-digit flag string

 • “-”: disable
 • 1st = “E”: ECN (Explicit Congestion Notification) echo is enabled.
 • 2nd = “P”: the priority in the IP header is enabled.
 • 3rd : Not in use
 • 4th = “A”: Congestion action
 • 5th = “E”: Congestion has occurred.
 • 6th = “F”: The TCP fast start is used.
 • 7th = “N”: Explicit Congestion Notification (ECN) is on.

8. Flow ID

9-10. Source Address and Destination Address: the format of these two fields is “a.b”, where “a” is the address and “b” is the port.


11. Sequence Number

12. Packet Unique ID

Post processing NS2 Result using NS2 Trace

In this post, I will show you a simple (and perhaps the most common way) to create an NS2 trace file. This trace file contains a lot of information. In fact, it contains too much information, which intimidates NS2 users. Don’t worry about it. We will try to interpret NS2 trace files later. For now, let’s focus on how an NS2 trace file can be created.

To create a trace file, you need to do the following two steps:
  1. Create a file to record tracing information.
  2. Record the tracing information to the created file.
Create a File for Writing :-

Tcl uses a command “open” to open a file. The syntax of the command “open” is as follows:
open <filename> <purpose>
where <filename> is the name of the file to be opened, and <purpose> can be
“w” for writing,
“r” for reading, or
“a” for appending
This statement returns a file handle, which can be used to refer to the opened file.
An example of a Tcl statement which opens a file whose name is “tracefile.tr” for writing and stores to the file handle in the variable $var is shown below:
set var [ open tracefile.tr w ]

Record tracing information in the opened trace file :-

The next step is to record trace information in the opened file. This can be achieved using the following Tcl statement:

$ns trace-all $var

where $ns is the Simulator instance, and $var is the file handle. This statement tells all the tracing objects (e.g., enqT_, deqT_, rcvT_, and drpT_ in the SimpleLink object below) to record information of traversing packets in the trace file whose variable is $var.

There is only one requirement for tracing: The above statement must be located prior to “$ns run”.

After the simulation complete, a trace file would be created. Here is an example of trace files.



The statement “$ns trace-all” inserts tracing object into various places in network topology. The most common place is in a SimpleLink usually used to connect two nodes. The statement “$ns trace-all” inserts few tracing objects into the SimpleLink object as shown above.

A tracing object sits between two NsObject intercepting objects. Once receiving a packet, it prints related tracing information as a line into the trace file. In the above figure, we have four tracing objects:

  • enqT_: Print a line beginning with “+”, indicating an enqueuing event
  • deqT_: Print a line beginning with “-”, indicating a dequeuing event
  • rcvT_: Print a line beginning with “r”, indicating a packet reception event
  • drpT_: Print a line beginning with “d”, indicating a packet dropping event
Tracing Statements in the Trace File:

These tracing objects print information of all traversing packets. Information of packets which do not pass through any of these objects would not appear on the trace file.

The only object responsible for dropping packets in the above figure is queue_. It does so by invoking function drop(p). The function drop(p) in turn sends the packet p to the forwarding NsObject, which in this case is drpT_. It is drpT_, who is responsible for printing dropping information statements (i.e., those begin with ‘d’) in the trace file.

This means that if you drop the packet explicitly (e.g., using drop(p)) without passing the packet through drpT_, no information about dropping packet would appear on the trace file.

IP Routing in NS2



I know. I know. IP is “the most” widely used routing in the computer industry. But, we as people in academic need to be a bit more precise when using buzz words.

IP: refers to IP address. It is different from routing mechanism. IP address is just a hierarchical way of defining an endpoint.
Routing mechanism: is a way of determining the route to get to a given destination. It works according to an underlying routing table.
Routing algorithm: computes a routing table.
Routing protocol: is a set of communication rules, which shall be followed under a certain condition such as a route failure.

Here is a example set of parameters in practice:

Addressing = IP Address
Routing mechanism = Routing table; Route Summary
Routing algorithm = Dijkstra
Routing protocol = OSPF

What about NS2?

By default, NS2 uses the following setting

Addressing = Flat address (1,2,3,…)
Routing mechanism = Address classifiers
Routing algorithm = Dijkstra
Routing protocol = Static (The condition of all the nodes does not change throughout the simulation)

Do You Really Need IP?

I have received quite a few questions like “How do I implement IP in NS2?” My first response would be “this is too vague”. You really have to break down your questions. At least, you have to identify which of the above 4 topics you would like to study.

For example, if you would like to study routing protocols, you’d probably refer to OSPF or BGP routing protocols. If your focus is on the communiation protocols of the routing, you can use the following setting

Addressing: Flat
Routing Mechansism: Classifier
Routing Algrithm: Dijkstra (used by default as a part of OSPF)

which are the default setting of NS2.

Routing in NS2

The default routing protocol of NS2 is static routing. This means that there would be no change in topology throughout the simulation. In this case, NS2 configures the routing information once when the simulation start with the OTcl statement “$ns run”. The process proceeds as follows:

Step 1: [OTcl] Simulator::run
Step 2: [OTcl] Routelogic::configure
Step 3: [OTcl] Agent/rtProto/Static::init-all
Step 4: [OTcl] Simulator::compute-routes
Step 5: [OTcl] Simulator::computer-flat-route
Step 6: [OTcl] RouteLogic::compute
Step 7: [OTcl] Simulator::populate-flat-classifier

Step 6: The OTcl class RouteLogic is bound to the C++ class with the same name (see file ns-2.35/routing/route.cc,h). The OTcl command compute simply executes the funciton compute_routes(…) in the C++ domain. From this point, you have look closely of what NS2 does and apply necessary changes to fit your needs.

Step 7: See how NS2 populate the routing information to all the Nodes. You will need to look into this step to see how routing information are delivered to all related Nodes.

Network Simulator 2 Tutorials

1.  For Learning about Network Simulator 2 basics you can use Marc Greis Tutorials here.

2. You can use following materials

Install Mannasim Patch in NS 2.34 for Wireless Sensor Network Simmulation


1. Download Mannsim Patch for NS 2.34 here.

2. Type the following command on the ns-allinone-2.29 folder:
  • patch -p1 < ns2.34-mannasim-gcc4.3.patch
3. Install NS 2.34 as shown in previous post . 

To test MannaSim installation two simulation scripts are provided bellow. The first one simulates a flat network of homogeneous sensors and the second a hierarchical network composed of two diferent classes of sensor nodes.

If you have any installation problem then post comments......

Install NS 2.34 in Ubuntu 10.10

1. Download & install some packages from repository by following commands :
  • $ sudo apt-get update
  • $ sudo apt-get install build-essential autoconf automake libxmu-dev 
2. Download  ns-2.34 and extract in your home directory.

3. Install the development files for X Windows plus the g++ compiler:
  • sudo apt-get install xorg-dev g++ xgraph
4.  Edit line 6304 of "otcl-1.13/configure"  from SHLIB_LD="gcc -shared" to SHLIB_LD="ld -shared"

5. Now run command in terminal : 
  • $  ./install
6. Set environment variables
  • $ gedit ~/.bashrc
7. Add the following lines to the end of the file. Remember replace “/your/path” by the folder where you have     stored extracted the ns-2 file (For example, if your Linux account name is blackpearl, and you have
    extracted  the file to your home directory, you have to change /your path to /home/blackpearl).

# LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.35/otcl-1.14
NS2_LIB=/your/path/ns-allinone-2.35/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB
# TCL_LIBRARY
TCL_LIB=/your/path/ns-allinone-2.35/tcl8.5.10/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/your/path/ns-allinone-2.35/bin:/your/path/ns-allinone-2.35/tcl8.5.10/unix:/your/path/ns-allinone-2.35/tk8.5.10/unix
NS=/your/path/ns-allinone-2.35/ns-2.35/
NAM=/your/path/ns-allinone-2.35/nam-1.15/
export PATH=$PATH:$XGRAPH:$NS:$NAM

8. Ensure that it immediately takes effect:
  • $ source ~/.bashrc
9. You can test the installation by doing the following:
  • $ cd ns-2.35
  • $ ./validate