NS2 Code for Wormhole Attack in Manet


What is Warmhole Attack?How to Implement Wormhole Attack in Manet using NS2 Code?

Wormhole attack, an attacker records packets (or bits) at one location in the network, tunnels them (possibly selectively) to another location, and re-transmits them there into the network.Wormhole attacker creates a tunnel in order to records the ongoing communication and traffic at one network position and channels them to another position in the network.We assist students for implementing NS2 Code for Wormhole Attack in Manet.

 

Detection method in wormhole attack:

  • Types of leash:
    • Geographic leash.
    • Temporal leash.
  • Anchor based detection scheme.
  • Packet Leash is used to detect and defend wormhole attacks.
  • Wormhole geographic distributed detection
  • Graph theoretic framework.

Architecture of wormhole attack:

Architecture-of-Wormhole-Attack

 

Sample NS2 code for Wormhole attack in Manet:

This is the code of wormhole attack implemented in manet using aodv routing protocols.

 

 

void LL::recv(Packet* p, Handler* /*h*/)
{
	hdr_cmn *ch = HDR_CMN(p);
	assert(initialized());
	if(ch->direction() == hdr_cmn::UP) {
		//if(mac_->hdr_type(mh) == ETHERTYPE_ARP)
		if(ch->ptype_ == PT_ARP) {
			//printf( "%010.6f - (%03d) - LL::recv - got ARP packet\n", Scheduler::instance().clock(), mac_->addr() );
			arptable_->arpinput(p, this);
		}
		else {
			 switch( ch->ptype() ) {
				 case PT_AODV:
				 case PT_AODVUU:
				 case PT_MAC:
				 case PT_DSR:
				 case PT_ARP:
				 case PT_SEC_RT:
					break;
				 case PT_CBR:
					 if( drop_on_recv ) {
						 static int corrupt_count = 1;
						 if( TRACE_DROP ) printf( "%010.6f - (%03d) - LL::recv - dropping data packet (%d)\n", Scheduler::instance().clock(), mac_->addr(), corrupt_count++ );

						 free( p );
						 return;
					 }break;
				 default:
					 fprintf( stderr, "%010.6f - (%03d) - LL::recv - ERROR - unknown packet type (%d = %s)!\n", NOW, mac_->addr(), ch->ptype(), packet_info.name( ch->ptype() ) );
					 exit( -1 );
			 }
		uptarget_ ? sendUp(p) : drop(p);
				}
				return;
	}

Journal Support for NS2 Projects:(Implementing NS2 Code for Wormhole Attack in Manet)

NS2-Projects-Journal-Support