Simulation of Wormhole attack in NS3

5,689 views
Skip to first unread message

rahul hada

unread,
Jan 28, 2013, 7:19:25 PM1/28/13
to ns-3-...@googlegroups.com
Hello Everyone,

What is the best way to simulate wormhole attack using aodv routing protocol

Thank in Advance :)

Rahul

rahul hada

unread,
Jan 28, 2013, 7:24:58 PM1/28/13
to ns-3-...@googlegroups.com
i think we can simulate wormhole modifying the AODV code but I am not sure about it and also where is modification required.


Rahu;

rahul hada

unread,
Jan 28, 2013, 7:30:54 PM1/28/13
to ns-3-...@googlegroups.com
Attack Model designed by me...need some suggestion.
DSC09305.JPG

rahul hada

unread,
Jun 5, 2013, 11:32:05 PM6/5/13
to ns-3-...@googlegroups.com
Best way to simulate wormhole attack is to add malicious behavior in the aodv-routing-protocol.cc.
After adding malicious behavior we should build the ns3 source code and then only we can simulate our wormhole attack.
 
Its working properly.



Rahul Hada


On Tuesday, January 29, 2013 5:49:25 AM UTC+5:30, rahul hada wrote:

segun akogun

unread,
Jul 12, 2013, 3:46:14 PM7/12/13
to ns-3-...@googlegroups.com
can you please send me the code for wormhole attack. demy...@yahoo.com

rahul hada

unread,
Jul 13, 2013, 1:23:16 AM7/13/13
to ns-3-...@googlegroups.com
Modified Aodv routing protocol problem for the simulation of wormhole attack in ns3.



Rahul Hada


--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.

To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

aodv-routing-protocol.cc

pipe lin

unread,
Dec 14, 2013, 9:43:57 AM12/14/13
to ns-3-...@googlegroups.com
Hello sir . i´m working in something simililar but i don´t understand the modifications you did to this protocol. 
Actually i´m trying to test the correct operation of this implementation. Besides,Do you have the aodv-routing-protocol.h and de script files ?, i don´t know what modifications you did to this files also.

Thank you sir

rahul hada

unread,
Dec 15, 2013, 9:06:15 AM12/15/13
to ns-3-...@googlegroups.com
Dear ,
The list of modifications are mentioned in my conversation and the updates are mentioned in my posted code.

header file of aodv-routing-protocol.h is attached with this mail.

Rahul Hada
 


aodv-routing-protocol.h

pipe lin

unread,
Dec 15, 2013, 5:02:33 PM12/15/13
to ns-3-...@googlegroups.com
Thanks sir. It'd be okay if i ask you some more questions about this code?. Not foolish questions, just specific questions. I really want to learn.

Thanks for your reply.

shagrev Bashnag

unread,
Dec 15, 2013, 10:43:12 PM12/15/13
to ns-3-...@googlegroups.com
By Reading your code I realized two things.
1. In RoutingProtocol::Forwarding (), you comment the following:


// problem is here
/*Code Section : In this we need to increment the ttl so that hello message send from source to destination reached properly
* */

Did you already solve this problem? In this case. How did you do this. Is it important? What does it mean?.

2. I want to know if the wrmDetect Method is already implemented.


Two last questions. Do you have results of this implementation? what problems did you find in implementing this wormhole attack?

rahul hada

unread,
Dec 16, 2013, 2:18:14 AM12/16/13
to ns-3-...@googlegroups.com
Dear ,

The things which i have properly done is the simulation of the wormhole attack
and you can find variable bool EnableWrmAttack in the .h file of aodv routing , which will we enabled by the user while writing the topology script and 

ex:  if (EnableWrmAttack)
      {
          //section of code to detect to detect the wormhole attack
      }
 
I am still working on the detection method of the wormhole attack, so either you have to wait for few more days or you can insert your own method into it.
and problem section of the Forwarding method is related with the detection of wormhole attack.

Rahul Hada



shagrev Bashnag

unread,
Dec 27, 2013, 12:49:26 AM12/27/13
to ns-3-...@googlegroups.com
Hi sir, 

I really need your help. I can´t get the results expected for the simulation. Do you have the topology script or the results, please? I got to get this results or something similar and show them to my associate professor before january 1th.  

thanks a lot sir.


2013/12/16 rahul hada <hada....@gmail.com>

shagrev Bashnag

unread,
Jan 6, 2014, 3:01:38 PM1/6/14
to ns-3-...@googlegroups.com
This is a NS3 forum  not a Ns2 forum. Here is tutorial about  black hole attacks in NS2 : http://www.btechnos.com/2012/05/source-codes-for-blackhole-attack-in.html


Rahul,  Sir. I want to simulate an attack against the routing protocol: Blackhole Attack. That means I want a MALICIOUS NODE that claims that it has active route to the destination as soon as it receives RREQ packets. It will then send the  response to the SOURCE NODE before any other node. In this way THE SOURCE NODE will think that this is the active route and thus active route discovery is complete. THE SOURCE NODE will ignore all other replies and will start seeding data packets to the MALICIOUS NODE. In this way all the data packet will be lost consumed or lost.  

I know I have to modify the routing protocol code  "aodv-routing-protocol.cc".

In order to create a malicious behavior for some nodes in this member function:  RoutingProtocol::GetTypeId (). in this way:

.AddAttribute ("IsMalicious","Indicates whether a node is malicious.",
                  BooleanValue(false),
                  MakeBooleanAccessor (&RoutingProtocol::SetMaliciousNodeEnable,
                                      &RoutingProtocol::GetMaliciousNodeEnable),
                  MakeBooleanChecker())
Now,I know if i want only some nodes are malicious I have to use: 
Config::Set ("/NodeList/4/$ns3::aodv::RoutingProtocol/IsMalicious", BooleanValue (true));
In the topology script. 
What I want to  know is HOW SHOULD THE MALICIOUS NODES DO TO RESPONSE FIRST THAN ANY OTHER NODE? AND AFTER THAT, HOW TO DROP THE PACKETS SENT BY THE SOURCE NODE? 
The objective of the simulation is to calculate the impact of blackhole attack, in number of packets received, and in the Throughput of AODV with vs without black hole attack. 

Thank you in advance sir. 



2014/1/4 masoume Heidari <masoume....@gmail.com>
Hi dear
I want to simulate Wormhole attack in NS2. but can't it.
 please help me.



Ankur Patel

unread,
Mar 2, 2014, 7:40:10 AM3/2/14
to ns-3-...@googlegroups.com
Hiii,

