Wednesday, 26 June 2013

blackhole attack

Planned to give a talk(academic institutions) on the following attacks in AODV protocol

  1. blackhole attack
  2. warmhole attack
  3. grayhole attack
  4. jellyfish attack
  5. rushing attack
  6. location disclosure attack
if any academic institution is interested to arrange a talk  on the above topics, send an email to guncity11@gmail.com


Workshop on Cyber Security and Forensics (16th to 20th August 2016)
http://svecw.edu.in/docs/CSEFDPCS.pdf

Workshop on Big Data Analytics (2nd to 6th August 2016)
http://svecw.edu.in/docs/CSEFDPBigDataAnalytics2016.pdf

Rushing attacks-(3/01/2014) 
NS2 code for Rushing attacks



Blackhole attack:

 In this attack, adversary node drops all the packets passed through it. In order to do this, the adversary node attracts the neighbor node with false route reply with less hop count and greater sequence number. Once, route is established through that node then the neighbor node starts sending packets and eventually all packets will be dropped at adversary. Many wireless routing protocols such as AODV, DSR, HWMP, DSDV etc. are vulnerable to Blackhole attack.

Blackhole attack implementation in AODV routing protocol  



The following scenario consists of 25 nodes, in which 1,7 and 13 nodes are blackhole nodes 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 balckhole attackers
    
