blackhole attack

285 views
Skip to first unread message

Patel Nilam

unread,
Feb 8, 2017, 12:22:22 PM2/8/17
to Network Simulator 2 (NS2)
respected sir
when I run blackholeattack.c file from all files folder which are posted by http://ns2codeforblackholeattack.blogspot.in/2013/06/blackhole-attack.html this link using ns-allinone-2.35. i found following error. pls do needful to me.


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"

Hà Duy Anh

unread,
Apr 18, 2018, 1:50:54 PM4/18/18
to Network Simulator 2 (NS2)
Did you fix it??I also encounter the same error.

Vào 00:22:22 UTC+7 Thứ Năm, ngày 09 tháng 2 năm 2017, Patel Nilam đã viết:

knudfl

unread,
Apr 18, 2018, 2:52:48 PM4/18/18
to Network Simulator 2 (NS2)
@Hà Duy Anh ,   Hi.

Please show the command that resulted in the errors.
... A hint : The file blackholeaodv.tcl is usually not a simulation file.

HOWTO blackholeaodv ...
$ tar xvf ns-allinone-2.35_gcc5.tar.gz    (2014 - 2017 update)
https
://drive.google.com/file/d/0B7S255p3kFXNVVlxR0ZNRGVORjQ/view?usp=sharing
$ cd ns
-allinone-2.35/
$ patch
-p0 < blackholeaodv2013-ns235_1.patch
https
://drive.google.com/file/d/0B7S255p3kFXNWWVDZzd2ZC14akE/view?usp=sharing
$
./install
$ cd ns
-2.35/
$ sudo make install
$ cp ns ns
-blackhole
$ sudo cp ns
-blackhole /usr/local/bin/
... Then you can do $ ns-blackhole atk3.tcl
... and other examples from blackholeaodv2005~2013-examples-05.17.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNTUlreWIzVGxUXzQ/view?usp=sharing

Hà Duy Anh

unread,
Apr 23, 2018, 10:36:08 PM4/23/18
to ns-u...@googlegroups.com
@knudfl
Thank sir!
Do you have code for wormhole attack in manet?

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-u...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-users.
For more options, visit https://groups.google.com/d/optout.



--

Patel Nilam

unread,
Apr 24, 2018, 6:20:33 AM4/24/18
to ns-u...@googlegroups.com
YES SIR

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

knudfl

unread,
Apr 24, 2018, 6:29:01 AM4/24/18
to Network Simulator 2 (NS2)
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.

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

Hà Duy Anh

unread,
Apr 25, 2018, 7:29:11 AM4/25/18
to ns-u...@googlegroups.com
Thank sir so much! I have question:can simulation in ns2 a random attack between blackhole and wormhole?Or blackhole, or wormhole, or (blackhole and wormhole). 

To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.

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

sigit wibawa

unread,
Apr 25, 2018, 7:34:09 AM4/25/18
to ns-u...@googlegroups.com
Hi all, 

Let introduce my self my name sigit wibawa from jakarta indonesia, i interest for this topic ns2, i try tcl code from this group why its not running in windows so i use cygwin thank you and i waiting advise from you, nice to see you all in this group


Regards,

Sigit wibawa



Hà Duy Anh

unread,
Apr 25, 2018, 11:38:11 AM4/25/18
to ns-u...@googlegroups.com
Hi wibawa, i think you should use OS Linux. Cause platform of Linux when install ns2 will effective more.

Hà Duy Anh

unread,
Apr 26, 2018, 3:34:49 AM4/26/18
to ns-u...@googlegroups.com
Sorry sir knudfl, i want ask: how to add raodv protocol in ns2?
Thank sir.

2018-04-25 22:38 GMT+07:00 Hà Duy Anh <haduya...@gmail.com>:
Hi wibawa, i think you should use OS Linux. Cause platform of Linux when install ns2 will effective more.



knudfl

unread,
Apr 26, 2018, 5:23:27 AM4/26/18
to Network Simulator 2 (NS2)

Hà Duy Anh

unread,
Apr 26, 2018, 6:19:27 AM4/26/18
to ns-u...@googlegroups.com
Thank sir! So about the S-AODV ( Secure Ad-hoc On-Demand Distance Vector) ? i didn't found it in ns2 patches.

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

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

