Upload
regragui
View
214
Download
0
Embed Size (px)
Citation preview
8/16/2019 Ns2codeforblackholeattack Blogspot Com
1/4
NS2 Code for Blackhole Attack (multipleblackholes) in AODV Protocol
1
W e d n e s d a y , 2 6 J u n e 2 0 1
blackhole attack
Rushing attacks-(3/01/2014)NS2 code for Rushing attacks
In this attack, adversary node drops all the packets passed through it. In order to dothis, the adversary node attracts the neighbor node with false route reply with less hopcount and greater sequence number. Once, route is established through that node thenthe neighbor node starts sending packets and eventually all packets will be dropped atadversary. Many wireless routing protocols such as AODV, DSR, HWMP, DSDV etc.are vulnerable to Blackhole attack.
The following scenario consists of 25 nodes, in which 1,7 and 13 nodes are blackholenodes and other nodes are non-malicious.
To create multiple blackhole attackers in AODV protocol
i) In aodv.h the following blue colour lines needs to be added to define balckholeattackers
/* * History management */ double PerHopTime(aodv_rt_entry *rt);
nsaddr_t malicious;
ii) In aodv.cc the following blue colour lines needs to be added to initialize theattackers intAODV::command(intargc, const char*const* argv) {if(argc == 2) {Tcl&tcl = Tcl::instance();
Blackhole attack:
Blackhole attack implementation in AODV routing protocol
ganesh reddy
183 have me in circles View all
Add to circles
Google+ Followers
ganesh reddy
Follow
Google+ Badge
▼ 2013(1)
▼ June (1)
blackhole attack
Blog Archive
ganesh reddy
Follow 183
working in shri vishnu engineering collegefor women- SVECW, Bhimavaram.
View my complete profile
About Me
1 More Next Blog» Create Blog Sign In
converted by Web2PDFConvert.com
http://ns2codeforblackholeattack.blogspot.com/2013/06/blackhole-attack.htmlhttp://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttps://plus.google.com/100524766652969598432https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&sqi=2&ved=0CCIQFjAB&url=http%3A%2F%2Fsvecw.edu.in%2Findex.php%2Fcomponent%2Fcontent%2Fcategory%2F10-academics-cat&ei=8fQbVd-jGoLY8gWygoCQBQ&usg=AFQjCNGPBxshXoXB5WRfvNBP7SxttCu94w&sig2=wGrwzUOLOvMo5THNGuRnwQ&bvm=bv.89744112,d.dGchttps://plus.google.com/100524766652969598432http://ns2codeforblackholeattack.blogspot.com/2013/06/blackhole-attack.htmlhttp://ns2codeforblackholeattack.blogspot.com/2013_06_01_archive.htmlhttp://void%280%29/http://ns2codeforblackholeattack.blogspot.com/search?updated-min=2013-01-01T00:00:00-08:00&updated-max=2014-01-01T00:00:00-08:00&max-results=1http://void%280%29/http://wirelessnetworksecurity11.blogspot.in/2014/01/rushing-attacks-jellyfish-and-byzantine.htmlhttp://ns2codeforblackholeattack.blogspot.com/2013/06/blackhole-attack.html
8/16/2019 Ns2codeforblackholeattack Blogspot Com
2/4
if(strncasecmp(argv[1], "id", 2) == 0) {tcl.resultf("%d", index);return TCL_OK; } if(strncasecmp(argv[1], "blackhole", 9) == 0) { malicious=1000; return TCL_OK; }
AODV::AODV(nsaddr_t id) : Agent(PT_AODV),
btimer(this), htimer(this), ntimer(this),rtimer(this), lrtimer(this), rqueue() {index = id;seqno = 2;bid = 1; LIST_INIT(&nbhead); LIST_INIT(&bihead);malicious=999;
Malicious nodes 1,7 and 13 generates fake route replies using following blue colourcode
//add in receive route request
if(rq->rq_dst == index) {
#ifdef DEBUGfprintf(stderr, "%d - %s: destination sending reply\n",index, __FUNCTION__);#endif // DEBUG
// Just to be safe, I use the max. Somebody may have // incremented the dstseqno.seqno = max(seqno, rq->rq_dst_seqno)+1;if (seqno%2) seqno++;
sendReply(rq->rq_src, // IP Destination 1, // Hop Countindex, // Dest IP Addressseqno, // Dest Sequence Num MY_ROUTE_TIMEOUT, // Lifetimerq->rq_timestamp); // timestamp
Packet::free(p); }
//blackhole attackers
else if(malicious==1000) {
seqno = max(seqno, rq->rq_dst_seqno)+1;if (seqno%2) seqno++;
sendReply(rq->rq_src, // IP Destination 1, // Hop Countrq->rq_dst, seqno, MY_ROUTE_TIMEOUT,rq->rq_timestamp); // timestamp //rt->pc_insert(rt0->rt_nexthop); Packet::free(p); }
Since, all attackers do not have route to destination, attackers have to disable the send(error).
The following blue colour code disables the send (error)
converted by Web2PDFConvert.com
http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDF
8/16/2019 Ns2codeforblackholeattack Blogspot Com
3/4
Posted byganesh reddyat 02:05 79 comments:
// add in route resolve function (AODV::rt_resolve(Packet *p) )else { Packet *rerr = Packet::alloc();structhdr_aodv_error *re = HDR_AODV_ERROR(rerr); /* * For now, drop the packet and send error upstream. * Now the route errors are broadcast to upstream * neighbors - Mahesh 09/11/99 */
assert (rt->rt_flags == RTF_DOWN);re->DestCount = 0;re->unreachable_dst[re->DestCount] = rt->rt_dst;re->unreachable_dst_seqno[re->DestCount] = rt->rt_seqno;re->DestCount += 1;#ifdef DEBUGfprintf(stderr, "%s: sending RERR...\n", __FUNCTION__);#endif
if(malicious==1000);
elsesendError(rerr, false);
drop(p, DROP_RTR_NO_ROUTE);
modified aodv.cc filemodified aodv.h file
After replacing original aodv.cc and aodv.h files, first perform $make clean operation in ns-allinone-2.xx\ns-2.xx folder then $make
iii) To define the blackhole attackers in tcl add these lines after node initialization
$ns at 0.0 "[$n1 set ragent_] blackhole1"$ns at 0.0 "[$n7 set ragent_] blackhole2"$ns at 0.0 "[$n13 set ragent_] blackhole3"
Above scenario example tcl file blackhole attacks scenario
---------------------------------------------------------------------Goodput calculation file goodput
To calculate goodput: type-> perl goodput.pl outputfile name granularity(for 1 or2... n seconds) > filename eg $ perl goodput.pl out.tr 10 > results
-----------------------------------------------------------------------------------Packet Delivery Ratio (pdr) file: pdr
To calculate Packet Delivery Ratio: $ perl pdr.pl trafile_name sour-node1 sour_node2 sour_node3 sour_node4 dest_node>fname
eg :
$perl pdr.pl our.tr _20_ _21_ _11_ _17_ _18_ > result
all files in zip format : all files
converted by Web2PDFConvert.com
http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://ns2codeforblackholeattack.blogspot.com/2013/06/blackhole-attack.html#comment-formhttp://ns2codeforblackholeattack.blogspot.com/2013/06/blackhole-attack.htmlhttps://plus.google.com/100524766652969598432https://drive.google.com/file/d/0B_3Hqq0qzeVEeTZGUkhwVmdPc1U/view?usp=sharinghttp://our.tr/http://pdr.pl/http://pdr.pl/https://docs.google.com/document/d/1nN2E7XV5EJ5XfVUlnDyVFjVXACHKBF5cJ0Nah_8tSzY/edit?usp=sharinghttps://docs.google.com/document/d/1p5xxnMQ_fMwG-b95zLQX4gntMdAc_c7SyWJs2K16A2E/edit?usp=sharinghttps://docs.google.com/document/d/1xcnb5efFprrEvNysn1ziujbSsT3PBZCh7j3D13WTi_Q/edit?usp=sharinghttps://docs.google.com/document/d/1sLCKQ52IqEHSPVVMzwW-2rPkLRszntEiLyEzAhoJzbA/edithttps://docs.google.com/document/d/1Zvj8HGZuAswANOp213thEduktbR7JoP-Q8id8h8LQE4/edit
8/16/2019 Ns2codeforblackholeattack Blogspot Com
4/4
Home
Subscribe to: Posts (Atom)
Recommend this on G oogle
Simple template. Powered byBlogger.
converted by Web2PDFConvert com
http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttps://www.blogger.com/http://ns2codeforblackholeattack.blogspot.com/feeds/posts/defaulthttps://www.blogger.com/share-post.g?blogID=7027853604853612548&postID=5473710898563416353&target=pinteresthttps://www.blogger.com/share-post.g?blogID=7027853604853612548&postID=5473710898563416353&target=facebookhttps://www.blogger.com/share-post.g?blogID=7027853604853612548&postID=5473710898563416353&target=twitterhttps://www.blogger.com/share-post.g?blogID=7027853604853612548&postID=5473710898563416353&target=bloghttps://www.blogger.com/share-post.g?blogID=7027853604853612548&postID=5473710898563416353&target=email