Chinaunix首页 | 论坛 | 博客
  • 博客访问: 543029
  • 博文数量: 126
  • 博客积分: 2071
  • 博客等级: 大尉
  • 技术积分: 1522
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-24 16:09
文章分类
文章存档

2013年(8)

2012年(37)

2011年(80)

2010年(1)

分类: LINUX

2012-11-24 19:44:47

There are many attack possible in MANETs specially routing attack which cause damage to the routing process. since AODV is standard in manets, here I am adding the logic snippet of the GRAYHOLE attack. AODV is having plain code . There is no security code in it.

The malicious router can also accomplish this attack selectively, e.g. by dropping packets for a particular network destination, at a certain time of the day, a packet every n packets or every t seconds, or a randomly selected portion of the packets. This is rather called a gray hole attack. If the malicious router attempts to drop all packets that come in, the attack can actually be discovered fairly quickly through common networking tools such as traceroute. Also, when other routers notice that the compromised router is dropping all traffic, they will generally begin to remove that router from their forwarding tables and eventually no traffic will flow to the attack. However, if the malicious router begins dropping packets on a specific time period or over every n packets, it is often harder to detect because some traffic still flows across the network.

Here in code  the term “index” known for node-id. these nodes in this case work as malicious. they are dropping the packet arbitrarily(hence it is grayhole ) . I believe that reader have knowledge about AODV protocol as welll as the  NS2 basic knowledge. C++ knowledge is also require.

The belove code should be placed under recv funtion of AODV protocol.

//Grayhole:Start
float time= CURRENT_TIME;
srand((unsigned)CURRENT_TIME);
int random_integer = rand();
printf("nnrandom number :: %d",random_integer);
  
//cout << random_integer << endl;
flag1=(random_integer%2);
printf("nmodulo::%d",flag1);
  
//NVT(naren0nindiatimes@yahoo.com)
if( ((index==9) || (index==10) || (index==11)||  (index==14) || (index==15) || (index==16) ||(index==23) ||(index==24) )  &&  (flag1) && (ch->ptype()== PT_CBR))
{
printf("--------------------------- in RECV funtion--------------------------");
drop(p, DROP_RTR_ROUTE_LOOP);
return;
}

阅读(900) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~