knudfl

unread,
Apr 26, 2018, 8:15:43 AM4/26/18
to Network Simulator 2 (NS2)
@Hà Duy Anh

S AODV :  There is a patch, saodv-with-ssl_ns235.diff in this thread, post #33
https://www.linuxquestions.org/questions/showthread.php?p=5305067#post5305067
... may be that will do ? It's simply AODV with SSL. ( libssl, libcrypto).

Old SAODV :
The are two examples in "ns2-patches": SAODV-2006_a-saodv_0.2.tar.gz, saodv-08242013_a-saodv.tar.gz
https://drive.google.com/drive/folders/0B7S255p3kFXNZ2lWZDBRSW40Q00?usp=sharing
... Old aodv-uu required. No build examples with "old saodv".



On Thursday, April 26, 2018 at 12:19:27 PM UTC+2, Hà Duy Anh wrote:
Thank sir! So about the S-AODV ( Secure Ad-hoc On-Demand Distance Vector) ? i didn't found it in ns2 patches.
2018-04-26 16:23 GMT+07:00 knudfl <knu...@ofir.dk>:
@Hà Duy Anh,   Hi.

R AODV : Reverse AODV  http://elmurod.net/sfiles/r-aodv.zip   (2006)
→ Reverse-aodv_ns229.patch  ( for ns-2.29.3 )
https://drive.google.com/file/d/0B7S255p3kFXNYjI0aVF4YXdWeDA/view?usp=sharing

R AODV : Randomized aodv ( ns2-roadv ) https://github.com/softvar/ns2-roadv
→ r-aodv.patch, ns235.
https://drive.google.com/file/d/0B7S255p3kFXNQ3E3V2hLTmRnOU0/view?usp=sharing

All ns2 patches https://drive.google.com/drive/folders/0B7S255p3kFXNZ2lWZDBRSW40Q00?usp=sharing


On Thursday, April 26, 2018 at 9:34:49 AM UTC+2, Hà Duy Anh wrote:
Sorry sir knudfl, i want ask: how to add raodv protocol in ns2?
Thank sir.

2018-04-25 22:38 GMT+07:00 Hà Duy Anh <haduya...@gmail.com>:
Hi wibawa, i think you should use OS Linux. Cause platform of Linux when install ns2 will effective more.



--

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

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

Hà Duy Anh

unread,
Apr 26, 2018, 12:07:38 PM4/26/18
to ns-u...@googlegroups.com
Thank sir! Please tell me how to add R-AODV (Reverse AODV) and S-AODV in ns2. I try add them but error :

To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.

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

knudfl

unread,
Apr 26, 2018, 12:48:31 PM4/26/18
to Network Simulator 2 (NS2)
@Hà Duy Anh

Please show text as  Text.txt :  I guess you know how to copy- past a text to this site / to a text file / to an empty file.

Images with text will not be read, sorry.

Hà Duy Anh

unread,
Apr 27, 2018, 11:20:53 PM4/27/18
to ns-u...@googlegroups.com
I'm not sure how my settings are correct, with saodv-with-ssl_ns235.diff, I copy it on ns-allinone-2.35 and (patch -p0 < saodv-with-ssl_ns235.diff) then install.
 Error message:
mdart/mdart_adp.cc: In member function ‘void ADP::sendDarq(nsaddr_t, int)’:
mdart/mdart_adp.cc:108:21: error: reference to ‘hash’ is ambiguous
  nsaddr_t dstAdd_ = hash(reqId);
                     ^~~~
In file included from ./mdart/mdart.h:52:0,
                 from ./mdart/mdart_adp.h:51,
                 from mdart/mdart_adp.cc:47:
