Skip to main content

Wormhole Attack in ns2 with full source code

Wormhole attack in ns2 - with full source code.

OS Used: Ubuntu 18.04 LTS
Ns2 version - 2.35

Just three files are to be modified
arp.cc

ll.h

ll.cc

Download link for all the files .cc, .h and .tcl files

https://drive.google.com/open?id=1l2Fc43lirb3J008czDAhb_A8hvAPCdbH

All these files are located in the ~ns-2.35/mac/

How to do?
Copy all the above three files in the mac/ folder and open the terminal

$] cd ns-allinone-2.35/ns-2.35

$] make 

You should not get any error. Once done, open the tcl files given in the folder ex-wormhole and run the examples and predict the performance as per the video given above.


What is wormhole?

How to download the files. I will give the copy of the above three files in my website https://www.nsnam.com

Very soon, I will move to github.

Subscribe to my youtube channel and share.

Explanation of Wormhole Attack

Hope you would have enjoyed this worm hole attack in ns2.

Please download the full source code from my website

https://www.nsnam.com

If you need more information, Please comment in my youtube channel.

Subscribe and share

https://www.youtube.com/tspradeepkumar

Engineering Clinic.

T S Pradeep Kumar

Subscribe to my Youtube Channel for More Videos

Comments

  1. Sir, Can I implement DCCP (Congestion Control Protocol) agents which are CCID2(TCPLike) and CCID3(TFRC) in mobile adhoc network in ns2. Please guide me for making network for wireless(MANET). If you can make video lecture on this it will be really helpful for us. Thanks sir please suggest me..

    ReplyDelete
  2. black hole attack in delay tolerant network with Ns2,full source code

    ReplyDelete
  3. Sir, I have implemented wormhole attack with the help of this video. But what are the parameters which can help me to prove the differences in normal and wormhole simulation.

    hitesh@hitesh-Inspiron-3542:~/Downloads/wormhole/ex-wormhole-1$ ns 1.tcl
    num_nodes is set 16
    INITIALIZE THE LIST xListHead
    (014) - LL::command - added 15 to wormhole peer list
    channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
    highestAntennaZ_ = 0.2, distCST_ = 763.1
    SORTING LISTS ...DONE!
    hitesh@hitesh-Inspiron-3542:~/Downloads/wormhole/ex-wormhole-1$ ns 1.tcl
    num_nodes is set 16
    INITIALIZE THE LIST xListHead
    channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
    highestAntennaZ_ = 0.2, distCST_ = 763.1
    SORTING LISTS ...DONE!
    hitesh@hitesh-Inspiron-3542:~/Downloads/wormhole/ex-wormhole-1$ ns 1.tcl
    num_nodes is set 16
    INITIALIZE THE LIST xListHead
    (014) - LL::command - added 15 to wormhole peer list
    channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
    highestAntennaZ_ = 0.2, distCST_ = 763.1
    SORTING LISTS ...DONE!
    hitesh@hitesh-Inspiron-3542:~/Downloads/wormhole/ex-wormhole-1$ cat worm.tr | wc -l
    14718
    hitesh@hitesh-Inspiron-3542:~/Downloads/wormhole/ex-wormhole-1$ cat good.tr | wc -l
    14686

    ReplyDelete
  4. can you please explain how to install ns3 in ubuntu 18.04

    ReplyDelete
  5. Sir,
    there is an error when uncomment two line in tcl file.
    "[$n14 set ll_(0)] wormhole-peer [$n15 set ll_(0)]
    [$n15 set ll_(0)] wormhole-peer [$n14 set ll_(0)]"


    Here is the error output

    "num_nodes is set 16
    INITIALIZE THE LIST xListHead

    (_o351 cmd line 1)
    invoked from within
    "_o351 cmd wormhole-peer _o329"
    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 "_o351" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "[$n15 set ll_(0)] wormhole-peer [$n14 set ll_(0)]"
    (file "2worm14.tcl" line 174)"

    ReplyDelete

Post a Comment

Popular posts from this blog

Routing in VANETs using ns3

Part 1
WAVE - Wireless Access for Vehicular environments. vanet-routing-compare.cc It might take more than an hour. The readers are requested to be patient. SUMO, VANETs, routing comparison 1. Explain the full source code (1550 lines of code) 2. Creating a real scenario using osm (Open Street Map Web Wizard) 3. Performance analysis for various vanet protocols. https://www.nsnam.com Location of the source code /home/pradeepkumar/ns-allinone-3.27/ns-3.27/src/wave/examples
Move this file to the scratch/ for inclusion of all modules. Step 1: Explanation of source code. Copy the file to scratch folder. This is just Part 1 of the VANET comparison

Part 2 Please watch the First Part before watching this video   https://www.youtube.com/watch?v=IJYeIpUqjQI&t=850s
Part 2 - Analysis of the results.
Please go through the first video (Part 1) and then watch this video (PArt 2)
#VANETs #NS3 #Routing
1. SUMO for web traffic (osmWebWizard.py) 2. Convert this into mobility.tcl file and t…

ns3 installation in Ubuntu 16.04

This post serves the installation instructions of ns3 in ubuntu 16.04 version. Some of my students are working in ns3, this post will benefit them in installing ns3.

OS Used: Ubuntu 16.04.4
ns3 version: ns3 version 3.27

The same procedure will be applied for OS like Debian, Linux Mint.

Fresh installation of Ubuntu 16.04 Let you try the fresh installation of ubuntu in your hard disk along with windows.
Installation of ns3 dependencies ns3 needs so many dependencies, developmental libraries, drivers, etc. so install all those
$] sudo apt update  $] sudo apt upgrade
$] sudo apt-get install build-essential autoconf automake libxmu-dev python-pygoocanvas python-pygraphviz cvs mercurial bzr git cmake p7zip-full python-matplotlib python-tk python-dev python-kiwi python-gnome2 python-gnome2-desktop-dev python-rsvg qt4-dev-tools qt4-qmake qt4-qmake qt4-default gnuplot-x11 wireshark
The above command make take some time to download, compile and install it, Be Patient. 
Installing ns3 Download the…

TORA Protocol in NS-2.35 (NS2)

This post tells you how to enable the TORA (Temporally ordered routing Algorithm) protocol in Network Simulator 2 (ns-2.35)

TORA is a protocol in wireless adhoc networks that works with timing parameters. NS-2.35 comes with the TORA protocol by default but it has to be tweaked manually to make it run.
This post will help you to do that.

You can watch this video for detailed instructions:


Step 1: Generate a Scenario for TORA protoco using NS2 Scenario Generator NSG Software.
We have created a tcl file using NSG2.1.jar

$] java -jar NSG2.1.jar

Three files have to be modified
~ns-2.35/tora/tora.cc~ns-2.35/tora/tora.h~ns-2.35/imep/imep.cc There are various websites that tells you how to configure TORA by making changes to the above three files.  Change 1: tora.h In the tora.h file, go to the end of the File before the agent completes, include these two lines

#include <classifier/classifier-port.h>
protected: PortClassifier *dmux_;

Change 2: tora.cc Open the tora.cc and include the follow…