as we saw... in last conversation u sent a file (aodv-routing-protocol.cc and aodv-routing-protocol.h) but in there r so many errors, when i run d file...  can u say me d procedure.. how i run this file... ?

please help me...

Thanks
Ankur

manisha mattu

unread,
Mar 6, 2014, 11:46:33 PM3/6/14
to ns-3-...@googlegroups.com


hiii rahul,

as i'm trying to simulate the wormhole attack in aodv.. i have seen ur files(aodv-routing-protocol.cc and aodv-routing-protocol.h) . but when i'm trying to run these files, there are lots of error like enblewrmattack are not declared in this scope.. so, plz help me to remove this error..and plz give some suggestion on this..

Abhilash Kk

unread,
Mar 9, 2014, 6:33:53 AM3/9/14
to ns-3-...@googlegroups.com


Hai
      i am doing a project in ns3 to detect malicious nodes in mobile ad-hoc network.
      i am using AODV as the routing protocol, can any one tell me how to set up selfish
      nodes, packet dropping, any help is appreciated...


       thanks

rahul hada

unread,
Mar 11, 2014, 10:59:49 AM3/11/14
to ns-3-...@googlegroups.com
Method to create selfish attack :-
 - as an when attacker node receive any RREQ from any node it will generate the RREP and back to source.
- for this you need to modify the existing code of AODV 
- and attacker will enabled the modified AODV feature in its routing method.

Rahul 


--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Abhilash Kk

unread,
Mar 11, 2014, 11:21:22 AM3/11/14
to ns-3-...@googlegroups.com

hi Rahul,
                First i thank you for your reply..
                which code i want to change,
                1. src/aodv/examples/aodv.cc
                2. src/aodv/model/aodv-routing-protocol.cc
                1. src/aodv/helper/aodv-helper.cc
                 can you please command..
         thank

rahul hada

unread,
Mar 13, 2014, 6:08:04 AM3/13/14
to ns-3-...@googlegroups.com
aodv-routing-protocol.cc & aodv-helper.cc


--

manisha mattu

unread,
Mar 26, 2014, 1:11:24 AM3/26/14
to ns-3-...@googlegroups.com



dear sir,,
please send me wormhole attack source code in ns-3..

rahul hada

unread,
Mar 26, 2014, 10:38:20 AM3/26/14
to ns-3-...@googlegroups.com
I have already posted on the group.


For more options, visit https://groups.google.com/d/optout.

Nusrat Fatema

unread,
Apr 1, 2014, 9:13:47 AM4/1/14
to ns-3-...@googlegroups.com
Hello,

I am doing my MSc thesis on "Jamming Attacks on Bluetooth developed in NS3." I am new with NS-3 simulator. Instead of Wifi module I want to use Bluetooth module. But there is no Bluetooth module available. How do I port from NS-2? I also need help to build up an energy model for the effective Bluetooth jammer. Is it possible to share your thoughts? Thanks in advance.

--

Nusrat.

Anju

unread,
Jun 9, 2014, 2:42:02 AM6/9/14
to ns-3-...@googlegroups.com
Hello Sir,
   I want to simulate a WORMHOLE attack using NS3. I am using the aodv protocol for the same, I had seen the code posted by you in this thread. Kindly post the topology script used to run this.

Thank you in advance..

By,
   Anju

nagy....@fa-hists.edu.eg

unread,
Aug 4, 2014, 7:02:25 AM8/4/14
to ns-3-...@googlegroups.com
i have this error when run
./src/aodv/model/aodv-routing-protocol.cc: In static member function ‘static ns3::TypeId ns3::aodv::RoutingProtocol::GetTypeId()’:
../src/aodv/model/aodv-routing-protocol.cc:276:25: error: ‘SetWrmDetectEnable’ is not a member of ‘ns3::aodv::RoutingProtocol’
    MakeBooleanAccessor(&RoutingProtocol::SetWrmDetectEnable,
                         ^
../src/aodv/model/aodv-routing-protocol.cc:277:12: error: ‘GetWrmDetectEnable’ is not a member of ‘ns3::aodv::RoutingProtocol’
           &RoutingProtocol::GetWrmDetectEnable),
            ^
../src/aodv/model/aodv-routing-protocol.cc: In member function ‘void ns3::aodv::RoutingProtocol::RecvReply(ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address)’:
../src/aodv/model/aodv-routing-protocol.cc:1499:6: error: ‘EnableWrmDetect’ was not declared in this scope
   if(EnableWrmDetect)
      ^
../src/aodv/model/aodv-routing-protocol.cc:1583:11: error: ‘EnableWrmDetect’ was not declared in this scope
        if(EnableWrmDetect)
           ^
