Attack in NS2

What is Attack?Possible Attack in NS2 Simulation?

Intrusion in a network infrastructure is known as Network Attack.In a Network,with the use of unauthorized access resources are being exploited.Attack in NS2 will first analyze environment and collect information in order to exploit existing open port. We assist Engineering Students and PhD Scholars for implementing Attack in NS2 with Source Code.We have listed some attack in ns2 simulator with source code.

Categories of attack:

  • Port scanning.
  • Network sniffing.
  • Whaling.
  • Social engineering attack.
  • Vishing.
  • Phishing attack.
  • Watering hole attack.
  • Spear phishing attack.

Architecture of attack:


Journal Support for NS2 Projects:



Sample code for Attack in NS2:

This is the code for synchronization attack.

# subclass Agent/MessagePassing to make it do flooding

Class Agent/MessagePassing/Flooding -superclass Agent/MessagePassing

Agent/MessagePassing/Flooding instproc recv {source sport size data} {
    $self instvar messages_seen node_
    global ns BROADCAST_ADDR 

    # extract message ID from message
    set message_id [lindex [split $data ":"] 0]
    puts "\nNode [$node_ node-addr] got message $message_id\n"

    if {[lsearch $messages_seen $message_id] == -1} {
	lappend messages_seen $message_id
        $ns trace-annotate "[$node_ node-addr] received {$data} from $source"
        $ns trace-annotate "[$node_ node-addr] sending message $message_id"
	$self sendto $size $data $BROADCAST_ADDR $sport
    } else {
        $ns trace-annotate "[$node_ node-addr] received redundant message $message_id from $source"

Agent/MessagePassing/Flooding instproc send_message {size message_id data port} {
    $self instvar messages_seen node_

    lappend messages_seen $message_id
    $ns trace-annotate "[$node_ node-addr] sending message $message_id"
    $self sendto $size "$message_id:$data" $BROADCAST_ADDR $port