/*
      * 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 the attackers
 
int
AODV::command(intargc, const char*const* argv) {
if(argc == 2) {
Tcl&tcl = Tcl::instance();

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 colour code

//add in receive route request

if(rq->rq_dst == index) {

#ifdef DEBUG
fprintf(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 Count
index,                // Dest IP Address
seqno,                // Dest Sequence Num
             MY_ROUTE_TIMEOUT,     // Lifetime
rq->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 Count
rq->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) 


 // 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 DEBUG
fprintf(stderr, "%s: sending RERR...\n", __FUNCTION__);
#endif
if(malicious==1000);
else
sendError(rerr, false);

drop(p, DROP_RTR_NO_ROUTE);

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 or 2... 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
 

95 comments:

  1. Hi....i have updated AODV files with the modifications given by u and compiled without errors.But when i run tcl file given by your post i get following error....please help
    num_nodes is set 25
    INITIALIZE THE LIST xListHead
    ns: _o39 blackhole1 :
    (_o39 cmd line 1)
    invoked from within
    "_o39 cmd blackhole1"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1 "

    ReplyDelete
    Replies
    1. This error occurs due to improper make commend (modified code is not correctly copied in aodv.cc or aodv.h)

      Once again you verify the modified aodv.cc and aodv.h, is it correctly copied or not!

      Then go to ns.2xx folder in terminal

      make clean

      make

      Delete
    2. after making changes iam getting the same errors,so wat to do.
      plz help me in doing this successful.i have o submit this within 3days so plz help me. i vill be very thankful to you.

      Delete
  2. I have added modified aodv.cc and aodv.h files in this blog
    replace original aodv.cc and aodv.h files with these files

    Then go to ns.2xx folder in terminal
    make clean
    make

    ReplyDelete
    Replies
    1. I had copied both files & compiled using make clean & make,
      bu still getting the same error,so plz help in doing so.
      iam also sending tcl file which is given by you.
      so just go through it, and modify the same.



      I could not sent through,its giving error,
      so give your mail-id so that i can sent it.k

      plz send.











      Delete
    2. i tried to compile today tcl script and got following error
      num_nodes is set 25
      INITIALIZE THE LIST xListHead
      malicious 1malicious 7malicious 13channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
      highestAntennaZ_ = 1.5, distCST_ = 550.0
      SORTING LISTS ...DONE!
      Floating point exception (core dumped)

      Delete
  3. hey i have created d blackhole and detected the malicious node as well but how to avoid the blachole node from the route???

    ReplyDelete
    Replies
    1. Usually blackhole attack can be created by either internal or external nodes

      To avoid external blackhole node from network, network nodes should have robust authentication mechanisms.

      On the otherhand, to avoid internal blackhole node, network nodes need robust authentication mechanism and each source and destination nodes have location information with respect to node communication range in route discovery phase.

      The above solution I may not guarantee to avoid internal blackhole node when nodes have unpredictable mobility in the network

      Delete
    2. another possible way to avoid blackhole attack from route discovery phase:
      source node needs to from a route only when the route reply is generated by destination node and this packet properly authenticated.
      This solution does not depend on node mobility and location but it should have a robust security framework.

      Delete
    3. can i get d code where destination acknolwdges multiple data packets in a single ack and if not then source starts the intrusion detection activity

      Delete
    4. can you please send the code to create blackhole attack in manet?

      Delete
    5. hi deepika,
      Can u send me the code of detection of blackhole node using aodv.
      Plz mail at pmpmpradeep@gmail.com
      Thank u

      Delete
    6. hey can u plzz send the code for implementing the black hole

      Delete
    7. iam using the version of ns2.29 i need to implement the blackhole in aodv protocol

      Delete
  4. Do we have to make any changes to the aodv.o file before using the make command?

    ReplyDelete
    Replies
    1. no need to do any changes in aodv.o file
      you just perform make operation after replacing the aodv.cc and aodv.h with files

      Delete
  5. Hi Dear, Many thanks for your work. I have replaced original aodv.cc and aodv.h files and when running tcl give an error:

    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1"

    Then I have tried to “./configure” at ns-2.29

    Installation of tclcl seems incomplete or can't be found automatically.
    Please correct the problem by telling configure where tclcl is
    using the argument --with-tclcl=/path/to/package
    (perhaps after installing it),
    or the package is not required, disable it with –with-tclcl=no.
    ”ns-2.29$

    I think for this reason can not “make clean” and “make”

    Do you have any suggestion please?

    ReplyDelete
    Replies
    1. Hi Oscar Aznarez,

      After replacing original aodv.cc and aodv.h files, first you must do "make" operation to create new objects of aodv.cc and aodv.h.
      One more thing, you need not do ./configure operation and only need make operation for new objects.
      Please try with "make" operation. If you will get same error please inform me.
      All the best

      Delete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Hi Ganesh,

    First off all many thanks for your help
    As you set I have change replace aodv.cc and aodv.h at /aodv file
    then used tcl provided from your blog
    then make clean & cleand operation at $ ns-2.34

    when ns xxx.tcl
    still getting the same error:

    num_nodes is set 25
    INITIALIZE THE LIST xListHead
    ns: _o39 blackhole1:
    (_o39 cmd line 1)
    invoked from within
    "_o39 cmd blackhole1"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1"

    Many thanks for your time

    ReplyDelete
    Replies
    1. Based on above comment I found the following error

      make clean & cleaned

      First, “make clean” is the correct command.
      Second, “make cleaned” is not correct command. Instead of this, use only “make” operation

      Based on your comments one and two, I found that you are using two different versions :ns2.29 and ns2.34 same system or not?

      If it is same the following problem rises
      In this case ‘ns’ commend works on ns2.29 because ns2.29 is installed first.
      If you do any modification on .cc files in ns2.34 it won’t work.
      Thus, first you remove one version completely either ns2.29 or ns2.34 then check path setting

      All the best

      Delete
    2. in file.tcl delete the [] and let espace _ blackhole like this:
      $ns at 0.0 "$n1 set ragent_ blackhole1"
      $ns at 0.0 "$n7 set ragent_ blackhole2"
      $ns at 0.0 "$n13 set ragent_ blackhole3"

      Delete
  8. It is working, thanks, really appreciate your help

    ReplyDelete
    Replies
    1. hye, can i know how you resolve the problem? i have same problem like u..hope you can help me

      Delete
    2. in file.tcl delete the [] and let espace _ blackhole like this:
      $ns at 0.0 "$n1 set ragent_ blackhole1"
      $ns at 0.0 "$n7 set ragent_ blackhole2"
      $ns at 0.0 "$n13 set ragent_ blackhole3

      Delete
  9. Hello sir, thanks for sharing,
    is it possible execute it with udp packet? is there any addition code for using udp?

    ReplyDelete
    Replies
    1. Here blackhole attackers' perform dropping operations on upd traffic only.
      you need not add any extra code to perform udp operations.

      Delete
  10. Hi,
    this is great work but i have a problem from the beginning...
    i try to locate aodv.cc and aodv.h but i cant find them.
    i installed ns2 from ubuntu software center and i dont know where the files are.
    i tried installing ns2 with nsallinone package in which i can see where the files are but i had other problems there and i gave up. So can you help me with this problem? When i run simple simulation of aodv it runs normally, so the files are somewhere there

    ReplyDelete
  11. Hi,
    I am siddu, Pursing my ph.d on wireless network, I followed all your steps but when i executed tcl file...i am get following error...

    siddu@siddu-PC /
    $ ns blackholeattack.tcl
    num_nodes is set 25
    INITIALIZE THE LIST xListHead
    ns: _o39 blackhole1:
    (_o39 cmd line 1)
    invoked from within
    "_o39 cmd blackhole1"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1"


    how to overcome this error.....

    ReplyDelete
  12. 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
    or

    After above change, If you get same error then you will do the following procedure:
    1. Remove the ns2 allinone folder to uninstall ns2 then
    2. Re-install ns2
    3. Add blackhole code

    ReplyDelete
  13. Dear Ganesh:

    We followed your instructions above and we got the following error:
    ns bhAODV.tcl
    num_nodes is set 20
    Creating nodes...
    INITIALIZE THE LIST xListHead
    invalid command name "Agent/blackholeAODV"
    while executing
    "Agent/blackholeAODV create _o458 20"
    invoked from within
    "catch "$className create $o $args" msg"
    invoked from within
    "if [catch "$className create $o $args" msg] {
    if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
    delete $o
    return ""
    }
    global errorInfo
    error "class $..."
    (procedure "new" line 3)
    invoked from within
    "new Agent/blackholeAODV [$node node-addr]"
    (procedure "_o3" line 2)
    (Simulator create-blackholeaodv-agent line 2)
    invoked from within
    "$self create-blackholeaodv-agent $node"
    ("blackholeAODV" arm line 2)
    invoked from within
    "switch -exact $routingAgent_ {
    DSDV {
    set ragent [$self create-dsdv-agent $node]
    }
    DSR {
    $self at 0.0 "$node start-dsr"
    }
    blackholeAODV {
    set ragent [..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
    "_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
    "eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
    "$ns_ node"
    ("for" body line 2)
    invoked from within
    "for {set i 20} {$i < 21} {incr i} {
    set node_($i) [$ns_ node]
    $node_($i) random-motion 0 ;#disable random motion
    $ns_ at 0.01 "$node_($i) label \"blac..."
    (file "bhAODV.tcl" line 57)

    ReplyDelete
  14. This error has come when you are already added another blackhole patch. please reinstall the ns2 then try

    ReplyDelete
    Replies
    1. Dear Ganesh:

      Am still having the problem. Do you think having both NS3 and NS2 could cause a problem.

      Delete
  15. i am using ns 2.35 and getting the following error:
    ns: _o39 blackhole1:
    (_o39 cmd line 1)
    invoked from within
    "_o39 cmd blackhole1"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1"
    please do help me thank you

    ReplyDelete
  16. hi nikhil,

    once you replace the original aodv files with blackhole aodv files
    the open ns.235 folder
    make clean
    make

    ReplyDelete
    Replies
    1. Hi Ganesh,
      Thanks For ur Reply But i Have Done Make clean And Make both But Error Still Remains

      Delete
    2. This error occur due to the new objective file(AODV.O) is not reflecting the blackhole attacks in tcl file.
      To overcome this problem, do the following steps 1:

      1. Un-install all ns2 versions(if you have to are more) and thier path settings.
      2. re-intall ns2.33 or ns2.34 version
      3. follow steps mentioned in this blogg to create blackhole attack


      all the best

      Delete
  17. sirg again same problem which @ nikhil is facing

    num_nodes is set 25
    INITIALIZE THE LIST xListHead
    ns: _o39 blackhole1:
    (_o39 cmd line 1)
    invoked from within
    "_o39 cmd blackhole1"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1"
    after doing the make clean and make the problem is continuing

    ReplyDelete
  18. you can run the tcl file from any where in ns2 folder

    ReplyDelete
    Replies
    1. hi.........................
      sir i am getting the same error. after doing all the thing. which u told
      num_nodes is set 25
      INITIALIZE THE LIST xListHead
      ns: _o39 blackhole1 :
      (_o39 cmd line 1)
      invoked from within
      "_o39 cmd blackhole1"
      invoked from within
      "catch "$self cmd $args" ret"
      invoked from within
      "if [catch "$self cmd $args" ret] {
      set cls [$self info class]
      global errorInfo
      set savedInfo $errorInfo
      error "error when calling class $cls: $args" $..."
      (procedure "_o39" line 2)
      (SplitObject unknown line 2)
      invoked from within
      "_o39 blackhole1 "

      Delete
  19. i am still getting the same error
    can u plz share the aodv.o file also
    Thank you

    ReplyDelete
  20. I followed your steps, replaced original aodv.cc and aodv.h and also compiled your aodv.tcl script. But am still getting errors even after "makeclean" and "make" operations. this is the error and getting
    kevin@ubuntu:~/Desktop/ns-allinone-2.34/bin$ ns aodv.tcl
    num_nodes is set 25
    INITIALIZE THE LIST xListHead
    ns: _o39 blackhole1:
    (_o39 cmd line 1)
    invoked from within
    "_o39 cmd blackhole1"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1"

    So please help me out Mr.Ganesh

    ReplyDelete
  21. Hi,
    I'm making changes to aodv code but it shows error when i make it.
    errors are:
    1)malicious1 , malicious2, malicious3 doesnot exist;
    2)blackhole1,blackhole2 and blackhole3 are not declared
    what is backhole variable that u use?
    Please help not able to figure this out

    ReplyDelete
  22. num_nodes is set 25
    INITIALIZE THE LIST xListHead
    ns: _o39 blackhole1:
    (_o39 cmd line 1)
    invoked from within
    "_o39 cmd blackhole1"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1"

    ReplyDelete
    Replies
    1. please mail me bskolkur@gmail.com

      Delete
    2. This error is due to multiple installation of NS2 in the same machine. Try uninstalling NS by using command
      "sudo apt-get purge ns2"
      Re-install the Ns2 after that and you are good to go. CHEERS...!!

      Delete
  23. Hello Sir...I have run the code for 25 node scenario its working correctly.
    I want to run the same code for 10 nodes, 20 nodes and 30 nodes. there is some error occurs FLOATING POINT EXCEPTION
    how can i fix.....please do a reply ASAP

    ReplyDelete
  24. Please don't buy the projects,
    do it on your own

    ReplyDelete
  25. when i folloe these steps and run tcl script then below error occur
    classfier::no-slot{} default handler{tcl/lib/ns-lib.tcl}
    o186:no target slot1
    0186 type classifier/port
    content dump:
    classifier -0186
    0 offset
    0 shift
    2147483647 mask
    1 slot
    slot 255 :- 0177(Agent/Aodv)
    Finished standered no-slot{} default handler

    ReplyDelete
  26. hi,
    I am totally new to NS2. I have all the files with me, but dont know how to execute code using NS2. Plz somebody help me to resolve this issue.

    ReplyDelete
  27. follow this link to install ns2 in ubuntu :http://vibhanshu86.wordpress.com/2014/06/17/installing-ns2-on-ubuntu-14-04/

    once your able to install then follow the blog code to implement the blackhole attack

    ReplyDelete
  28. sir,
    firstly thank you for such a nice blog.
    i simulate the code as per the instructions given and i was able to observe the black hole effect in nam, out.tr and nam files are also available along with goodput calculation.

    But for pdr ,while running the code as per the example for pdr.pl specified above, i got the following error:

    Illegal division by zero at pdr.pl line 59, line 31937.

    i also checked line no.59 at pdr.pl, tried different things, and checked line 31937 in out.tr ,but was not able to fix the error. i request you to help me with this one thing.

    ReplyDelete
  29. i have one question....which method is best to detect blackhole attack?? am thinking of IDS..is it right??

    ReplyDelete
  30. i am implementation black hole in aodv no error but no effect in result without black hole

    ReplyDelete
  31. hi saja,

    There are two reasons

    1. Path is established between source node and destination node without help of attacker. (ans: pls change the source or destination path which includes blackhole attacker).
    2. In trace file we need to correct destination When we change the destination node.

    Thank for following this blog

    ReplyDelete
  32. Thank you for your cooperation But I do not very much got the idea Is it possible for more clarification

    ReplyDelete
  33. I had implemented the above mentioned steps but i couldn't see the effect of blackhole node in the simulation.The packets from the source reaches the destination correctly without any interference of blackhole node..can you please tell me where i am going wrong

    ReplyDelete

  34. 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

    ReplyDelete
  35. Do you fit that we use to run two black hole in ns2 version 2.35?

    ReplyDelete
  36. I need to implement wired cumwireless scenario, so i waana know can we simulate this scenario without using and base station(intermediate node between wired and wireless node)???
    it would help me alot

    ReplyDelete
  37. hello sir, im bayu,
    it is possible to implement blackhole attack on other protocol except AODV ?, i still working my final test to make blackhole attack simulation using ZRP and DSR protocol, almost blackhole patch i found only for AODV if its possible to implement on ZRP and DSR, could you tell me how to configure it?, thank you for your help sir,
    best regard

    ReplyDelete
    Replies
    1. yes it is possible to create blackhole attack on ZRP and DSR,
      But, you have to analyze the code of dsr.cc and zrp.cc to create these attacks, before doing this you need to know the routing functionalities of DSR and ZRP. (It will take time)

      Delete
  38. Hello sir,
    When calling
    $ns at 0.0 "[$n1 set ragent_] blackhole1"
    in some other code, i get floating point exception
    Plzz help me to solve dis problem

    ReplyDelete
  39. having error while running the code plzz help mee..
    ns: _o39 blackhole1:
    (_o39 cmd line 1)
    invoked from within
    "_o39 cmd blackhole1"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1"

    ReplyDelete
  40. when run $make show error

    In file included from ./trace/cmu-trace.h:43:0,
    from ./aodv/aodv.h:40,
    from aodv/aodv_logs.cc:31:
    ./mobile/god.h: In member function ‘double vector::length()’:
    ./mobile/god.h:85:30: error: ‘sqrt’ was not declared in this scope
    return sqrt(X*X + Y*Y + Z*Z);
    ^
    make: *** [aodv/aodv_logs.o] Error 1

    ReplyDelete
    Replies
    1. No need to run $make after replace such file just go to the folder /ns-allinone-2.35 and then ./install

      Delete
  41. Hello friend, please help me out from these questions and confusion...
    1. can I alter the data flowing in ns2, or can intermediate node compromise the integrity of the message, without the knowledge of sender and receiver.

    2. can I generate exact 64 bit key or 80 bit key, using diffie hellman key generation algorithm.

    3. which layer is better for encryption ??

    4. if i will use, network layer for encrypting the packet.. will IP address also be encrypted... i mean header of IP address will also be encrypted..

    I urgently need solution to above queries.. please reply ASAP

    ReplyDelete
  42. This comment has been removed by the author.

    ReplyDelete
  43. This comment has been removed by the author.

    ReplyDelete
  44. Hello sir,
    blackhole attack code of manet will works in vanet?
    And if you have a source code or patch for wormhole attack in vanets please send me to poojan242@gmail.com it will be helpful for my project

    ReplyDelete
  45. sir, i have modified aodv and got blackholes. it works fine. can you help me to make co-operative blackholes?

    ReplyDelete
  46. Hello...when I run the tcl file i get the below error :
    num_nodes is set 25
    INITIALIZE THE LIST xListHead
    channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
    highestAntennaZ_ = 1.5, distCST_ = 550.0
    SORTING LISTS ...DONE!
    Floating point exception (core dumped)

    Plz help me to resolve the error

    ReplyDelete
  47. I am getting following error:
    r@ubuntu:~/Documents/ns-allinone-2.35$ ns bl.tcl
    num_nodes is set 25
    INITIALIZE THE LIST xListHead
    ns: _o39 blackhole1:
    (_o39 cmd line 1)
    invoked from within
    "_o39 cmd blackhole1"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o39" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o39 blackhole1"

    Please help..

    ReplyDelete
    Replies
    1. Use the code from this site. It works
      http://www.jgyan.com/ns2/blackhole%20attack%20simulation%20in%20ns2.php

      Delete
    2. i found same error using ns2.35 http://www.jgyan.com/ns2/blackhole%20attack%20simulation%20in%20ns2.php

      Delete
    3. codes from both the sites are same!

      Delete
    4. This comment has been removed by the author.

      Delete
  48. sir, I am getting Floating point exception if the line containing "BLACKHOLE" is present in code I am using NS2.35,ubuntu11.0
    The error is not occurring when that line marked as a comment

    ReplyDelete
  49. Hello sir, can you send me the zip file of this code

    ReplyDelete
  50. Hello sir, can you send me the zip file of this code

    ReplyDelete
  51. please I need the change witch I have to make in dsr.cc and .h to make a black hole attack
    please any body can help me.

    ReplyDelete
    Replies
    1. Use the code from this site. It works
      http://www.jgyan.com/ns2/blackhole%20attack%20simulation%20in%20ns2.php

      Delete
  52. Use the code from this site. It works
    http://www.jgyan.com/ns2/blackhole%20attack%20simulation%20in%20ns2.php

    ReplyDelete
  53. i am using ns 2.35 and i am getting this error after the configuration of malicious node ..
    $ ns blackhole.tcl
    num_nodes is set 25
    INITIALIZE THE LIST xListHead
    ns: _o171 blackhole:
    (_o171 cmd line 1)
    invoked from within
    "_o171 cmd blackhole"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o171" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o171 blackhole"

    ReplyDelete
  54. sir i need your help kindly help me in worm hole attack in WSN NS2. send me some source code if you keep. planetraheel@gmail.com

    ReplyDelete
  55. Sir, I need code for Black hole detection and isolation. can I get it here? Please send the code to rahul.rv210@gmail.com

    ReplyDelete
  56. Please, I need code for clone attack detection and mitigation. Can you provide it please? Please send the code to baessakajela@yahoo.com or tarikuk28@gmail.com

    ReplyDelete
  57. thank you sir. i use it. it work done.can you send me perevent of blackhole attack in this project. ..thank you. my email: nedawp@gmail.com

    ReplyDelete
  58. i need video regarding the above explanation.i am new to ns2. and i'm unable to configure properly. pls send video of above explanation.

    ReplyDelete
  59. INITIALIZE THE LIST xListHead
    ns: _o171 blackhole:
    (_o171 cmd line 1)
    invoked from within
    "_o171 cmd blackhole"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o171" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o171 blackhole"



    Hello , I am getting following error while I am running blackhole file in ns2.35

    ReplyDelete