Waf: Leaving directory `/home/remon/ns-allinone-3.19/ns-3.19/build'
Build failed
 -> task in 'ns3-aodv' failed (exit status 1):
    {task 3067620268L: cxx aodv-routing-protocol.cc -> aodv-routing-protocol.cc.1.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-pthread', '-pthread', '-Isrc/aodv', '-I../src/aodv', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/i386-linux-gnu/gtk-2.0/include', '-I/usr/include/atk-1.0', '-I/usr/include/cairo', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/pango-1.0', '-I/usr/include/gio-unix-2.0', '-I/usr/include/glib-2.0', '-I/usr/lib/i386-linux-gnu/glib-2.0/include', '-I/usr/include/pixman-1', '-I/usr/include/freetype2', '-I/usr/include/libpng12', '-I/usr/include/harfbuzz', '-I/usr/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_SQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '../src/aodv/model/aodv-routing-protocol.cc', '-c', '-o', 'src/aodv/model/aodv-routing-protocol.cc.1.o']

nagy....@fa-hists.edu.eg

unread,
Aug 4, 2014, 7:08:33 AM8/4/14
to ns-3-...@googlegroups.com
 i have error when run the wormhole attack

Pranava Durai

unread,
Feb 25, 2015, 11:48:30 AM2/25/15
to ns-3-...@googlegroups.com
while i run the code wormhole attack i have these errors.can anyone  help me??
 
 Thank you,
../scratch/aodv-routing-protocol.cc: In static member function ‘static ns3::TypeId ns3::aodv::RoutingProtocol::GetTypeId()’:
../scratch/aodv-routing-protocol.cc:276:25: error: ‘SetWrmDetectEnable’ is not a member of ‘ns3::aodv::RoutingProtocol’
    MakeBooleanAccessor(&RoutingProtocol::SetWrmDetectEnable,
                         ^
../scratch/aodv-routing-protocol.cc:277:12: error: ‘GetWrmDetectEnable’ is not a member of ‘ns3::aodv::RoutingProtocol’
           &RoutingProtocol::GetWrmDetectEnable),
            ^
../scratch/aodv-routing-protocol.cc: In member function ‘virtual void ns3::aodv::RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper>) const’:
../scratch/aodv-routing-protocol.cc:318:31: error: no matching function for call to ‘ns3::aodv::RoutingTable::Print(ns3::Ptr<ns3::OutputStreamWrapper>&) const’
   m_routingTable.Print (stream);
                               ^
../scratch/aodv-routing-protocol.cc:318:31: note: candidate is:
In file included from ../scratch/aodv-routing-protocol.h:31:0,
                 from ../scratch/aodv-routing-protocol.cc:31:
../scratch/aodv-rtable.h:245:8: note: void ns3::aodv::RoutingTable::Print(std::ostream&)
   void Print(std::ostream &os);
        ^
../scratch/aodv-rtable.h:245:8: note:   no known conversion for argument 1 from ‘ns3::Ptr<ns3::OutputStreamWrapper>’ to ‘std::ostream& {aka std::basic_ostream<char>&}’
../scratch/aodv-routing-protocol.cc: In member function ‘void ns3::aodv::RoutingProtocol::RecvReply(ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address)’:
../scratch/aodv-routing-protocol.cc:1499:6: error: ‘EnableWrmDetect’ was not declared in this scope
   if(EnableWrmDetect)
      ^
../scratch/aodv-routing-protocol.cc:1583:11: error: ‘EnableWrmDetect’ was not declared in this scope
        if(EnableWrmDetect)

rahul hada

unread,
Feb 25, 2015, 12:02:16 PM2/25/15
to ns-3-...@googlegroups.com
Dear ,

For the simulation of Wormhole attack you can use following AODV files 
copy the below two file in .../src/aodv/model

- aodv-routing-protocol.cc 
- aodv-wouting-protocol.h 

aodv-routing-protocol.cc
aodv-routing-protocol.h

PRANAVADURAI

unread,
Feb 25, 2015, 12:14:35 PM2/25/15
to ns-3-...@googlegroups.com
when i copy those files from there and run the code i receive these errors..what should i do now??

/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 21
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status


--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.

rahul hada

unread,
Feb 25, 2015, 12:15:44 PM2/25/15
to ns-3-...@googlegroups.com
where you have copied these files ?

PRANAVADURAI

unread,
Feb 25, 2015, 12:16:32 PM2/25/15
to ns-3-...@googlegroups.com
/src/aodv/model

rahul hada

unread,
Feb 25, 2015, 12:18:51 PM2/25/15
to ns-3-...@googlegroups.com
 You have to replaced the old aodv-routing-protocol.cc and aodv-routing-protocol.h with these two file.


Have to done his ??

rahul hada

unread,
Feb 25, 2015, 12:20:57 PM2/25/15
to ns-3-...@googlegroups.com
As I can see from your error that we have copied it in scratch 

You should NOT copy this in scratch folder 

Your Error Message 
../scratch/aodv-routing-protocol.cc: In constructor ‘ns3::aodv::RoutingProtocol::RoutingProtocol()’:


PRANAVADURAI

unread,
Feb 25, 2015, 12:21:07 PM2/25/15
to ns-3-...@googlegroups.com
yes i replaced both old files with u send one..

rahul hada

unread,
Feb 25, 2015, 12:23:22 PM2/25/15
to ns-3-...@googlegroups.com
then why it is showing such error in which it shows that aodv-routing-protocol.cc is present in scratch folder
check you error ...

Sourav Chhabra

unread,
Mar 3, 2015, 2:58:55 AM3/3/15
to ns-3-...@googlegroups.com
Hi rahul sir,
please send some example code for wormholeattack.
so that we can make use of it.

thanks & regards
sourav

dharti patel

unread,
Apr 1, 2015, 9:57:05 AM4/1/15
to ns-3-...@googlegroups.com
Hello Sir , Please can you send me code for creation of wormhole attack in NS2 using AODV protocol? Now,i am studying M.E in computer science and after 1 week i would  submitted my thesis so i have not enough time. i tried my very best but my code is not working properly.so kindly request if you have some code then send me.

Thanks,
Dharti. 

decent gimu

unread,
Apr 9, 2015, 12:36:29 AM4/9/15
to ns-3-...@googlegroups.com


Hello sir.i'm also working on wormhole but i am not able to create wormhole attack in ns2. Can  you please help me out.Please send me the code.

Thank you in advance

Garima 
 
Message has been deleted

rahul hada

unread,
Apr 10, 2015, 11:10:03 PM4/10/15
to ns-3-...@googlegroups.com
You can find the source code of wormhole attack in the ns3-users , and add that code in the aodv module.


On Sat, Apr 11, 2015 at 12:15 AM, Isha harode <ishaha...@gmail.com> wrote:
hello
can anybody tell me steps to start simulation of wormhole attack in ad hoc network using ubuntu terminal

decent gimu

unread,
Apr 14, 2015, 1:19:58 PM4/14/15
to ns-3-...@googlegroups.com
hello sir

can you please send me the code.I'm not getting it.

Regards
Garima

Pinky

unread,
Apr 16, 2015, 4:51:31 PM4/16/15
to ns-3-...@googlegroups.com
Rahul Sir ,
can you pls send me the code of the topology script you made to show the properties of wormhole attack. And did you make any code for its detection.
Message has been deleted
Message has been deleted
Message has been deleted

decent gimu

unread,
Apr 17, 2015, 1:17:51 AM4/17/15
to ns-3-...@googlegroups.com
hello sir

i have added one malicious node and have make changes in aodv.h and aodv.cc but still i am getting what to do next to create a wormhole attack in ns2.As the malicious node only drops the packet.please help me out.

Regards
Gimu

On Fri, Apr 17, 2015 at 2:26 AM, Pinky <pinkyb...@gmail.com> wrote:
Rahul Sir  ,
can you pls send me the code of the topology script you made to show the properties of wormhole attack. And did you make any code for its detection.

rahul hada

unread,
Apr 17, 2015, 12:30:18 PM4/17/15
to ns-3-...@googlegroups.com
The code I have added is specific to ns3

Pinky

unread,
Apr 17, 2015, 1:08:42 PM4/17/15
to ns-3-...@googlegroups.com
rahul sir,
 will you pls kindly post the topology script that you used to run your protocol given here.

rahul hada

unread,
Apr 17, 2015, 1:10:06 PM4/17/15
to ns-3-...@googlegroups.com

i had already posted in the group.

Pinky

unread,
Apr 17, 2015, 1:16:12 PM4/17/15
to ns-3-...@googlegroups.com
rahul sir,
 i didn't got it. will you pls send me the link

rahul hada

unread,
Apr 17, 2015, 1:19:06 PM4/17/15
to ns-3-...@googlegroups.com

Pinky

unread,
Apr 17, 2015, 1:29:03 PM4/17/15
to ns-3-...@googlegroups.com
thank you sir.
sir, have you done the code for detection of wormhole attack also

rahul hada

unread,
Apr 17, 2015, 1:30:50 PM4/17/15
to ns-3-...@googlegroups.com
yes , but still require some time to make for effective.

Pinky

unread,
Apr 17, 2015, 1:34:49 PM4/17/15
to ns-3-...@googlegroups.com
sir,
can you pls provide me the code for detection. you can also mail me in pinkyb...@gmail.com

rahul hada

unread,
Apr 17, 2015, 1:37:23 PM4/17/15
to ns-3-...@googlegroups.com
Sorry , as I have already told you I am still working on an cant share it before.



Pinky

unread,
Apr 17, 2015, 1:44:37 PM4/17/15
to ns-3-...@googlegroups.com
ok sir.

decent gimu

unread,
Apr 18, 2015, 11:04:05 AM4/18/15
to ns-3-...@googlegroups.com
hello sir

can you please tell me how to perform wormhole attack in ns2. Is this attack is only possible by using ns3 and not by ns2. If it is also possible in ns2 then please guide me.

Regards
Gimu

ok sir.

rahul hada

unread,
Apr 18, 2015, 12:57:07 PM4/18/15
to ns-3-...@googlegroups.com
These attack can be performed by any simulation tool but as ns3 is latest and results are very much realistic.

decent gimu

unread,
Apr 18, 2015, 1:12:56 PM4/18/15
to ns-3-...@googlegroups.com
hello sir

So sir please tell the steps to create wormhole attack in ns2. What should I do and in which file should I make changes.

Regards
Gimu

Tommaso Pecorella

unread,
Apr 18, 2015, 2:14:35 PM4/18/15
to ns-3-...@googlegroups.com
I am deeply impressed by how Rahul is reacting to this message bombing. Let's see if I can clarify some points.

1) ns2 and ns-3 are different simulation systems. Please do NOT ask for ns2 support to Rahul because he's working with ns-3, not with ns2.
2) Rahul already posted the code (just the attack, not the detection). Please search the forums and this thread. Do not pressure him, you're not going to make things happen faster.
3) Understand and acknowledge that you're basically asking someone to work for you. At least don't stress him.
4) I wouldn't have been so patient.

Have fun,

T.

pipe lin

unread,
Apr 18, 2015, 9:28:20 PM4/18/15
to ns-3-...@googlegroups.com

I agree with Tommaso. Please, stop asking for help if it is related to give the code for "free". I recommend working for you own reading the tutorial and supporting the community.

decent gimu

unread,
Apr 18, 2015, 10:08:12 PM4/18/15
to ns-3-...@googlegroups.com
I also agree with Tommaso. But I was just asking help regarding the steps which are used to perform wormhole attack not for the code. And if you want that other people also suffer from same problem regarding ns2 which you have already faced in the past then what is the benefit of having such groups, I am also impressed by Rahul for replying our messages.Thank u Rahul and sorry for the inconvenience.

Regards
Gimu

rahul hada

unread,
Apr 18, 2015, 11:09:10 PM4/18/15
to ns-3-...@googlegroups.com
Dear Gimu,

Sharing a code helps people "not to reinvent wheel" and this is the only purpose of sharing.

- ns3-users group is a BEST group and I have learnt so many thing from this platform.Such platform motivates us for sharing knowledge.
- Thank You Tommaso for the words of appreciation such words motivates us to more good things.
- Thank You Pipe lin to motivate other for sharing in community.
- Gimu if you follow my conversation of this thread then you easily find the steps to perform wormhole attack in ns3, I have no idea related to the ns2.
Please find attached flow chart for of the Wormhole attack using aodv-routing-protocol.cc and aodv-routing-protocol.cc
- Kindly have a look on the following link:

Inline image 1
 
source wikipedia
AttackModified_01.pdf

decent gimu

unread,
Apr 18, 2015, 11:58:18 PM4/18/15
to ns-3-...@googlegroups.com
Thank you Rahul.Thank u very much.

rahul hada

unread,
Dec 28, 2013, 4:49:11 AM12/28/13
to ns-3-...@googlegroups.com
Dear ,
What type of attach you want to simulate and what is objective for simulation.


Rahul

On 12/27/13, shagrev Bashnag <shari...@gmail.com> wrote:
> Hi sir,
>
> I really need your help. I can´t get the results expected for the
> simulation. Do you have the topology script or the results, please? I got
> to get this results or something similar and show them to my associate
> professor before january 1th.
>
> thanks a lot sir.
>
>
> 2013/12/16 rahul hada <hada....@gmail.com>
>
>> Dear ,
>>
>> The things which i have properly done is the simulation of the wormhole
>> attack
>> and you can find variable bool EnableWrmAttack in the .h file of aodv
>> routing , which will we enabled by the user while writing the topology
>> script and
>>
>> ex: if (EnableWrmAttack)
>> {
>> //section of code to detect to detect the wormhole attack
>> }
>>
>> I am still working on the detection method of the wormhole attack, so
>> either you have to wait for few more days or you can insert your own
>> method
>> into it.
>> and problem section of the Forwarding method is related with the
>> detection
>> of wormhole attack.
>>
>> Rahul Hada
>>
>>
>>
>> On Mon, Dec 16, 2013 at 9:13 AM, shagrev Bashnag
>> <shari...@gmail.com>wrote:
>>
>>> By Reading your code I realized two things.
>>> 1. In RoutingProtocol::Forwarding (), you comment the following:
>>>
>>>
>>> // problem is here
>>> /*Code Section : In this we need to increment the ttl so
>>> that hello message send from source to destination reached properly
>>> * */
>>>
>>> Did you already solve this problem? In this case. How did you do this.
>>> Is
>>> it important? What does it mean?.
>>>
>>> 2. I want to know if the wrmDetect Method is already implemented.
>>>
>>>
>>> Two last questions. Do you have results of this implementation? what
>>> problems did you find in implementing this wormhole attack?
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "ns-3-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> ns-3-users+...@googlegroups.com.
>>> To post to this group, send email to ns-3-...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/ns-3-users.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "ns-3-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> ns-3-users+...@googlegroups.com.
>> To post to this group, send email to ns-3-...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/ns-3-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ns-3-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ns-3-users+...@googlegroups.com.
> To post to this group, send email to ns-3-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ns-3-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

masoume Heidari

unread,
Jan 4, 2014, 10:05:22 AM1/4/14
to ns-3-...@googlegroups.com
Hi dear
I want to simulate Wormhole attack in NS2. but can't it.
 please help me.



gopiar...@gmail.com

unread,
Sep 16, 2014, 6:42:44 AM9/16/14
to ns-3-...@googlegroups.com
odv-routing-protocol.h [1892/2256] cxx: src/worm-hole/examples/worm-hole-example.cc -> build/src/worm-hole/examples/worm-hole-example.cc.1.o ../src/worm-hole/examples/worm-hole-example.cc: In member function ‘void AodvExample::InstallInternetStack()’: ../src/worm-hole/examples/worm-hole-example.cc:210:38: error: a function-definition is not allowed here before ‘{’ token      void SetWrmAttackEnable (bool t) { EnableWrmAttack =t; }                                        ^ ../src/worm-hole/examples/worm-hole-example.cc:211:36: error: a function-definition is not allowed here before ‘{’ token    bool GetWrmAttackEnable () const { return EnableWrmAttack; }                                     ^ ../src/worm-hole/examples/worm-hole-example.cc:216:1: error: a function-definition is not allowed here before ‘{’ token  {  ^ ../src/worm-hole/examples/worm-hole-example.cc:228:1: error: expected ‘}’ at end of input  }  ^ Waf: Leaving directory `/home/gopi/repos/ns-3-allinone/tarballs/ns-allinone-3.19
Message has been deleted

