How to Simulate Spoofing Wireshark Projects Using OMNeT++

To simulate spoofing attacks with Wireshark in OMNeT++ has needs to configure a network scenario in which the malicious nodes spoofs addresses (like IP or MAC addresses) to impersonate another device capture traffic, or redirect interaction. We can then track and evaluate the network traffic using Wireshark within OMNeT++.

Here’s a step-by-step guide to simulate spoofing attacks (like IP or ARP spoofing) in OMNeT++ and evaluate the outcomes using Wireshark.

Steps to Simulate Spoofing Wireshark Projects in OMNeT++

  1. Install OMNeT++ and INET Framework
  • Download and install OMNeT++.
  • Download and install the INET framework from INET GitHub repository. INET contain network components for managing numerous kinds of traffic and attacks, like ARP and IP-based communications.
  1. Set up Wireshark Integration

To track and evaluate network traffic using Wireshark, we need to allow packet capture in OMNeT++. OMNeT++ can export packet data to pcap files that can be opened in Wireshark.

Add the following settings in the omnetpp.ini file to permit packet capture:

# Enable packet capture in OMNeT++

**.pcapRecorder.enable = true

**.pcapRecorder.packetFilter = “all”  # Capture all packets (can be refined)

**.pcapRecorder.file = “output/capture.pcap”

This will allow the recording of all network traffic into a .pcap file, that can evaluate later with Wireshark.

  1. Understand Spoofing Attacks
  • IP Spoofing: A malicious node transmits packets with a false source IP address to impersonate another device.
  • ARP Spoofing: A malicious node transmit fake ARP messages to link its MAC address with another device’s IP address, interrupting or redirecting network traffic.
  1. Set up a Network Topology in NED

Generate a network with a client, a server, and a malicious node that act as the spoofing threats.

Example NED File for a Network with Spoofing:

network SpoofingAttackNetwork {

submodules:

client: StandardHost {

@display(“p=100,200”);

}

server: StandardHost {

@display(“p=300,200”);

}

attacker: StandardHost {

@display(“p=200,150”);

}

connections allowunconnected:

client.ethg++ <–> Eth100M <–> attacker.ethg++;

attacker.ethg++ <–> Eth100M <–> server.ethg++;

}

Explanation:

  • Client: Transmit legitimate traffic to the server.
  • Server: Receives traffic from the client.
  • Attacker: The malicious node that spoofs traffic to take off either the client or server.
  1. Configure Legitimate Traffic

The client and server will interacted by using TCP or UDP. For the time being the attacker will insert spoofed packets to impersonate one of the devices.

Example omnetpp.ini Configuration for Client-Server Communication:

network = SpoofingAttackNetwork

sim-time-limit = 100s

# Server application (listening on TCP port 80)

**.server.numApps = 1

**.server.app[0].typename = “TcpServerApp”

**.server.app[0].localPort = 80

# Client application (sending TCP traffic to server)

**.client.numApps = 1

**.client.app[0].typename = “TcpApp”

**.client.app[0].connectAddress = “server”

**.client.app[0].connectPort = 80

**.client.app[0].tOpen = 0s

**.client.app[0].sendBytes = 1000B

In this configuration:

  • The client transmits data to the server over a TCP connection.
  • This setup generates a legitimate communication channel that can be targeted by the attacker.
  1. Implement IP Spoofing

The attacker can transmit forged packets with a fake source IP address to mimic wheather the client or the server.

Example Attacker Configuration for IP Spoofing:

#include “inet/applications/base/ApplicationBase.h”

#include “inet/networklayer/ipv4/Ipv4Header_m.h”

#include “inet/networklayer/contract/ipv4/Ipv4ControlInfo.h”

#include “inet/common/packet/Packet.h”

class IpSpoofingApp : public inet::ApplicationBase {

protected:

virtual void initialize(int stage) override;

virtual void handleMessage(cMessage *msg) override;

virtual void sendSpoofedPacket();

public:

IpSpoofingApp() {}

virtual ~IpSpoofingApp() {}

};

Define_Module(IpSpoofingApp);

void IpSpoofingApp::initialize(int stage) {

if (stage == inet::INITSTAGE_APPLICATION_LAYER) {

// Schedule packet sending after some time

scheduleAt(simTime() + 1.0, new cMessage(“sendSpoofedPacket”));

}

}

void IpSpoofingApp::handleMessage(cMessage *msg) {

if (strcmp(msg->getName(), “sendSpoofedPacket”) == 0) {

sendSpoofedPacket();

}

delete msg;

}

void IpSpoofingApp::sendSpoofedPacket() {

inet::Packet *packet = new inet::Packet(“SpoofedPacket”);

// Create IPv4 header with spoofed source IP

auto ipv4Header = inet::makeShared<inet::Ipv4Header>();

ipv4Header->setSrcAddress(inet::Ipv4Address(“192.168.1.1”));  // Spoof client’s IP

ipv4Header->setDestAddress(inet::Ipv4Address(“192.168.1.2”));  // Target server

// Add spoofed IP header to the packet

packet->insertAtFront(ipv4Header);

// Send the packet to the server

send(packet, “out”);

}

  • IpSpoofingApp generates a packet with a fake source IP (192.168.1.1, that could be the client’s IP) and transmit it to the server.
  • This simulates IP spoofing, in which the attacker makes believe to be the legitimate client.
  1. Configure the Attacker in omnetpp.ini

# Attacker using IP Spoofing to impersonate the client

**.attacker.numApps = 1

**.attacker.app[0].typename = “IpSpoofingApp”

The attacker will transmit spoofed packets after 1 second into the simulation, pretending to be the legitimate client.

  1. Run the Simulation
  • Execute the simulation in OMNeT++.
  • The attacker will insert spoofed packets into the network since the client and server communicates.
  1. Capture and Analyse Traffic with Wireshark

Once the simulation is done, open the generated capture.pcap file in Wireshark to evaluate the traffic.

Steps to open the file in Wireshark:

  1. Launch Wireshark.
  2. Open the generated .pcap file (output/capture.pcap).
  3. Filter the traffic to view certain packets (e.g., ip.src == 192.168.1.1 to see spoofed packets).
  4. Measure on how the attacker’s spoofed packets implement legitimate traffic.
  1. Simulate ARP Spoofing

We also replicate ARP spoofing in which the attacker transmit forged ARP replies to link its MAC address with the IP address of another device (client or server). ARP spoofing can enable the attacker to interrupt or adjust traffic.

Example ARP Spoofing Configuration:

void ArpSpoofingApp::sendSpoofedArpReply() {

auto arpPacket = new inet::Packet(“SpoofedARPReply”);

// Create ARP reply with forged MAC and IP address

auto arp = inet::makeShared<inet::ArpPacket>();

arp->setOpCode(inet::ARP_REPLY);

arp->setSrcIpAddress(inet::Ipv4Address(“192.168.1.1”));  // Spoof client’s IP

arp->setSrcMacAddress(inet::MacAddress(“aa:bb:cc:dd:ee:ff”));  // Attacker’s MAC

arp->setDestIpAddress(inet::Ipv4Address(“192.168.1.2”));  // Target server’s IP

arp->setDestMacAddress(inet::MacAddress(“ff:ee:dd:cc:bb:aa”));  // Server’s MAC

arpPacket->insertAtFront(arp);

 

send(arpPacket, “out”);

}

The attacker can now send spoofed ARP replies, make up to be the legitimate client, and intercept the traffic.

  1. Run the ARP Spoofing Simulation

Once we have configured ARP spoofing, execute the simulation and capture the network traffic to evaluate it with Wireshark.

In Wireshark, filter for ARP packets to see if any spoofed ARP responses are being transmit (arp.opcode == 2 for ARP replies).

Example Projects for Spoofing Attack Simulations:

  1. IP Spoofing Attack: replicate IP spoofing to impersonate a client or server and measure the effect on communication.
  2. ARP Spoofing Attack: Replicate ARP spoofing to redirect or interrupt traffic among two devices.
  3. Mitigating Spoofing Attacks: Execute and replicate countermeasures like ARP inspection or IP-MAC binding to mitigate spoofing attacks.
  4. Sniffing Traffic after Spoofing: Integrate spoofing with traffic sniffing to capture sensitive information or adjust traffic among two hosts.
  5. Advanced Packet Injection: generate more complex spoofing attacks, like session hijacking or man-in-the-middle (MITM) attacks.

At the end of this brief demonstration, you can get to know about the spoofing attacks with Wireshark projects and their simulation process. Also, we can provide more information regarding spoofing attacks with Wireshark through another manual.

We have everything you need to complete your work! Just send us a message, and we’ll help you with the best support and clear explanations. Let us handle your projects for network performance!

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2