./mdart/mdart_function.h:230:17: note: candidates are: nsaddr_t hash(nsaddr_t)
 inline nsaddr_t hash(nsaddr_t id) {
                 ^~~~
In file included from /usr/include/c++/7/bits/basic_string.h:6575:0,
                 from /usr/include/c++/7/string:52,
                 from /usr/include/c++/7/bitset:47,
                 from ./mdart/mdart_function.h:62,
                 from ./mdart/mdart.h:52,
                 from ./mdart/mdart_adp.h:51,
                 from mdart/mdart_adp.cc:47:
/usr/include/c++/7/bits/functional_hash.h:58:12: note:                 template<class _Tp> struct std::hash
     struct hash;
            ^~~~
mdart/mdart_adp.cc: In member function ‘void ADP::sendDaup()’:
mdart/mdart_adp.cc:396:21: error: reference to ‘hash’ is ambiguous
  nsaddr_t dstAdd_ = hash(mdart_->id_);
                     ^~~~
In file included from ./mdart/mdart.h:52:0,
                 from ./mdart/mdart_adp.h:51,
                 from mdart/mdart_adp.cc:47:
./mdart/mdart_function.h:230:17: note: candidates are: nsaddr_t hash(nsaddr_t)
 inline nsaddr_t hash(nsaddr_t id) {
                 ^~~~
In file included from /usr/include/c++/7/bits/basic_string.h:6575:0,
                 from /usr/include/c++/7/string:52,
                 from /usr/include/c++/7/bitset:47,
                 from ./mdart/mdart_function.h:62,
                 from ./mdart/mdart.h:52,
                 from ./mdart/mdart_adp.h:51,
                 from mdart/mdart_adp.cc:47:
/usr/include/c++/7/bits/functional_hash.h:58:12: note:                 template<class _Tp> struct std::hash
     struct hash;
            ^~~~
Makefile:95: recipe for target 'mdart/mdart_adp.o' failed
make: *** [mdart/mdart_adp.o] Error 1
Ns make failed!

knudfl

unread,
Apr 28, 2018, 3:53:14 AM4/28/18
to Network Simulator 2 (NS2)
@Hà Duy Anh

»» from /usr/include/c++/7/ «« :   Wrong compiler.

ns-allinone-2.35_gcc5.tar.gz      ( 2014 - 2017 update )
https://drive.google.com/file/d/0B7S255p3kFXNVVlxR0ZNRGVORjQ/view?usp=sharing
... can be compiled with g++ version 5.4 and earlier = g++  -4.4 .... 5.x .
( The old 2011 version ns-allinone-2.35.tar.gz :  g++ -4.4.x ).

Example build :
$ export CC=gcc-4.9 CXX=g++-4.9 && ./install

Note:  You can have as many gcc/g++ versions as you want, installed at the same time.

?  Which OS are you using  ? ?

Hà Duy Anh

unread,
Apr 28, 2018, 4:54:13 AM4/28/18
to ns-u...@googlegroups.com
I'm using ns-allinone-2.35_gcc5.tar.gz      ( 2014 - 2017 update ). And my OS is Ubuntu-17.10
When i run: $ export CC=gcc-4.9 CXX=g++-4.9 && ./install.
Error:
* Build tcl8.5.10
* Modified By Paul Shaiju (Paul S)
* Email-id : pau...@gmail.com
* Website : http://paultsr.in
============================================================
configure: WARNING: unrecognized options: --enable-gcc
checking whether to use symlinks for manpages... no
checking whether to compress the manpages... no
checking whether to add a package name suffix for the manpages... no
checking for gcc... gcc-4.9
checking whether the C compiler works... no
configure: error: in `/home/haduyanh/test-protocol/ns-allinone-2.35/tcl8.5.10/unix':
configure: error: C compiler cannot create executables
See `config.log' for more details
tcl8.5.10 configuration failed! Exiting ...
Tcl is not part of the ns project.  Please see www.Scriptics.com
to see if they have a fix for your platform.

Before. I installed successfully blackholeAODV but i don't remember how i did it.


--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-u...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-users.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

knudfl

unread,
Apr 28, 2018, 11:13:52 AM4/28/18
to Network Simulator 2 (NS2)
@Hà Duy Anh,  Hi.

Sorry,  didn't read "Ubuntu-17.10" at first.
sudo apt install g++-4.8

export CC=gcc-4.8 CXX=g++-4.8 && ./install

Note : The g++-5 compiler is version 5.5 :
Tested "not usable" with Ubuntu 18.04 ... Not yet tested with 17.10 ? ( I have mostly used 4.8 ).

To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.

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

Hà Duy Anh

unread,
Apr 28, 2018, 1:23:26 PM4/28/18
to ns-u...@googlegroups.com
Thank sir so much!
With RAODV (Reverse AODV): i copy r-aodv in link http://elmurod.net/sfiles/r-aodv.zip in /ns-2.35 and run ./configure, is this true?
And i have question: If i do blackhole attack with AODV protocol, so to run that attack with RAODV protocol then i have fix what in file blackhole.tcl?

#blackhole-attack.tcl

set val(chan)   Channel/WirelessChannel    ;# channel type
set val(prop)   Propagation/TwoRayGround   ;# radio-propagation model
set val(netif)  Phy/WirelessPhy            ;# network interface type
set val(mac)    Mac/802_11                 ;# MAC type
set val(ifq)    Queue/DropTail/PriQueue    ;# interface queue type
set val(ll)     LL                         ;# link layer type
set val(ant)    Antenna/OmniAntenna        ;# antenna model
set val(ifqlen) 150                        ;# max packet in ifq
set val(nn) 50                         ;# number of mobilenodes
set val(nnaodv) 49    ;# number of AODV mobilenodes   

set val(rp)     AODV                       ;# routing protocol
set val(x)      1000                        ;# X dimension of topography
set val(y)      1000                        ;# Y dimension of topography
set val(stop)   100                         ;# time of simulation end
set val(csstop) 100
set val(cp)     "/home/haduyanh/ns-allinone-2.35_gcc5/ns-allinone-2.35/ns-2.35/indep-utils/cmu-scen-gen/setdest/kichban5-n50-t100-s20-1000-1000"
set val(sc)     "/home/haduyanh/ns-allinone-2.35_gcc5/ns-allinone-2.35/ns-2.35/indep-utils/cmu-scen-gen/cbr"

#===================================
#        Initialization        
#===================================
#Create a ns simulator
set ns_ [new Simulator]
$ns_ use-newtrace

#Open the NS trace file
set tracefd     [open aodv1.tr w]
$ns_ trace-all $tracefd

#Open the NAM trace file
set namtrace    [open aodv1.nam w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)

# set up topography object
set topo    [new Topography]
$topo load_flatgrid $val(x) $val(y)
# Create God
create-god $val(nnaodv)

# Create channel #1 and #2
set chan_1_ [new $val(chan)]
set chan_2_ [new $val(chan)]
#===================================
#     Mobile node parameter setup
#===================================
set god_ [God instance]

$ns_ node-config    -adhocRouting  $val(rp) \
                    -llType        $val(ll) \
                    -macType       $val(mac) \
                    -ifqType       $val(ifq) \
                    -ifqLen        $val(ifqlen) \
                    -antType       $val(ant) \
                    -propType      $val(prop) \
                    -phyType       $val(netif) \
                    -topoInstance  $topo \
                    -agentTrace    ON \
                    -routerTrace   ON \
                    -macTrace      ON \
                    -movementTrace ON \
                    -channel       $chan_1_


# Creating moblie AODV nodes for simulation
puts "Creating node..."
    for {set i 0} {$i < $val(nnaodv)} {incr i} {
        set node_($i)   [$ns_ node]
        $node_($i) random-motion 0     ;#disable random motion
    }

# Creating Black Hole nodes for simulation
$ns_ node-config -adhocRouting blackholeAODV
for {set i $val(nnaodv)} {$i < $val(nn)} {incr i} {
set node_($i) [$ns_ node]
    $node_($i) color red;
    $ns_ at 0.00 "$node_($i) color red";
$node_($i) random-motion 0;#disable random motion
$ns_ at 0.01 "$node_($i) label \"blackhole node\""
}

puts "Loading random connection pattern..."
source $val(cp)

        # CBRGEN GENERATE SAME CODE
# cbrgen generate same code
puts "Loading CBR..."
source $val(sc)
## CBR connections genereted by cbrgen
# Define initial node position
for {set i 0} {$i < $val(nn)} {incr i} {
    $ns_ initial_node_pos $node_($i) 30
}
# CBR connections stops
for {set i 0} {$i < 9} {incr i} {
    $ns_ at $val(csstop) "$cbr_($i) stop"
}
# Tell all the nodes when the simulation ends
for {set i 0} {$i < $val(nn) } {incr i} {
    $ns_ at $val(stop).000000001 "$node_($i) reset";
}
# Ending nam and simulation
$ns_ at $val(stop) "finish"
$ns_ at $val(stop).0 "$ns_ trace-annotate \"Simulation has ended\""
$ns_ at $val(stop).00000001 "puts \"NS EXITING...\" ; $ns_ halt"
proc finish {} {
    global ns_ tracefd namtrace
    $ns_ flush-trace
    close $tracefd
    close $namtrace
  #  exec nam aodv1.nam &
    exit 0
    }

puts "Starting Simulation.."
$ns_ run


To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.

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

knudfl

unread,
Apr 28, 2018, 2:39:01 PM4/28/18
to Network Simulator 2 (NS2)
@Hà Duy Anh

»» i copy r-aodv ... r-aodv.zip in ns-2.35/ and run ./configure «« :
The package "r-aodv.zip" must be unpacked outside ns-2.35/ in a new folder/ →
New-folder/{ aodv.cc  aodv.h  aodv_logs.cc  aodv_packet.h  aodv_rqueue.cc  aodv_rqueue.h  aodv_rtable.cc  aodv_rtable.h  aodv.tcl  trace/ },
.... and the files copied to their right locations → ns-2.35/{ aodv/, trace/ }.

Note :  Do not expect the ns-2.29 files to work with ns-2.35.
(( My patch is  ``Reverse-aodv_ns229.patch´´ :  See my answer  'Apr 26  2018' )).

Hà Duy Anh

unread,
Apr 28, 2018, 10:17:23 PM4/28/18
to ns-u...@googlegroups.com
Thank sir! I have a question above that sir have not answered yet.
And i use r-aodv.zip for ns-2.35, i don't try Reverse-aodv_ns229.patch cause i know it different version. 

To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.

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

knudfl

unread,
Apr 29, 2018, 5:21:55 AM4/29/18
to Network Simulator 2 (NS2)
@Hà Duy Anh.

»»blackhole attack with AODV protocol, ... attack with RAODV protocol ... fix what in file blackhole.tcl?««

First, there is no simulation by name "blackhole.tcl".

Blackhole attack with RAODV protocol :    I have no idea.
...  I guess you can just run the simulations as usual :
But with a new 'RAODV + blackhole' executable ... 
patch.log.txt
blackholeaodv2013-ns235_1.patch

Hà Duy Anh

unread,
Apr 29, 2018, 11:04:37 AM4/29/18
to ns-u...@googlegroups.com
Thank sir! I researching wormhole attack, and i have question : have file (wormholeaodv.patch) patch as blackholeaodv.patch?

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-u...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-users.
For more options, visit https://groups.google.com/d/optout.

knudfl

unread,
Apr 29, 2018, 1:07:24 PM4/29/18
to Network Simulator 2 (NS2)



On Sunday, April 29, 2018 at 5:04:37 PM UTC+2, Hà Duy Anh wrote:
Thank sir! I researching wormhole attack, and i have question : have file (wormholeaodv.patch) patch as blackholeaodv.patch?
2018-04-29 16:21 GMT+07:00 knudfl <knu...@ofir.dk>:
@Hà Duy Anh.

»»blackhole attack with AODV protocol, ... attack with RAODV protocol ... fix what in file blackhole.tcl?««

First, there is no simulation by name "blackhole.tcl".

Blackhole attack with RAODV protocol :    I have no idea.
...  I guess you can just run the simulations as usual :
But with a new 'RAODV + blackhole' executable ... 

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

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

Hà Duy Anh

unread,
May 1, 2018, 6:15:44 PM5/1/18
to ns-u...@googlegroups.com
Thank sir so much for everything! Hope good things come to sir!

To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.

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

Hà Duy Anh

unread,
May 7, 2018, 3:51:25 AM5/7/18
to ns-u...@googlegroups.com
Hi sir @knudfl!
Do you know how to can simultaneously appearing both blackhole attack and wormhole attack.

​Thanks!

knudfl

unread,
May 7, 2018, 12:44:55 PM5/7/18
to Network Simulator 2 (NS2)
@Hà Duy Anh

»»Do you know how to can simultaneously appearing both blackhole attack and wormhole attack.««

? Do you want to use the "default wormhle" functions ? ns-2.35 ?
.....  Easy then to add the patch blackholeaodv2013-ns235_1.patch
https://drive.google.com/file/d/0B7S255p3kFXNWWVDZzd2ZC14akE/view?usp=sharing

Or do you want a blackholeaodv addition for {ns-2.29.3 with byzantine attacks}  ?


Hà Duy Anh

unread,
May 7, 2018, 1:14:39 PM5/7/18
to ns-u...@googlegroups.com
I using ns-2.35 and 15worm-16.tcl of you, i simulated an blackhole attack. And, I want combine them to simultaneously appearing both in one simulation.
So, how your idea? 

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-u...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-users.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

knudfl

unread,
May 7, 2018, 2:20:16 PM5/7/18
to Network Simulator 2 (NS2)
@Hà Duy Anh.

You can add "blackholeaodv" to a simulation ...
.
######### Added for blackholeAODV
set val(nn)      15
set val(nnaodv)  5
set val(brp)     blackholeAODV
##########.
.
.
.
###################################### Added for blackholeAODV

# $ns_  node-config  -adhocRouting $val(brp)
for {set i $val(nnaodv) } {$i<$val(nn) } {incr i} {
     
set node_($i) [$ns_ node]

     $node_
($i) random-motion 0;
     $ns_ at
0.01 "$node_($i) label \"blackhole node\""
}
##################################################

See  blackholeaodv2005~2013-examples-05.17.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNTUlreWIzVGxUXzQ/view?usp=sharing

( All examples
https://drive.google.com/drive/folders/0B7S255p3kFXNSmRYb2lGcDRUdWs?usp=sharing )

Find examples in blackhole/ex-2005-2013__05.17/ :
[ex-2005-2013__05.17]$ grep "Added for blackholeAODV" *
2paires-b.tcl:######### Added for blackholeAODV
2paires-b.tcl:###################################### Added for blackholeAODV
aodv
-Xgr_blackhole.tcl:######### Added for blackholeAODV
aodv
-Xgr_blackhole.tcl:###################################### Added for blackholeAODV
Aska123-f__Blacktcl2.tcl:######### Added for blackholeAODV
Aska123-f__Blacktcl2.tcl:###################################### Added for blackholeAODV
Clustering-moc_v1_blackh.tcl:######### Added for blackholeAODV
Clustering-moc_v1_blackh.tcl:###################################### Added for blackholeAODV
graph3
-blackhole.tcl:######### Added for blackholeAODV
graph3
-blackhole.tcl:###################################### Added for blackholeAODV


Hà Duy Anh

unread,
May 8, 2018, 12:33:36 AM5/8/18
to ns-u...@googlegroups.com
I'm trying but it only run wormhole attack:
#set n0 [$ns node]
#$n0 random-motion 0
#$ns initial_node_pos $n0 30
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 9.21756e-11 ;#550m
Phy/WirelessPhy set RXThresh_ 4.4613e-10 ;#250m
Phy/WirelessPhy set bandwidth_ 512kb
Phy/WirelessPhy set Pt_ 8000.2818
Phy/WirelessPhy set freq_ 2.4e+9
Phy/WirelessPhy set L_ 1.0 
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 0.25
Antenna/OmniAntenna set Gt_ 1
Antenna/OmniAntenna set Gr_ 1


set val(chan)   Channel/WirelessChannel    ;# channel type
set val(prop)   Propagation/TwoRayGround   ;# radio-propagation model
set val(netif)  Phy/WirelessPhy            ;# network interface type
set val(mac)    Mac/802_11                 ;# MAC type
set val(ifq)    Queue/DropTail/PriQueue    ;# interface queue type
set val(ll)     LL                         ;# link layer type
set val(ant)    Antenna/OmniAntenna        ;# antenna model
set val(ifqlen) 50                         ;# max packet in ifq
set val(nn)     16                        ;# number of mobilenodes
set val(nnaodv) 15                           ;#number of aodv
set val(rp)     AODV                        ;# routing protocol
set val(brp)    blackholeAODV               ;#routing protocol
set val(x)      1440                      ;# X dimension of topography
set val(y)      100                      ;# Y dimension of topography
set val(stop)   10.0                         ;# time of simulation end
#set val(wormholes) 1;
#===================================
#        Initialization        
#===================================
#Create a ns simulator
set ns_ [new Simulator]

#Setup topography object
set topo       [new Topography]
$topo load_flatgrid $val(x) $val(y)

create-god $val(nnaodv)

#Open the NS trace file
set tracefile [open out.tr w]
$ns_ trace-all $tracefile

#Open the NAM trace file
set namfile [open out.nam w]
$ns_ namtrace-all $namfile
$ns_ namtrace-all-wireless $namfile $val(x) $val(y)

set chan [new $val(chan)];

#===================================
#     Mobile node parameter setup
#===================================
$ns_ node-config -adhocRouting  $val(rp) \
                -llType        $val(ll) \
                -macType       $val(mac) \
                -ifqType       $val(ifq) \
                -ifqLen        $val(ifqlen) \
                -antType       $val(ant) \
                -propType      $val(prop) \
                -phyType       $val(netif) \
                -channel       $chan \
                -topoInstance  $topo \
                -agentTrace    ON \
                -routerTrace   ON \
                -macTrace      ON \
                -movementTrace ON

###################################### Added for blackholeAODV

#$ns_  node-config  -adhocRouting $val(brp) 
for {set i $val(nnaodv) } {$i < $val(nn) } {incr i} { 
     set node_($i) [$ns_ node] 
     $node_($i) random-motion 0; 
     $ns_ at 0.01 "$node_($i) label \"blackhole node\""
    }
#===================================
#        Nodes Definition        
#===================================
# Creating moblie AODV nodes for simulation
puts "Creating node..."
for {set i 0} {$i < $val(nn) } {incr i} {
        set node_($i) [$ns_ node]
        $node_($i) random-motion 0  ;#disable random motion
}
#Create 14 nodes
$node_(0) set X_ 100
$node_(0) set Y_ 399
$node_(0) set Z_ 0.0

$node_(1) set X_ 200
$node_(1) set Y_ 200
$node_(1) set Z_ 0.0

$node_(2) set X_ 199
$node_(2) set Y_ 600
$node_(2) set Z_ 0.0

$node_(3) set X_ 398
$node_(3) set Y_ 599
$node_(3) set Z_ 0.0

$node_(4) set X_ 399
$node_(4) set Y_ 199
$node_(4) set Z_ 0.0

$node_(5) set X_ 799
$node_(5) set Y_ 201
$node_(5) set Z_ 0.0

$node_(6) set X_ 1000
$node_(6) set Y_ 201
$node_(6) set Z_ 0.0

$node_(7) set X_ 1099
$node_(7) set Y_ 400
$node_(7) set Z_ 0.0

$node_(8) set X_ 1000
$node_(8) set Y_ 598
$node_(8) set Z_ 0.0

$node_(9) set X_ 900
$node_(9) set Y_ 300
$node_(9) set Z_ 0.0

$node_(10) set X_ 1
$node_(10) set Y_ 200
$node_(10) set Z_ 0.0

$node_(11) set X_ 1
$node_(11) set Y_ 600
$node_(11) set Z_ 0.0

$node_(12) set X_ 299
$node_(12) set Y_ 400
$node_(12) set Z_ 0.0
$ns_ at 0.01 "$node_(12) label \"source node12\""

$node_(13) set X_ 900
$node_(13) set Y_ 399
$node_(13) set Z_ 0.0
$ns_ at 0.01 "$node_(13) label \"destiantion node13\""


# configure Wormholes

#puts "Making first wormhole"
$node_(14) set X_ 300.0
$node_(14) set Y_ 500.0
$node_(14) set Z_ 0.0
$ns_ at 0.01 "$node_(14) label \"wh1\""

$node_(15) set X_ 800
$node_(15) set Y_ 599
$node_(15) set Z_ 0.0
$ns_ at 0.01 "$node_(15) label \"wh2\""

# [$n14 set ll_(0)] wormhole-peer [$n15 set ll_(0)]
# [$n15 set ll_(0)] wormhole-peer [$n14 set ll_(0)]
#===================================
#        Agents Definition        
#===================================
# Define initial node position
for {set i 0} {$i < $val(nn)} {incr i} {
    $ns_ initial_node_pos $node_($i) 30
}
#Setup a UDP connection
set udp0 [new Agent/UDP]
$ns_ attach-agent $node_(12) $udp0
set null1 [new Agent/Null]
$ns_ attach-agent $node_(13) $null1
$ns_ connect $udp0 $null1
$udp0 set packetSize_ 1500

#===================================
#        Applications Definition        
#===================================
#Setup a CBR Application over UDP connection
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
$cbr0 set packetSize_ 1000
$cbr0 set rate_ 1.0Mb
$cbr0 set random_ null
$ns_ at 0.0 "$cbr0 start"
$ns_ at 10.0 "$cbr0 stop"

#===================================
#        Termination        
#===================================
#Define a 'finish' procedure
proc finish {} {
    global ns_ tracefile namfile
    $ns_ flush-trace
    close $tracefile
    close $namfile
    exec nam out.nam &
    exit 0
}
for {set i 0} {$i < $val(nn) } { incr i } {
    $ns_ at $val(stop) "\$node_($i) address?"
    $ns_ at $val(stop) "\$node_($i) reset"
}
$ns_ at $val(stop) "$ns_ nam-end-wireless $val(stop)"
$ns_ at $val(stop) "finish"
$ns_ at $val(stop) "puts \"done\" ; $ns_ halt"
$ns_ run


--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-u...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-users.
For more options, visit https://groups.google.com/d/optout.

Arief Hidayat

unread,
Aug 15, 2018, 4:43:44 AM8/15/18
to Network Simulator 2 (NS2)
hi knudlf
when i running program ns-blackhole atk3.tcl, i get the error as below
arief-pc@ubuntu:~/Documents/blackhole/ex-2005-2013__05.17$ ns atk3.tclnum_nodes is set 3
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
warning: no class variable Agent/AODV::gw_discovery

    see tcl-object.tcl in tclcl for info about this warning.

INITIALIZE THE LIST xListHead
warning: no class variable Agent/AODV::gw_discovery

    see tcl-object.tcl in tclcl for info about this warning.


    (_o58 cmd line 1)
    invoked from within
"_o58 cmd addr"
    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 "_o58" line 2)
    (SplitObject unknown line 2)
    invoked from within
"_o58 addr"
    ("eval" body line 1)
    invoked from within
"eval $node addr $args"
    ("default" 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"
}
AODV {
set ragent [$self cre..."
    (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"
    invoked from within
"set node_(2) [$ns node]"
    (file "atk3.tcl" line 56)
help me please

Pada Rabu, 18 April 2018 11.52.48 UTC-7, knudfl menulis:
@Hà Duy Anh ,   Hi.

Please show the command that resulted in the errors.
... A hint : The file blackholeaodv.tcl is usually not a simulation file.

HOWTO blackholeaodv ...
$ tar xvf ns-allinone-2.35_gcc5.tar.gz    (2014 - 2017 update)
https
://drive.google.com/file/d/0B7S255p3kFXNVVlxR0ZNRGVORjQ/view?usp=sharing
$ cd ns
-allinone-2.35/
$ patch
-p0 < blackholeaodv2013-ns235_1.patch
https
://drive.google.com/file/d/0B7S255p3kFXNWWVDZzd2ZC14akE/view?usp=sharing
$
./install
$ cd ns
-2.35/
$ sudo make install
$ cp ns ns
-blackhole
$ sudo cp ns
-blackhole /usr/local/bin/
... Then you can do $ ns-blackhole atk3.tcl
... and other examples from blackholeaodv2005~2013-examples-05.17.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNTUlreWIzVGxUXzQ/view?usp=sharing



On Wednesday, April 18, 2018 at 7:50:54 PM UTC+2, Hà Duy Anh wrote:
Did you fix it??I also encounter the same error.

Vào 00:22:22 UTC+7 Thứ Năm, ngày 09 tháng 2 năm 2017, Patel Nilam đã viết:
respected sir
when I run blackholeattack.c file from all files folder which are posted by http://ns2codeforblackholeattack.blogspot.in/2013/06/blackhole-attack.html this link using ns-allinone-2.35. i found following error. pls do needful to me.


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"

Reply all
Reply to author
Forward
0 new messages