SAMI -S

unread,
Oct 1, 2015, 2:19:19 PM10/1/15
to ns-3-users
Hi All,

I have copied all the files that Rahul changed to cause a wormhole attack on the AODV protocol and placed them inside the model folder. After that I copied one of the example files from (ns-allinone-3.24/ns-3.24/src/
aodv/examples/) to scratch folder. when I typed this command (./waf) it rebuild all the files and then show this message
Modules not built (see ns-3 tutorial for explanation):
brite                     click                     openflow

Next I typed ./waf -runn scratch/theexample file and show this error message

*******:~/Downloads/ns-allinone-3.24/ns-3.24$ ./waf --run scratch/aodvrand
Waf: Entering directory `/home/*****/Downloads/ns-allinone-3.24/ns-3.24/build'
Waf: Leaving directory `/home/*****/Downloads/ns-allinone-3.24/ns-3.24/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (2.964s)
assert failed. cond="m_endPoint == 0", msg="Endpoint already allocated (maybe you used BindToNetDevice before Bind).", file=../src/internet/model/udp-socket-impl.cc, line=253
terminate called without an active exception
Command ['/home/*****/Downloads/ns-allinone-3.24/ns-3.24/build/scratch/aodvrand'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").


Can anyone suggest or help ?

rahul hada

unread,
Oct 1, 2015, 3:49:10 PM10/1/15
to ns-3-...@googlegroups.com
Dear SAMI , 

You need to just replace the aodv protocol related files .cc and .h and use waf to rebuild the source.



--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Tommaso Pecorella

unread,
Oct 1, 2015, 6:16:04 PM10/1/15
to ns-3-users
Dear Sami,

I know that an error message stating "assert failed. cond="m_endPoint == 0", msg="Endpoint already allocated (maybe you used BindToNetDevice before Bind).", file=../src/internet/model/udp-socket-impl.cc, line=253" may seems obscure to anyone but the most skilled and experienced developer, but you can trust me if I say that you can understand what is the meaning of it, just by looking at the code. This, of course, means that you should be able to read some C++.

Anyway, the very same problem was discussed in the past, and I already pointed out more than once that it's a matter of swapping two ***** lines of code in a **** file.
I trust that if you search for it, you'll find it.

T.

Chirag Jamadagni

unread,
Nov 4, 2015, 11:30:47 AM11/4/15
to ns-3-users
Rahul,

Thank you very much for your implementation of the wormhole attack in AODV in ns3. My teammate and I have designed an example code in ns-3.24.1 to demonstrate the working of the same. We would really appreciate it if you could look through the example code and suggest appropriate changes, if any. The code is attached for your consideration. 

We hope this example can go towards answering the many requests on this thread. Thank you for your time and patience.

Regards,
Chirag Jamadagni and Amita Kamath
Undergraduate students, Computer Science and Engineering
NITK Surathkal, India
myapp.h
wormhole.cc

rahul hada

unread,
Nov 4, 2015, 12:18:37 PM11/4/15
to ns-3-...@googlegroups.com
Dear Chirag,

At first I would like to express my gratitude for providing such a demanded script for the ns3-users.

Nice Work Chirag I really appreciate your work.

I will surely check the code and suggest some value addition points.


Regards,

Rahul Hada


Yaser Azimi

unread,
Nov 8, 2015, 4:08:52 PM11/8/15
to ns-3-...@googlegroups.com
hi
i use your wormhole attack in ns3 but occur this error, can you help me??
what's the problem?
thank you

arezoo@ubuntu:~/source/ns-3.17$ ./waf --run scratch/wormhole
Waf: Entering directory `/home/arezoo/source/ns-3.17/build'
Waf: Leaving directory `/home/arezoo/source/ns-3.17/build'
'build' finished successfully (6.242s)
msg="Invalid attribute set (FirstEndWifiWormTunnel) on
ns3::aodv::RoutingProtocol", file=../src/core/model/object-factory.cc,
line=69
terminate called without an active exception
Command ['/home/arezoo/source/ns-3.17/build/scratch/wormhole']
terminated with signal SIGIOT. Run it under a debugger to get more
information (./waf --run <program> --command-template="gdb --args %s
<args>").


> You received this message because you are subscribed to the Google Groups
> "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an

avani mahajan

unread,
Feb 11, 2016, 3:36:07 AM2/11/16
to ns-3-users
hello sir.. the code is giving error.. May you please help me in this code??
PFA
Screenshot from 2016-02-11 00:10:26.png

Konstantinos

unread,
Feb 11, 2016, 3:43:29 AM2/11/16
to ns-3-users
Dear Avani,

It is not enough to run the scenario that Chirag posted. 
You have to modify AODV for that. 

Avani Mahajan

unread,
Feb 19, 2016, 3:44:36 AM2/19/16
to ns-3-users
Thankyou so much sir.. but after placing the files of aodv protocol in model folder. agai i am facing the following errors:

avani@avani-Inspiron-3542:~/ns-allinone-3.23/ns-3.23$ sudo ./waf --run scratch/wormhole --vis
[sudo] password for avani:
Waf: Entering directory `/home/avani/ns-allinone-3.23/ns-3.23/build'
[  10/2447] install-ns3-header: src/aodv/model/aodv-routing-protocol.h -> build/ns3/aodv-routing-protocol.h
[ 861/2447] cxx: scratch/blackhole.cc -> build/scratch/blackhole.cc.4.o
[ 863/2447] cxx: scratch/wormhole.cc -> build/scratch/wormhole.cc.2.o
[ 864/2447] cxx: scratch/jellyfish1.cc -> build/scratch/jellyfish1.cc.1.o
[1446/2447] cxx: build/src/aodv/bindings/ns3module.cc -> build/src/aodv/bindings/ns3module.cc.7.o
In file included from ./ns3/aodv-module.h:15:0,
                 from ../scratch/blackhole.cc:17:
./ns3/aodv-routing-protocol.h:94:8: error: ‘bool ns3::aodv::RoutingProtocol::WORMHOLE’ conflicts with a previous declaration
   bool WORMHOLE;
        ^
./ns3/aodv-routing-protocol.h:58:15: note: previous declaration ‘bool ns3::aodv::RoutingProtocol::WORMHOLE’
   static bool WORMHOLE;
               ^
In file included from ./ns3/aodv-module.h:15:0,
                 from ../scratch/wormhole.cc:30:
./ns3/aodv-routing-protocol.h:94:8: error: ‘bool ns3::aodv::RoutingProtocol::WORMHOLE’ conflicts with a previous declaration
   bool WORMHOLE;
        ^
./ns3/aodv-routing-protocol.h:58:15: note: previous declaration ‘bool ns3::aodv::RoutingProtocol::WORMHOLE’
   static bool WORMHOLE;
               ^
In file included from ./ns3/aodv-module.h:15:0,
                 from src/aodv/bindings/ns3module.h:78,
                 from src/aodv/bindings/ns3module.cc:1:
./ns3/aodv-routing-protocol.h:94:8: error: ‘bool ns3::aodv::RoutingProtocol::WORMHOLE’ conflicts with a previous declaration
   bool WORMHOLE;
        ^
./ns3/aodv-routing-protocol.h:58:15: note: previous declaration ‘bool ns3::aodv::RoutingProtocol::WORMHOLE’
   static bool WORMHOLE;
               ^
In file included from ./ns3/aodv-module.h:15:0,
                 from ../scratch/jellyfish1.cc:8:
./ns3/aodv-routing-protocol.h:94:8: error: ‘bool ns3::aodv::RoutingProtocol::WORMHOLE’ conflicts with a previous declaration
   bool WORMHOLE;
        ^
./ns3/aodv-routing-protocol.h:58:15: note: previous declaration ‘bool ns3::aodv::RoutingProtocol::WORMHOLE’
   static bool WORMHOLE;
               ^
Waf: Leaving directory `/home/avani/ns-allinone-3.23/ns-3.23/build'
Build failed
 -> task in 'blackhole' failed (exit status 1):
    {task 139831737916048: cxx blackhole.cc -> blackhole.cc.4.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-pthread', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/freetype2', '-I/usr/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_SQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '../scratch/blackhole.cc', '-c', '-o', 'scratch/blackhole.cc.4.o']
 -> task in 'wormhole' failed (exit status 1):
    {task 139831737884368: cxx wormhole.cc -> wormhole.cc.2.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-pthread', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/freetype2', '-I/usr/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_SQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '../scratch/wormhole.cc', '-c', '-o', 'scratch/wormhole.cc.2.o']
 -> task in 'ns3module_aodv' failed (exit status 1):
    {task 139831741194896: cxx ns3module.cc -> ns3module.cc.7.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-pthread', '-fno-strict-aliasing', '-fwrapv', '-fstack-protector-strong', '-fno-strict-aliasing', '-fwrapv', '-fstack-protector-strong', '-fno-strict-aliasing', '-fvisibility=hidden', '-Wno-array-bounds', '-pthread', '-pthread', '-I.', '-I..', '-Isrc/aodv/bindings', '-I../src/aodv/bindings', '-I/usr/include/python2.7', '-I/usr/include/x86_64-linux-gnu/python2.7', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/freetype2', '-I/usr/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_SQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '-DNS_DEPRECATED=', '-DNS3_DEPRECATED_H', '-DNDEBUG', '-D_FORTIFY_SOURCE=2', '-DNDEBUG', '-D_FORTIFY_SOURCE=2', 'src/aodv/bindings/ns3module.cc', '-c', '-o', 'src/aodv/bindings/ns3module.cc.7.o']
 -> task in 'jellyfish1' failed (exit status 1):
    {task 139831737882896: cxx jellyfish1.cc -> jellyfish1.cc.1.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-pthread', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/freetype2', '-I/usr/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_SQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '../scratch/jellyfish1.cc', '-c', '-o', 'scratch/jellyfish1.cc.1.

sai

unread,
Apr 22, 2016, 11:10:51 AM4/22/16
to ns-3-users


hello sir,

I copied the given files aodv-routing-protocol.cc , aodv-routing-protocol.h in src/aodv/model.
it builds fine
but i am not able to understand the output and also the simulation of the same in netanim
can you guide me, by providing the screenshot of the output in netanim.

Thanks in advance :)

Patel Nilam

unread,
Sep 29, 2016, 4:42:13 AM9/29/16
to ns-3-users
Hello Sir , i want to source code of sinkhole attack in ns3 , using AODV routing protocol detect and prevent the sinkhole attack in wsns.
please send me the code of detecting sinkhole attack in wsns using ns3 simulation.

rahul hada

unread,
Oct 1, 2016, 8:52:58 PM10/1/16
to ns-3-users
Dear Nilam,

You have to modify the aodv routing protocol you can take reference of wormhole and blackhole code from the following link.


Rahul


--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.

venkyven...@gmail.com

unread,
Dec 19, 2016, 1:23:56 AM12/19/16
to ns-3-users

hiii sir when i copy those 2 files iam getting errors like this.
Build failed
 -> task in 'aodv-routing-protocol' failed (exit status 1):
    {task 139930163371408: cxx aodv-routing-protocol.cc -> aodv-routing-protocol.cc.2.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-I.', '-I..', '-DNS3_BUILD_PROFILE_DEBUG', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '../scratch/aodv-routing-protocol.cc', '-c', '-o', '/home/sasi/ns-allinone-3.25/ns-3.25/build/scratch/aodv-routing-protocol.cc.2.o']

On Wednesday, February 25, 2015 at 10:32:16 PM UTC+5:30, rahul hada wrote:
Dear ,

For the simulation of Wormhole attack you can use following AODV files 
copy the below two file in .../src/aodv/model

- aodv-routing-protocol.cc 
- aodv-wouting-protocol.h 

On Wed, Feb 25, 2015 at 10:18 PM, Pranava Durai <pranav...@gmail.com> wrote:
while i run the code wormhole attack i have these errors.can anyone  help me??
 
 Thank you,
../scratch/aodv-routing-protocol.cc: In static member function ‘static ns3::TypeId ns3::aodv::RoutingProtocol::GetTypeId()’:
../scratch/aodv-routing-protocol.cc:276:25: error: ‘SetWrmDetectEnable’ is not a member of ‘ns3::aodv::RoutingProtocol’
    MakeBooleanAccessor(&RoutingProtocol::SetWrmDetectEnable,
                         ^
../scratch/aodv-routing-protocol.cc:277:12: error: ‘GetWrmDetectEnable’ is not a member of ‘ns3::aodv::RoutingProtocol’
           &RoutingProtocol::GetWrmDetectEnable),
            ^
../scratch/aodv-routing-protocol.cc: In member function ‘virtual void ns3::aodv::RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper>) const’:
../scratch/aodv-routing-protocol.cc:318:31: error: no matching function for call to ‘ns3::aodv::RoutingTable::Print(ns3::Ptr<ns3::OutputStreamWrapper>&) const’
   m_routingTable.Print (stream);
                               ^
../scratch/aodv-routing-protocol.cc:318:31: note: candidate is:
In file included from ../scratch/aodv-routing-protocol.h:31:0,
                 from ../scratch/aodv-routing-protocol.cc:31:
../scratch/aodv-rtable.h:245:8: note: void ns3::aodv::RoutingTable::Print(std::ostream&)
   void Print(std::ostream &os);
        ^
../scratch/aodv-rtable.h:245:8: note:   no known conversion for argument 1 from ‘ns3::Ptr<ns3::OutputStreamWrapper>’ to ‘std::ostream& {aka std::basic_ostream<char>&}’
../scratch/aodv-routing-protocol.cc: In member function ‘void ns3::aodv::RoutingProtocol::RecvReply(ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address)’:
../scratch/aodv-routing-protocol.cc:1499:6: error: ‘EnableWrmDetect’ was not declared in this scope
   if(EnableWrmDetect)
      ^
../scratch/aodv-routing-protocol.cc:1583:11: error: ‘EnableWrmDetect’ was not declared in this scope
        if(EnableWrmDetect)


On Tuesday, 29 January 2013 05:49:25 UTC+5:30, rahul hada wrote:
Hello Everyone,

What is the best way to simulate wormhole attack using aodv routing protocol

Thank in Advance :)

Rahul

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.

venkyven...@gmail.com

unread,
Dec 19, 2016, 1:30:38 AM12/19/16
to ns-3-users

Tommaso Pecorella

unread,
Dec 24, 2016, 6:36:03 PM12/24/16
to ns-3-users
Hi,

please consider reading all the error messages: they are usually very informative if you can understand them.
As a side note, the error is always at the very top of the "strange" output. What you posted is just the end of the error, i.e., the line stating that the build failed, but it doesn't say why. As a consequence, the answer is: no idea.

T.

PS. the files are a bit old, perhaps things changed over the time ?

Glace Babu

unread,
Feb 15, 2017, 12:09:41 AM2/15/17
to ns-3-users

hi sir, sir can u please suggest a method to detect worm hole attack with ns3,let me share an algorithm with which i would like to do the detection ,please check whether it is ok or not

Tommaso Pecorella

unread,
Feb 16, 2017, 10:55:32 AM2/16/17
to ns-3-users
Hi,

unfortunately I'm not very expert in this kind of attack detection. However, you can find a quite long literature on Internet. Just read the papers and be careful about good ideas that can not be implemented (because they're assuming impossible things).

About the algorithm you posted, it sounds interesting, but I can spot some issues:
1) packets could not arrive at destination at all.
2) in a multi-hop network it is possible that the malicious node isn't the last one, but one in between.
3) the algorithm is based on the assumption that a malicious node will use more time than a normal node to forward a packet, and this is not always true.

Cheers,

T.

hs.elcn...@gmail.com

unread,
Apr 27, 2017, 1:46:55 PM4/27/17
to ns-3-users
Hi everyone, and thanks Rahul Hada for posting the code regarding wormhole attack.
As you know wormhole attack can be implemented in several ways including out-of-band channel, packet encapsulation, high power transmission, etc.
Can you please tell me which kind does this code simulate?

rahul hada

unread,
Jul 31, 2017, 6:06:35 AM7/31/17
to ns-3-users, hs.elcn...@gmail.com
Sorry for the delay in response.
I have used packet encapsulation method 

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.
Message has been deleted

sadiqullah samsoor

unread,
Oct 8, 2017, 6:54:14 PM10/8/17
to ns-3-users
Dear rahul hada
kindly sir, upload wormhole attack detection and provention code in ns3.


On Tuesday, 29 January 2013 05:49:25 UTC+5:30, rahul hada wrote:
Hello Everyone,

What is the best way to simulate wormhole attack using aodv routing protocol

Thank in Advance :)

Rahul

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.

sadiqullah samsoor

unread,
Oct 8, 2017, 6:57:56 PM10/8/17
to ns-3-users

Harry May

unread,
Nov 29, 2017, 5:32:08 PM11/29/17
to ns-3-users

