LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-03-2012, 03:31 PM   #1
D4SH_SI4
LQ Newbie
 
Registered: Aug 2012
Posts: 7

Rep: Reputation: Disabled
Error on Tcl when add misbehavior node in aodv ns2


hi
I do modification according http://www.elmurod.net/index.php/200...-node-in-aodv/ for adding malicios node to aodv bud I have problem when run tcl file and in the above site in comments some solution has been proposed bud it's not work for my jab, please help me it's important for me
tanx

error :
Starting Simulation...
ns: _o54 hacker:
(_o54 cmd line 1)
invoked from within
"_o54 cmd hacker"
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 "_o54" line 2)
(SplitObject unknown line 2)
invoked from within
"_o54 hacker"



************* and my tcl code:
# Copyright (c) 1997 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the Computer Systems
# Engineering Group at Lawrence Berkeley Laboratory.
# 4. Neither the name of the University nor of the Laboratory may be used
# to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# simple-wireless.tcl
# A simple example for wireless simulation

# ======================================================================
# 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 ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 5 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 500 ;
set val(y) 500 ;
# ======================================================================
# Main Program
# ======================================================================


#
# Initialize Global Variables
#
set ns_ [new Simulator]
#$ns_ use-newtrace


set tracefd [open aaa.tr w]
$ns_ trace-all $tracefd

set nf [open aaa.nam w]
#$ns_ namtrace-all $nf
$ns_ namtrace-all-wireless $nf $val(x) $val(y)




# set up topography object
set topo [new Topography]

$topo load_flatgrid $val(x) $val(y)

#
# Create God
#
create-god $val(nn)


set chan_ [new $val(chan)]
#
# Create the specified number of mobilenodes [$val(nn)] and "attach" them
# to the channel.
# Here two nodes are created : node(0) and node(1)

# configure node

$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) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON

for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
$ns_ initial_node_pos $node_($i) 20
}
$ns_ at 0.0 "[$node_(2) set ragent_] hacker"
#
# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
#
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 80.0
$node_(1) set Y_ 2.0
$node_(1) set Z_ 0.0

$node_(2) set X_ 120.0
$node_(2) set Y_ 10.0
$node_(2) set Z_ 0.0

$node_(3) set X_ 160.0
$node_(3) set Y_ 0.0
$node_(3) set Z_ 0.0

$node_(4) set X_ 50.0
$node_(4) set Y_ 20.0
$node_(4) set Z_ 0.0


#
# Now produce some simple node movements
# Node_(1) starts to move towards node_(0)
#
#$ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0"
#$ns_ at 10.0 "$node_(0) setdest 20.0 18.0 1.0"

# Node_(1) then starts to move away from node_(0)
#$ns_ at 100.0 "$node_(1) setdest 490.0 480.0 15.0"

# Setup traffic flow between nodes
# TCP connections between node_(0) and node_(4)

set tcp [new Agent/TCP]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns_ attach-agent $node_(0) $tcp
$ns_ attach-agent $node_(4) $sink
$ns_ connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns_ at 10.0 "$ftp start"

#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 150.0 "$node_($i) reset";
}


$ns_ at 150.0 "stop"
$ns_ at 150.01 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
global ns_ tracefd nf
$ns_ flush-trace

close $tracefd
close $nf
}

puts "Starting Simulation..."
$ns_ run
 
Old 05-05-2013, 01:15 PM   #2
amissan
LQ Newbie
 
Registered: Apr 2013
Posts: 7

Rep: Reputation: Disabled
I have the same error can you help me

Last edited by amissan; 05-06-2013 at 03:29 AM.
 
Old 05-05-2013, 03:11 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 2, @amissan : Please do not quote complete posts.

Hit the 'Edit' button, and edit the post #2 quotation
to contain your error only.

Don't know what the "hacker" in line 111 is about.
But when line 111 is commented with a hash mark (#) : No errors:
Code:
# $ns_ at 0.0 "[$node_(2) set ragent_] hacker"
EDIT : Found some hints about "hacker"
http://durgeshkshirsagar.blogspot.dk...on-in-ns2.html
http://research.ijcaonline.org/volum...pxc3879133.pdf

-

Last edited by knudfl; 05-05-2013 at 04:40 PM.
 
Old 05-06-2013, 05:41 AM   #4
amissan
LQ Newbie
 
Registered: Apr 2013
Posts: 7

Rep: Reputation: Disabled
Unhappy

Thank you for help when I put # it becomes a comment so it does not have effect
I tried with this http://durgeshkshirsagar.blogspot.fr...76006043534132
but still the same error
 
Old 05-23-2013, 05:34 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 4 . A different way of adding "malicious":

http://www.linuxquestions.org/questi...332/page2.html
>>> posts #20, #21.

Works OK, ns-2.35, with the aodv.cc + aodv.h from post #20.
I.e. : $ ns aodv-m.tcl : OK, $ ns maodv_802_15_4.tcl : OK.

P.S. : I asked @rah12345 where he got the files / the modification information.
And so far no answer.

PPS : The tcl file from post #1 works fairly OK : Creates 'aaa.nam' 10MB, 'aaa.tr' 8MB.

-

Last edited by knudfl; 05-23-2013 at 09:46 AM.
 
Old 06-28-2013, 12:57 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 3 .

About "ragent hacker", please also see post # 21 here
http://www.linuxquestions.org/questi...332/page2.html
 
  


Reply

Tags
aodv-malicious, malicious, ns2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NS2 (v2.34) sim.tcl: error when calling class edison_0927 Linux - Newbie 0 05-30-2012 09:01 AM
after doing some modifications in aodv.cc file in ns2.34 i will get error breeze259 Linux - Newbie 1 01-05-2012 08:04 PM
tunnel formation between two malicious node by modifying aodv ns2 indumit18 Linux - Newbie 0 10-28-2011 05:38 AM
error in ns2-while trying to print routing table in aodv indumit18 Linux - Software 1 09-24-2011 04:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration