> We need to modify two files,
i) aodv.h
ii) aodv.cc
> In aodv.h,
i)
/*
The Routing Agent
*/
class AODV: public Agent
{
..........
/*
* History management
*/
bool malicious;
..........
}
> In aodv.cc,
i)
AODV::AODV(nsaddr_t id) : Agent(PT_AODV), btimer(this), htimer(this),
ntimer(this), rtimer(this), lrtimer(this), rqueue()
{
index = id;
seqno = 2;
bid = 1;
malicious=false;
............
}
ii)
int AODV::command(int argc, const char*const* argv)
{
if(argc == 2)
{
Tcl& tcl = Tcl::instance();
if(strncasecmp(argv[1], "id", 2) == 0)
{
tcl.resultf("%d", index);
return TCL_OK;
}
if(strcmp(argv[1], "hacker") == 0)
{
malicious=true;
return TCL_OK;
}
...........
}
}
iii)
/*
Route Handling Functions
*/
void AODV::rt_resolve(Packet *p)
{
..........
// If i am a malicious node,
if (malicious == true)
{
drop(p, DROP_RTR_NO_ROUTE);
// DROP_RTR_NO_ROUTE is added for no reason
return; //Required if you get pkt flow not specified error.
}
.........
}
> In your tcl code,
> After packet transmission, add the following line
$ns at 0.0 "[$node_(0) set ragent_] hacker"
> Node 0 is set as malicious. It won't forward a packet.
could u let me know in ns2
ReplyDelete@likhitha, For basics refer this link http://www.isi.edu/nsnam/ns/. To start working, http://karthicksivakrr.blogspot.in/2013/11/ns2-tips_27.html refer this link.
ReplyDeleteif i m run tcl file then
ReplyDeleteerror msg -- not define variable malicious
@rahul, can you paste the error here...?
ReplyDelete[root@localhost malicious]# ns mali.tcl
Deletenum_nodes is set 22
INITIALIZE THE LIST xListHead
can't read "ns": no such variable
while executing
"$ns at 0.0 "$[n(5) set ragent_] hacker""
(file "mali.tcl" line 221)
[root@localhost malicious]#
@rahul, if you still have the same error, then post the tcl file.
Deleteplease suggest me,
ReplyDeletehow to provide the security aodv node. and which algorithm is better to use for security(RSA & ECC).
i m create the malicious node in aodv.
thanks...
@rahul, you need to read an appropriate paper published in that domain. Both RSA and ECC has pros and cons, but you can select one, which satisfies your requirements.
Deletethanks for suggest me,
Deletebut i have create rsa protocol then getting some error
ns:
[code omitted because of length ]
: invalid command name "Agent/rsa_packet"
while executing
"Agent/rsa_packet set packetSize_ 30"
please help me...........
thanks for suggest me,
Deletebut i have create rsa protocol then getting some error
ns:
[code omitted because of length ]
: invalid command name "Agent/rsa_packet"
while executing
"Agent/rsa_packet set packetSize_ 30"
please help me...........
suggest for this concept,
ReplyDeleteNode Recognition- The first step of CSRP algorithm is to
recognize a node. This means, the nodes in an area set by the
third party (organization) is to be recognized by MN to know
whether the nodes are genuine nodes or malicious nodes. For
this, organization places a pre-computed sign S and secret key
SK in the general nodes before placing the nodes in that area
and it places a database of secret keys in MN. The public keys
e, n and hash function are also placed in MN. SK is common in
MN and general nodes. For recognition of genuine nodes by
MN it verifies the SK first and then compute h1(SK)=Se mod n.
If the h(SK) matches with h1(SK) then it verifies it as a genuine
node and then MN changes the SK and places it again in the
node. SK changes with time interval. This modification helps
in securing the key safe.
hello.can i ask something? can u help me to fix the problem? thank you.
ReplyDelete-PC:~/Downloads/malicious$ ns malicious.tcl
num_nodes is set 2
INITIALIZE THE LIST xListHead
Starting Simulation...
ns: _o18 hacker:
(_o18 cmd line 1)
invoked from within
"_o18 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 "_o18" line 2)
(SplitObject unknown line 2)
invoked from within
"_o18 hacker"
i ask you that is your problem solved?? because i also facing same problem...please help me
Delete@sazli, there is a chance for a spacing error in tcl file or aodv.cc. check it out.
ReplyDeletens: _o18 hacker:
ReplyDelete(_o18 cmd line 1)
invoked from within
"_o18 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 "_o18" line 2)
(SplitObject unknown line 2)
invoked from within
"_o18 hacker"
Hi i tried this code im getting this error
@Gayathri, i guess the above comment suits you well that you did spacing error where you mentioned hacker..
ReplyDeletei facing a problem please help me....after editing aodv.cc and aodv.h file there is error in my tcl coding..my all coding is correct...i search out many solutions on internet but it doesn't work...i write make command but it also not work am facing error in make command...please give me a solution to this problem...how i recompile my ns2 after editing??
ReplyDelete@barinder,
ReplyDeletehttp://karthicksivakrr.blogspot.in/2013/11/ns2-tips_27.html
http://karthicksivakrr.blogspot.in/2013/11/ns2-tips.html
i guess, these two posts helps. You gotta run all four commands for safety. Still, If you are facing any error paste it here. Hope it helps.
i do everything but still problem occur...i think there is an error in my ns2..when i run update command then error occur of fetching..how to resolve this error??
ReplyDelete@barinder, can you mention the command, you have tried to update...?
DeleteHi there I have two questions please:
ReplyDeleteq1: where i should put the tcl file is it under ns-2.35 folder or under home directory. I appreciate if you could put yours tcl file for this exercise
q2: after i editing aodv files I went to ns-2.35 folder and wrote make clean but it shows messeage permission denied . however, if i log as a root it compiles normally so what is the problem please.
@Reem kadi, its always best to login as root. But the only thing that needs admin permission is "make install" command.
DeleteQ2) Permission denied, this may be, you have installed ns2 as user. Its good practice to install ns2 as root ( now, user have access too).
P.S : if you didn't install ns2 as root, i suggest try to install as root.
@Reem kadi,
DeleteQ1. You can have your tcl file, anywhere in the local and you can run. But its best practice to have it under AODV. Its like all codes we need to change in the same place. But one thing is clear, you need to run "./configure" "make clean" "make" "make install" under ns-2.35 folder. Hope, it helps.
this is the error when try to compile under ns-2.35 folder:
ReplyDelete./configure line 2097: config.log: Permission Denied
./configure line 2107: config.log: Permission Denied
As i already mentioned @Reem kadi, you don't have access. It's clearly states permissed denied. One way to solve is, install as root.
Deletei fix everything...now error is on runing tcl coding..when i run tcl coding of malicious node the following error occur:
ReplyDeletenum_nodes is set 5
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
ns: _o114 malicious:
(_o114 cmd line 1)
invoked from within
"_o114 cmd malicious"
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 "_o114" line 2)
(SplitObject unknown line 2)
invoked from within
"_o114 malicious"
Hi i reinstall ns2 as a root and the problem is the same, I need to log as a root to compile files any suggestions please
ReplyDeleteHi everybody after lots of reading I found a solution and it works but I do not know if it is a correct method or not:
ReplyDeleteI put sudo before every command to compile like the followings:
under ns-2.35 I wrote: sudo ./configure
then sudo make clean , then sudo make, then sudo make install. after that everything works and I did not get the permission denied again. Am I wright please
hi reem...i need your help..please tell me how to install ns2 as a root?? where to install it??
DeleteHi first I log in as a root by typing sudo su
ReplyDeletethen I follow this steps:
http://karthicksivakrr.blogspot.in/2013/11/ns2-tips_27.html
good luck
well done @Reem
Deleteya everything works well now...thnxxx to u karthick....help me in future too
ReplyDeleteHow to check if a node is within the transmission range of a selected node ?
ReplyDelete@Vishnu, in AODV you can check its neighbour list. If we are speaking of now now, you can send a hello packet and then confirm it existence.
Deletehow i can go back to simple aodv from malicious??
ReplyDelete@barinder, ask more specific.
ReplyDeletecan you please send me the coding of simple aodv with graphs on my email :- barinderpal.singh013@gmail.com
ReplyDelete@barinder, i don't provide code.
Deletei need one more help...tell me how to isolate malicious node ??
ReplyDelete@barinder, actually i missed your comment. Isolation of malicious node, its very simple. Just don't forward packets through malicious node(if its next hop); Don't accept the route(RREQ), if it has malicious node route. I believe i already discussed this one with @amatek or someone else. Look for the comments section of posts in google+.(it has detailed description). Hope it helps.
ReplyDeleteI did the same but i am getting following error..
ReplyDeleteavinash@avinash-HP-Compaq-Elite-8300-SFF:~/Downloads$ ns aodv1.tcl
num_nodes is set 6
INITIALIZE THE LIST xListHead
ns: _o39 hacker:
(_o39 cmd line 1)
invoked from within
"_o39 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 "_o39" line 2)
(SplitObject unknown line 2)
invoked from within
"_o39 hacker"
@incredible, there is an splitObject object error. Most probably spacing error. Check it out, wherever you have mentioned hacker. Hope this helps.
ReplyDelete