Hopefully this is the correct posting area:

-          First I would like to say that whoever wrote the tutorial for NS-3 did an excellent job.  I was impressed how the topics flowed from one area to the other.  Also, I really liked the explanations for each piece of code in the examples.

-          After going through all the examples, I have a better understanding of how NS-3 works and where everything is located in Ubuntu.

-          Since I am a beginner in the Linux OS, I don’t understand how some things are done, especially recompiling.

-          I am interested in the wormhole attack so I have been reading all the posts by you on the subject.  Along with this, I have downloaded the files: aodv-routing-protocol.cc, aodv-routing-protocol.h, myapp.h, and the example program, wormhole.cc.

-          Here are my questions:

o   After putting the aodv-routing-protocol.cc and aodv-routing-protocol.h into the ns-3.27/src/aodv/model directory, do I have to recompile NS-3?

o   If I do recompile, what directory do I need to change to?  What command do I use to recompile?

o   The example file, wormhole.cc, is put in the scratch directory. I am guessing the myapp.h should also be put in there.

o   Does a step-by-step tutorial exist on wormhole attacks in NS-3?


Thanks!

Harry May


On Monday, July 31, 2017 at 5:06:35 AM UTC-5, rahul hada wrote:
Sorry for the delay in response.
I have used packet encapsulation method 
On Thu, Apr 27, 2017 at 11:16 PM, <hs.elcn...@gmail.com> wrote:
Hi everyone, and thanks Rahul Hada for posting the code regarding wormhole attack.
As you know wormhole attack can be implemented in several ways including out-of-band channel, packet encapsulation, high power transmission, etc.
Can you please tell me which kind does this code simulate?

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/95eIAB2jOOw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

