Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to create Grayhole attack in MANET using NS2?

Description

A Mobile Ad hoc Network (MANET) comprises of mobile nodes that moves independently in an open environment. Communication between the nodes in a MANET is enabled with the aid of intermediate routers. The nature of MANET such as open medium, dynamic network topology, lack of centralized monitoring, and lack of clear defense mechanisms makes it vulnerable to several routing attacks. In MANET routing, there is a high probability for intermediate nodes to be malicious that might be a threat to the security. Grayhole is the common attack in ad hoc routing in which the malicious node uses the process of routing to state itself of being the shortest path to the destination. Once it receives the data packets, it drops some of the data packets and forwards the remaining data packets to its neighbors. In sample21.tcl, the Grayhole attacker does not obey the communication model. Data Transmission is established between nodes using UDP agent and CBR traffic. Sender sends the data via attacker. Source node transfers data to attacker that does not have shortest route to Destination. Attacker partially forwards the data packets to its neighbors and partially drops the data packets.

Sample Code

TCL part :

#*******Data Transmission from Source to Destination*****

set udp [new Agent/UDP]
$ns attach-agent $node_($source) $udp
set null [new Agent/Null]
$ns attach-agent $node_($destination) $null
$ns connect $udp $null
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set packetSize_ 512
$cbr set interval_ 0.1
$ns at 3.0 "$cbr start"
$ns at 3.1 "$ns trace-annotate \" Data transmission from source node to destination node\""
$ns at 5.0 "[$node_(5) set ragent_] malicious"
$ns at 5.0 "$node_(5) color red"
$ns at 5.0 "$node_(5) label Attacker"
$ns at 5.1 "$ns trace-annotate \" Node_5 is malicious node which node drops the packet \""
$ns at 10.0 "$cbr stop"

C++ part :

if (malicious == true) {
if (ch->ptype_ == PT_CBR) {
int x;
x = Random::uniform(0,10);
if (x > 3) {
drop(p, DROP_RTR_ROUTE_LOOP);
return;
}

}
}

Screenshots

create Grayhole attack in MANET