The topology in the wired network is set-up using the node and link creation APIs. The tcl script in ddos_attack.tcl creates the DDOS attack with the aim of denying normal service or degrading of the quality of services. In Distributed Denial-of-Service (DDoS) attacks huge amount of requests are generated to victims through compromised computers (zombies). Data transmission is carried out between the genuine client and also from attacker to victim using the UDP connection and CBR application.
# Filename: ddos_attack.tcl
# Flow1 (Normal + attack)
set udp0 [$ns create-connection UDP $n(22) LossMonitor $n(0) 0]
$udp0 set fid_ 16
set cbr0 [$udp0 attach-app Traffic/CBR]
$cbr0 set packetSize_ 1000
$cbr0 set interval_ .01
$ns at 65.4 "$cbr0 start"
$ns at 70.4 "$cbr0 stop"
set udp0 [$ns create-connection UDP $n(14) LossMonitor $n(0) 0]
$udp0 set fid_ 17
set cbr0 [$udp0 attach-app Traffic/CBR]
$cbr0 set packetSize_ 1000
$cbr0 set interval_ .001
$ns at 65.4 "$cbr0 start"
$ns at 125.4 "$cbr0 stop"
# Flow2 (attack + Normal + attack)
set udp0 [$ns create-connection UDP $n(19) LossMonitor $n(0) 0]
$udp0 set fid_ 18
set cbr0 [$udp0 attach-app Traffic/CBR]
$cbr0 set packetSize_ 1000
$cbr0 set interval_ .001
$ns at 65.4 "$cbr0 start"
$ns at 125.4 "$cbr0 stop"
set udp0 [$ns create-connection UDP $n(12) LossMonitor $n(0) 0]
$udp0 set fid_ 19
set cbr0 [$udp0 attach-app Traffic/CBR]
$cbr0 set packetSize_ 1000
$cbr0 set interval_ .01
$ns at 65.4 "$cbr0 start"
$ns at 70.4 "$cbr0 stop"
set udp0 [$ns create-connection UDP $n(8) LossMonitor $n(0) 0]
$udp0 set fid_ 20
set cbr0 [$udp0 attach-app Traffic/CBR]
$cbr0 set packetSize_ 1000
$cbr0 set interval_ .001
$ns at 65.4 "$cbr0 start"
$ns at 125.4 "$cbr0 stop"
# Flow3 (Normal)
set udp0 [$ns create-connection UDP $n(5) LossMonitor $n(0) 0]
$udp0 set fid_ 21
set cbr0 [$udp0 attach-app Traffic/CBR]
$cbr0 set packetSize_ 1000
$cbr0 set interval_ .01
$ns at 65.4 "$cbr0 start"
$ns at 100.4 "$cbr0 stop"
DDOS Attack