Tommaso Pecorella

unread,
Nov 30, 2017, 6:41:13 PM11/30/17
to ns-3-users
Hi,

answers in-line.


On Wednesday, November 29, 2017 at 11:32:08 PM UTC+1, Harry May wrote:

Hopefully this is the correct posting area:

-          First I would like to say that whoever wrote the tutorial for NS-3 did an excellent job.  I was impressed how the topics flowed from one area to the other.  Also, I really liked the explanations for each piece of code in the examples.

-          After going through all the examples, I have a better understanding of how NS-3 works and where everything is located in Ubuntu.

-          Since I am a beginner in the Linux OS, I don’t understand how some things are done, especially recompiling.

-          I am interested in the wormhole attack so I have been reading all the posts by you on the subject.  Along with this, I have downloaded the files: aodv-routing-protocol.cc, aodv-routing-protocol.h, myapp.h, and the example program, wormhole.cc.

-          Here are my questions:

o   After putting the aodv-routing-protocol.cc and aodv-routing-protocol.h into the ns-3.27/src/aodv/model directory, do I have to recompile NS-3?


Yes

o   If I do recompile, what directory do I need to change to?  What command do I use to recompile?


Assuming that you're using ns-3.27, in the ns-3.27 directory. I.e., the same directory you used in the tutorial when you ran "./waf".
The command is... "./waf".
 

o   The example file, wormhole.cc, is put in the scratch directory. I am guessing the myapp.h should also be put in there.


Yes
 

o   Does a step-by-step tutorial exist on wormhole attacks in NS-3?


No idea, check the post where you downloaded the modified aodv and wormhole.cc from.

Happy coding,


T.

Harry May

unread,
Dec 5, 2017, 4:12:57 PM12/5/17
to ns-3-users
First, I would like to thank Tommaso for his reply to my questions about compilation commands.  After recompiling using the following commands:
./waf clean
./waf configure --build-profile=optimized --enable-examples --enable-tests
./waf build
everything worked fine until today when I found out that 'waf' now has 2 versions (.waf-2.0.2-b8fa...; and .waf-1.8.19-b1fc...). I didn't tell it to update but somehow it did.  When I try to run the command ./waf build I receive the error "The project was not configured: run "waf configure" first.  When I run "./waf configure", I get error messages relating to several files including Scripting.py, Configure.py, Context.py, etc.

So here are my questions:
Can I uninstall waf and reinstall it? 
Do I have to uninstall it? (Is there some way of getting it to work again?)

The original question that I had was about implementing a wormhole in NS-3.  I downloaded the aodv-routing-protocol.cc, aodv-routing-protocol.h, myapp.h, and wormhole.cc and put them in the appropriate directories.  Needless to say (before the ./waf problem), recompiling would give me an error.  The recompiling took about 1 hour.  I found The Waf Book by Thomas Nagy looking for answers to my questions concerning recompiling.  Here are my questions:

Is there a method for the compiler to only recompile changes to the aodv-routing-protocol.cc? (Couldn't find it in The Waf Book)
The error received is "Invalid new expression of abstract class 'ns3::aodv::RoutingProtocol'". Any suggestions or references?

The more I dig into NS-3 the more questions I have so I appreciate any responses to problems/questions that arise.

Thanks again!
Harry May

Harry May

unread,
Dec 7, 2017, 2:03:43 PM12/7/17
to ns-3-users
PARTIAL SOLUTION:
I finally found a partial solution to my problem. This part refers to the errors received during the ./waf compilation.  My error messages were similar to Avani Mahajan's messages above, posted on 02/19/16.  To fix the problem, I did the following:
cd workspace/ns-allinone-3.27
./build.py --enable-examples --enable-tests
After this was done, I ran the tests to see if they worked using
cd ns-3.27 
 ./test.py
 In my case, every one of the tests worked correctly.  Now, I moved on to the ./waf command using
./waf -d debug --enable-examples --enable-tests configure
I am now able to use the ./waf command.

Hope this helps someone!
At this point, I am still having problems recompiling the wormhole files correctly.

Harry May 

Harry May

unread,
Dec 12, 2017, 1:55:22 PM12/12/17
to ns-3-users
FOUND ERRORS:
After posting a partial solution on 12/07/17, I found 4 errors in the 2 files that was downloaded from Rahul Hada on 02/25/15.  

The 2 files are aodv-routing-protocol.cc and aodv-routing-protocol.h.

The errors were spelling errors as follows:
            Desination instead of Destination (2 occurrences)
            Gratious instead of Gratuitous (2 occurrences)

To rebuild, you only have to issue the ./waf command.  Mine recompiled without errors.
The next thing I did was to download the example files as posted by Chirag Jamadagni on 11/04/15.
They recompiled without errors if I didn't put the --viz command for visualization.  I am working on that now.

Hope this helps someone!

Harry May

thuraya...@gmail.com

unread,
Jan 5, 2018, 10:44:33 PM1/5/18
to ns-3-users
thanks a lot for  Rahul hada for this great post, and how great he is  sharing his work with us. 
thank you so much Harry, for your solution posts.  
Harry, I am working in the same area now. can you please share your information with me please. please send me the code that you did modify and if you have another information relating to the wormhole attack on my email: thurayaaljaberi@gmail.com
thanks a lot :) 
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

rbah yahya

unread,
Feb 21, 2018, 5:00:34 PM2/21/18
to ns-3-users



Hello every one
i want to simulate wormhole attack using aodv routing protocol in ns2 or ns3
can you help me??

Thank in Advance :)

Yahya

It is loading more messages.
0 new messages