LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-28-2011, 06:11 AM   #16
mleoking
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Rep: Reputation: Disabled
About AWK


Quote:
Originally Posted by mujtiba View Post
respected Sir,
need help to install awk
Hi,

I did not install awk myself as it is ready to use in most Linux distributions.

If your Linux system does not have it, you can refer to http://www.gnu.org/software/gawk/ to install awk.
 
Old 06-28-2011, 06:12 AM   #17
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
1) sudo apt-get install gawk

2) cd /usr/bin/ && sudo ln -s gawk awk
 
Old 07-02-2011, 05:44 AM   #18
mujtiba
LQ Newbie
 
Registered: May 2011
Posts: 14

Rep: Reputation: 2
@ mleoking
Add the following lines to the end of ns-default.tcl ("ns-allinone-2.33\ns-2.33\tcl\lib\ns-default.tcl").
# Added by leoking spoof config 0
Agent/TCP set saddr_min 1
Agent/TCP set saddr_max 100
Agent/TCP set spoof_level 0

Agent/UDP set saddr_min 1
Agent/UDP set saddr_max 100
Agent/UDP set spoof_level 0
# Added by leoking spoof config 1

this was not helpful in solving the warning problem
 
Old 07-02-2011, 06:15 AM   #19
mleoking
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by mujtiba View Post
@ mleoking
Add the following lines to the end of ns-default.tcl ("ns-allinone-2.33\ns-2.33\tcl\lib\ns-default.tcl").
# Added by leoking spoof config 0
Agent/TCP set saddr_min 1
Agent/TCP set saddr_max 100
Agent/TCP set spoof_level 0

Agent/UDP set saddr_min 1
Agent/UDP set saddr_max 100
Agent/UDP set spoof_level 0
# Added by leoking spoof config 1

this was not helpful in solving the warning problem
Did you get the statistical results like the following:

rate_f1_normal 650.840000 rate_f1_attack 619.410000 nth_f1 0.951709
rate_f2_normal 0.000000 rate_f2_attack 12601.000000 nth_f2

It seems to me that your warning "warning: no class variable Agent/TCP/Newreno::saddr_max" means that you have not finished the steps in integration-of-ip-spoofing.txt. I attached a new version of "integration-of-ip-spoofing.txt" to this thread:

1. Copy the following files into the directory "ns-allinone-2.33\ns-2.33\common".
agent-leo.h
agent-leo.cc

2. Modify tcp.h ("ns-allinone-2.33\ns-2.33\tcp\tcp.h")
2.1. Insert the following line of code after [#include "agent.h"]:
#include "agent-leo.h"
2.2. Replace "public Agent" with "public LeoAgent"

3. Modify tcp.cc ("ns-allinone-2.33\ns-2.33\tcp\tcp.cc")
3.1. Replace "Agent(PT_TCP)" with "LeoAgent(PT_TCP)"
3.2. Replace "Agent::command(argc, argv)" with "LeoAgent::command(argc, argv)"

4. Modify udp.h ("ns-allinone-2.33\ns-2.33\apps\udp.h")
2.1. Insert the following line of code after [#include "agent.h"]:
#include "agent-leo.h"
2.2. Replace "public Agent" with "public LeoAgent"

5. Modify udp.cc ("ns-allinone-2.33\ns-2.33\apps\udp.cc")
3.1. Replace "Agent(PT_UDP)" with "LeoAgent(PT_UDP)"
3.2. Replace "Agent(type)" with "LeoAgent(type)"
3.3. Replace "Agent::command(argc, argv)" with "LeoAgent::command(argc, argv)"

6. Add the following lines to the end of ns-default.tcl ("ns-allinone-2.33\ns-2.33\tcl\lib\ns-default.tcl").
# Added by leoking spoof config 0
Agent/TCP set saddr_min 1
Agent/TCP set saddr_max 100
Agent/TCP set spoof_level 0

Agent/UDP set saddr_min 1
Agent/UDP set saddr_max 100
Agent/UDP set spoof_level 0
# Added by leoking spoof config 1

7. Insert the following line of code before "$(OBJ_STL)" in the Makefile ("ns-allinone-2.33\ns-2.33\Makefile"):
common/agent-leo.o \

8. Recompile the ns-allinone-2.33 system by using the following commands (you should execute these commands in the ns-2.33 directory "ns-allinone-2.33\ns-2.33"):
make clean
make depend
make

Have finished all of the above steps, particular steps 2, 3, 4, 5. Also for the last step, say recompile the ns system, you need to make sure that the ns system is really recompiled. Sometimes, you have to delete all the *.o files and synchronize the time mark of all the files using these two commands:

rm *.o
touch *


under these directories:

ns-allinone-2.33\ns-2.33\common
ns-allinone-2.33\ns-2.33\tcp
ns-allinone-2.33\ns-2.33\apps


and do step8 again to force the ns system to be recompiled.

8. Recompile the ns-allinone-2.33 system by using the following commands (you should execute these commands in the ns-2.33 directory "ns-allinone-2.33\ns-2.33"):
make clean
make depend
make


Hope this helps.
Attached Files
File Type: txt integration-of-ip-spoofing.txt (3.9 KB, 33 views)

Last edited by mleoking; 07-02-2011 at 06:41 AM.
 
Old 07-03-2011, 03:25 AM   #20
mleoking
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Rep: Reputation: Disabled
Exclamation

Quote:
Originally Posted by mujtiba View Post
@ mleoking
Add the following lines to the end of ns-default.tcl ("ns-allinone-2.33\ns-2.33\tcl\lib\ns-default.tcl").
# Added by leoking spoof config 0
Agent/TCP set saddr_min 1
Agent/TCP set saddr_max 100
Agent/TCP set spoof_level 0

Agent/UDP set saddr_min 1
Agent/UDP set saddr_max 100
Agent/UDP set spoof_level 0
# Added by leoking spoof config 1

this was not helpful in solving the warning problem
I just tried the integration process of ip spoofing support in my ns2 and found there was no warning after finishing the steps in "integration-of-ip-spoofing.txt". It worked fine.

It is worth noting that you need to check whether there is a file named "agent-leo.o" in the directory of "ns-allinone-2.33\ns-2.33\common" after you finish the integration of ip spoofing.

If there is not such a file, your ns was not really recompiled. You need to force it to recompile using the ways in my last threat.
 
Old 07-06-2011, 12:57 AM   #21
mujtiba
LQ Newbie
 
Registered: May 2011
Posts: 14

Rep: Reputation: 2
when i try to make it
it gives me following error
./common/packet.h:258:26: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:261:18: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:264:18: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:267:17: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:270:21: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:272:20: warning: deprecated conversion from string constant to ‘char*’
apps/udp.cc: In constructor ‘UdpAgent::UdpAgent(packet_t)’:
apps/udp.cc:67:37: error: type ‘Agent’ is not a direct base of ‘UdpAgent’
apps/udp.cc:67:47: error: no matching function for call to ‘LeoAgent::LeoAgent()’
./common/agent-leo.h:43:2: note: candidates are: LeoAgent::LeoAgent(packet_t)
./common/agent-leo.h:41:31: note: LeoAgent::LeoAgent(const LeoAgent&)
make: *** [apps/udp.o] Error 1
[mujtiba@ddos ns-2.32]$
 
Old 07-06-2011, 01:01 AM   #22
mujtiba
LQ Newbie
 
Registered: May 2011
Posts: 14

Rep: Reputation: 2
also the file agent-leo.o is not in my common folder
there are files
agent-leo.cc
agent-leo.h
 
Old 07-06-2011, 01:03 AM   #23
mujtiba
LQ Newbie
 
Registered: May 2011
Posts: 14

Rep: Reputation: 2
@mleoking
suggest some help

Last edited by mujtiba; 07-06-2011 at 01:05 AM.
 
Old 07-06-2011, 04:06 AM   #24
mleoking
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Rep: Reputation: Disabled
Lightbulb

Quote:
Originally Posted by mujtiba View Post
when i try to make it
it gives me following error
./common/packet.h:258:26: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:261:18: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:264:18: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:267:17: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:270:21: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:272:20: warning: deprecated conversion from string constant to ‘char*’
apps/udp.cc: In constructor ‘UdpAgent::UdpAgent(packet_t)’:
apps/udp.cc:67:37: error: type ‘Agent’ is not a direct base of ‘UdpAgent’
apps/udp.cc:67:47: error: no matching function for call to ‘LeoAgent::LeoAgent()’
./common/agent-leo.h:43:2: note: candidates are: LeoAgent::LeoAgent(packet_t)
./common/agent-leo.h:41:31: note: LeoAgent::LeoAgent(const LeoAgent&)
make: *** [apps/udp.o] Error 1
[mujtiba@ddos ns-2.32]$
Hi,

The error "apps/udp.cc:67:37: error: type ‘Agent’ is not a direct base of ‘UdpAgent’" shows that you might have not finished the step:

5.2. Replace "Agent(type)" with "LeoAgent(type)" in

5. Modify udp.cc ("ns-allinone-2.33\ns-2.33\apps\udp.cc")
5.1. Replace "Agent(PT_UDP)" with "LeoAgent(PT_UDP)"
5.2. Replace "Agent(type)" with "LeoAgent(type)"
5.3. Replace "Agent::command(argc, argv)" with "LeoAgent::command(argc, argv)"

I have compared the following files between ns2.32 and ns2.33:
agent.cc agent.h tcp.cc tcp.h udp.cc udp.h
And found that agent.cc, agent.h, udp.cc, udp.h are actually exactly the same between ns2.32 and ns2.33. There are minor modifications in tcp.cc and tcp.h in ns2.33 compared to that of ns2.32. I believe the steps in "integration-of-ip-spoofing.txt" can also be applied to ns2.32.

You need to double check if you have completely followed the steps in "integration-of-ip-spoofing.txt".

It is also worth noting that the overwriting method mentioned at the end of the "integration-of-ip-spoofing.txt" might only be applied to ns2.33. Since you are using ns2.32, you should manually finish all the steps in "integration-of-ip-spoofing.txt" rather than directly overwrite udp.cc, udp.h, tcp.cc, tcp.h with the files provided in the AQM&DoS package.

Good luck to you.
 
Old 07-06-2011, 11:05 AM   #25
mleoking
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Rep: Reputation: Disabled
Lightbulb

Quote:
Originally Posted by mujtiba View Post
when i try to make it
it gives me following error
./common/packet.h:258:26: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:261:18: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:264:18: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:267:17: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:270:21: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:272:20: warning: deprecated conversion from string constant to ‘char*’
apps/udp.cc: In constructor ‘UdpAgent::UdpAgent(packet_t)’:
apps/udp.cc:67:37: error: type ‘Agent’ is not a direct base of ‘UdpAgent’
apps/udp.cc:67:47: error: no matching function for call to ‘LeoAgent::LeoAgent()’
./common/agent-leo.h:43:2: note: candidates are: LeoAgent::LeoAgent(packet_t)
./common/agent-leo.h:41:31: note: LeoAgent::LeoAgent(const LeoAgent&)
make: *** [apps/udp.o] Error 1
[mujtiba@ddos ns-2.32]$
I hope you have fixed you problem.

FYI, a slightly modified version (1.1) of AQM&DoS Simulation Platform is released. It mainly aims to simplify the steps of integrating the ip spoofing support. You could download it from here:

http://sites.google.com/site/cwzhang...lationplatform

The new steps are:

The ip spoofing function can be integrated into the NS2 distributions in these steps:
1. Copy the following files into the directory "ns-allinone-2.33\ns-2.33\common".
agent-leo.h

2. Modify agent.h ("ns-allinone-2.33\ns-2.33\common\agent.h")
2.1. Insert the following line of code in a new line before "class Application;":
#include "agent-leo.h" //Added by leoking
2.2. Replace "class Agent : public Connector {" with "class Agent : public Connector, public AgentLeo {//Modified by leoking"

3. Modify agent.cc ("ns-allinone-2.33\ns-2.33\common\agent.cc")
3.1. Insert the following line of code into the function body of "Agent::Agent(packet_t pkttype)":
init_agent_leo();//Added by leoking
3.2. Insert the following line of code into the end of the function body of "Agent::initpkt(Packet* p)":
initpkt_after(p); //Added by leoking

4. Add the following lines to the end of ns-default.tcl ("ns-allinone-2.33\ns-2.33\tcl\lib\ns-default.tcl"):
# Added by leoking spoof config 0
Agent set saddr_min_ 1
Agent set saddr_max_ 100
Agent set spoof_level_ 0
# Added by leoking spoof config 1

5. Recompile the ns-allinone-2.33 system by using the following commands (you should execute these commands in the ns-2.33 directory "ns-allinone-2.33\ns-2.33"):
make clean
make depend
make

But, for ns-2.33 and ns-3.2, you do not need to manually do step 2 and 3, you could simply use agent.h and agent.cc provided in the package to overwrite their corresponding files in the NS2 distribution.
But you still need to finished step 1, 4 and 5.

You can continue using the AQM&DoS Simulation Platform that you had got (version 1.0) and fix your problems according to my previous threat.

Or you can choose to use the new version 1.1. But, as you have modified tcp.cc, tcp.h, udp.cc and udp.h according to the instructions of the old version of AQM&DoS, you need to use the original files (tcp.cc, tcp.h, udp.cc and udp.h) from the your ns distribution to overwrite the modified files before you start using the AQM&DoS 1.1.

If you did not backup the original files (tcp.cc, tcp.h, udp.cc and udp.h) of your ns, you can find them here:

http://sourceforge.net/projects/nsna...ar.gz/download

Last edited by mleoking; 07-06-2011 at 11:07 AM.
 
Old 09-12-2011, 01:40 AM   #26
baharehmk
LQ Newbie
 
Registered: Aug 2011
Posts: 17
Blog Entries: 3

Rep: Reputation: Disabled
Unhappy simulating ddos in ns

Quote:
Originally Posted by rohiinii View Post
Hi Hinatariq,

Its past 3 months I'm learning the NS-2 tool. Since, my project is also based on simulation of DDoS attacks and traceback of the attack origin.To get the graphs, you need to write AWK scripts and redirect it to a graph within the AWK script.
e.g 1)ns test.tcl
2)awk -f losspackets.awk out.tr
3)xgraph graph1
You'll get the xgraph named graph1.
Browse the net for awk scripts and modify according to your requirements.
Its difficult to understand the flow of NS-2 in the beginning. Its necessary to understand the of the NS-2 trace file format for plotting of graphs according to your requirement. Trace file is nothing but the raw data from which you can calculate values that is to be written in AWK script and plot graphs accordingly.
Regards,
rohiinii
hi
my project is simulating ddos in ns2
would you please help me
I am new in that
please help me
 
Old 09-13-2011, 04:39 AM   #27
mleoking
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Rep: Reputation: Disabled
Quote:
Originally Posted by baharehmk View Post
hi
my project is simulating ddos in ns2
would you please help me
I am new in that
please help me
Hey, have a look at the AQM&DoS Simulation Platform.

http://sites.google.com/site/cwzhang...lationplatform

I think it is what you need.
 
1 members found this post helpful.
Old 09-12-2012, 10:15 AM   #28
abdul10015
LQ Newbie
 
Registered: Sep 2012
Posts: 3

Rep: Reputation: Disabled
Hi i have to simulate DDoS and in ns2 ...and then have to genrate the graph using xgraph....i want to check the packet loss...acknowledgements...bandwidth and delays........at specific time interval.......how i can do this...????
what i have done yet is that i have simulated the DDoS but dnt know how to generate these different graphs and how to do their analysis...
Any idea.........i am using NS2 for the first time......Thanks in Advance...
 
Old 09-12-2012, 10:16 AM   #29
abdul10015
LQ Newbie
 
Registered: Sep 2012
Posts: 3

Rep: Reputation: Disabled
i have to simulate DDoS and DoS in ns2 using TCP ...and then have to genrate the graph using xgraph....i want to check the packet loss...acknowledgements...bandwidth and delays........at specific time interval.......how i can do this...????
what i have done yet is that i have simulated the DDoS but dnt know how to generate these different graphs and how to do their analysis...
Any idea.........i am using NS2 for the first time......Thanks in Advance...please please i need an urgent response from some one related to this

---------- Post added 09-12-12 at 04:17 PM ----------

and it is purely for research purpose in NS2
 
Old 09-12-2012, 10:21 AM   #30
abdul10015
LQ Newbie
 
Registered: Sep 2012
Posts: 3

Rep: Reputation: Disabled
i have to simulate DDoS and DoS in ns2 ...and then have to genrate the graph using xgraph....i want to check the packet loss...acknowledgements...bandwidth and delays........at specific time interval.......how i can do this...????
what i have done yet is that i have simulated the DDoS but dnt know how to generate these different graphs and how to do their analysis...
Any idea.........i am using NS2 for the first time......
 
  


Reply

Tags
aqm-dos, ddos-ns2, dos-ns2, 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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tora simulation does not come to an end in ns2.34 mq15 Linux - Software 3 10-01-2012 12:19 PM
ns2 Wireless simulation Help md_imranullah Programming 1 06-13-2012 02:19 AM
Anti Dos Or Anti DDos Ariyan Linux - Security 3 04-11-2009 11:18 AM
how to use "xgraph" in the scripts shells with ns2.33 in fc9 messy2010 Fedora 1 01-21-2009 03:56 AM
Plz.. help me. Network Simulation(NS2)'s problems everfree General 0 06-16-2008 01:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:53 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