tcl script for blackhole attack graph
#1

Black-[/size][/font]hole attack implemented in tcl


Hole Attack Implemented In TCL

In sample20.tcl, while simulating Blackhole attack in MANET, the blackhole attacker does not obey the communication model. Data Transmission is established between nodes using UDP agent and CBR traffic. Sender sends the data via attacker. Source node transfers data to attacker that does not have shortest route to Destination. Attacker does not forward data to its neighbors.

A Mobile Ad hoc Network (MANET) comprises of mobile nodes that moves independently in an open environment. Communication between the nodes in a MANET is enabled with the aid of intermediate routers. The nature of MANET such as open medium, dynamic network topology, lack of centralized monitoring, and lack of clear defense mechanisms makes it vulnerable to several routing attacks. In MANET routing, there is a high probability for intermediate nodes to be malicious that might be a threat to the security. Blackhole is the common attack in ad hoc routing in which the malicious node uses the process of routing to state itself of being the shortest path to the destination. Once it receives the data packets, it drops the data packets instead of forwarding them to its neighbors.

Sample Code Segment
#Filename: sample20.tcl

#—————BLACKHOLE ATTACK——————————#
#—————Sample two wireless mobile nodes communication———————-
# Define options
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 ;# page link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 9 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 500 ;# X dimension of topography
set val(y) 500 ;# Y dimension of topography
set val(stop) 500 ;# time of simulation end

#——-Event scheduler object creation——–#

set ns [new Simulator]

# Creating trace file and nam file

set tracefd [open sample20.tr w]
set namtrace [open sample20.nam w]

set r [open distance.tr w]

$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

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

set god_ [create-god $val(nn)]

set chan_1_ [new $val(chan)]

# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 3.65262e-10 ;
Phy/WirelessPhy set RXThresh_ 3.65262e-10 ;#250m
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 914e+6
Phy/WirelessPhy set L_ 1.0

#configure the nodes
$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 \
-channel $chan_1_ \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON \

for {set i 0} {$i < $val(nn)} { incr i } {

set node_($i) [$ns node]

}

# Initial node color plus labeling color

for {set i 0} {$i < $val(nn) } {incr i } {
$node_($i) color black
$ns at 0.0 “$node_($i) color black”
}

for {set i 0} {$i < $val(nn) } { incr i } {
#set xx($i) [expr rand()*$val(x)]
#set yy($i) [expr rand()*$val(y)]

$node_($i) set X_ $xx($i)
$node_($i) set Y_ $yy($i)

}

set source 1
set destination 2
set now 1.0
set time 3.0

set udp [new Agent/UDP]
$ns attach-agent $node_(1) $udp

set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 100
$cbr set interval_ 0.1
$cbr attach-agent $udp

set null [new Agent/Null]
$ns attach-agent $node_(0) $null

$ns connect $udp $null
$ns at $now “$cbr start”
$ns at [expr $now + $time] “$cbr stop”

$ns at [expr $now] “$ns trace-annotate \”Source broadcast route request packet \””

$ns at [expr $now] “$ns trace-annotate \”Attacker sends false route reply to source node$source \””

$ns at 1.0 “$node_($source) label Source”
$ns at 1.0 “$node_($destination) label Destination”
$ns at 1.0 “$node_(0) label Attacker”

$ns at 1.0 “$node_($source) color blue”
$ns at 1.0 “$node_($destination) color blue”
$ns at 1.0 “$node_(0) color red”

set now [expr $now+$time]
set time 10.0

set udp [new Agent/UDP]
$ns attach-agent $node_($source) $udp

set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 1024
$cbr set interval_ 0.1
$cbr attach-agent $udp

set null [new Agent/Null]
$ns attach-agent $node_(0) $null

$ns connect $udp $null
$ns at $now “$cbr start”
$ns at [expr $now + $time] “$cbr stop”

$ns at [expr $now] “$ns trace-annotate \”Source node transfers data to attacker $n($source-0) which does not have shorest route to Destination $destination\””
$ns at [expr $now] “$ns trace-annotate \”Attacker $n($source-0) does not forward data to Destination $destination creating Blackhole attack in MANET\””
Reply
#2

Hole Attack Implemented In TCL

In sample20.tcl, while simulating Blackhole attack in MANET, the blackhole attacker does not obey the communication model. Data Transmission is established between nodes using UDP agent and CBR traffic. Sender sends the data via attacker. Source node transfers data to attacker that does not have shortest route to Destination. Attacker does not forward data to its neighbors.

A Mobile Ad hoc Network (MANET) comprises of mobile nodes that moves independently in an open environment. Communication between the nodes in a MANET is enabled with the aid of intermediate routers. The nature of MANET such as open medium, dynamic network topology, lack of centralized monitoring, and lack of clear defense mechanisms makes it vulnerable to several routing attacks. In MANET routing, there is a high probability for intermediate nodes to be malicious that might be a threat to the security. Blackhole is the common attack in ad hoc routing in which the malicious node uses the process of routing to state itself of being the shortest path to the destination. Once it receives the data packets, it drops the data packets instead of forwarding them to its neighbors.

Sample Code Segment
#Filename: sample20.tcl

#—————BLACKHOLE ATTACK——————————#
#—————Sample two wireless mobile nodes communication———————-
# Define options
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 ;# page link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 9 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 500 ;# X dimension of topography
set val(y) 500 ;# Y dimension of topography
set val(stop) 500 ;# time of simulation end

#——-Event scheduler object creation——–#

set ns [new Simulator]

# Creating trace file and nam file

set tracefd [open sample20.tr w]
set namtrace [open sample20.nam w]

set r [open distance.tr w]

$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

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

set god_ [create-god $val(nn)]

set chan_1_ [new $val(chan)]

# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 3.65262e-10 ;
Phy/WirelessPhy set RXThresh_ 3.65262e-10 ;#250m
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 914e+6
Phy/WirelessPhy set L_ 1.0

#configure the nodes
$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 \
-channel $chan_1_ \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON \

for {set i 0} {$i < $val(nn)} { incr i } {

set node_($i) [$ns node]

}

# Initial node color plus labeling color

for {set i 0} {$i < $val(nn) } {incr i } {
$node_($i) color black
$ns at 0.0 “$node_($i) color black”
}

for {set i 0} {$i < $val(nn) } { incr i } {
#set xx($i) [expr rand()*$val(x)]
#set yy($i) [expr rand()*$val(y)]

$node_($i) set X_ $xx($i)
$node_($i) set Y_ $yy($i)

}

set source 1
set destination 2
set now 1.0
set time 3.0

set udp [new Agent/UDP]
$ns attach-agent $node_(1) $udp

set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 100
$cbr set interval_ 0.1
$cbr attach-agent $udp

set null [new Agent/Null]
$ns attach-agent $node_(0) $null

$ns connect $udp $null
$ns at $now “$cbr start”
$ns at [expr $now + $time] “$cbr stop”

$ns at [expr $now] “$ns trace-annotate \”Source broadcast route request packet \””

$ns at [expr $now] “$ns trace-annotate \”Attacker sends false route reply to source node$source \””

$ns at 1.0 “$node_($source) label Source”
$ns at 1.0 “$node_($destination) label Destination”
$ns at 1.0 “$node_(0) label Attacker”

$ns at 1.0 “$node_($source) color blue”
$ns at 1.0 “$node_($destination) color blue”
$ns at 1.0 “$node_(0) color red”

set now [expr $now+$time]
set time 10.0

set udp [new Agent/UDP]
$ns attach-agent $node_($source) $udp

set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 1024
$cbr set interval_ 0.1
$cbr attach-agent $udp

set null [new Agent/Null]
$ns attach-agent $node_(0) $null

$ns connect $udp $null
$ns at $now “$cbr start”
$ns at [expr $now + $time] “$cbr stop”

$ns at [expr $now] “$ns trace-annotate \”Source node transfers data to attacker $n($source-0) which does not have shorest route to Destination $destination\””
$ns at [expr $now] “$ns trace-annotate \”Attacker $n($source-0) does not forward data to Destination $destination creating Blackhole attack in MANET\””
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: manet blackhole java, tcl script for wormhole attack, val matic, simulation cooperative blackhole tcl, blackhole attack, how blackhole attacks ppt, blackhole attack im manet with source code in java,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  formal anchoring script for farewell party in college in english 3 3,745 17-03-2018, 08:06 AM
Last Post: Guest
  anchoring script for farewell party in college in pdf 2 3,072 20-11-2017, 08:37 PM
Last Post: arya kr shaw
Thumbs Up funny anchoring script for school annual function 3 3,266 26-10-2017, 10:05 PM
Last Post: Guest
Smile anchoring script for college symposium 2 1,801 16-09-2017, 01:39 PM
Last Post: Guest
  anchoring script for prize distribution ceremony in school 4 3,597 10-07-2017, 09:30 AM
Last Post: jaseela123d
  script for comparing a birthday party 2 1,539 20-05-2017, 10:09 AM
Last Post: Guest
  anchoring script in english for farewell party 1 1,037 16-03-2017, 11:19 AM
Last Post: jaseela123d
  hindi comedy drama script pdf based on college in hindi 4 6,985 28-02-2017, 11:29 AM
Last Post: ijasti
  anchoring script for bollywood retro theme party 1 1,847 23-02-2017, 11:27 AM
Last Post: ijasti
  anchoring script for oath taking ceremony 3 2,157 23-02-2017, 11:27 AM
Last Post: ijasti

Forum Jump: