To implement Primary User Emulation Attack (PUEA) detection in OMNeT++ has several steps that include generating a cognitive radio network (CRN) where secondary users (SUs) must identify malicious behaviour by other SUs pretending to be primary users (PUs). The aim is to classify these attacks and take proper action, like preventing the compromised channel or alerting other network nodes. The following is the procedure to implement the PUEA detection in OMNeT++:
Steps to Implement PUEA Detection in OMNeT++
Example: Implementing Basic PUEA Detection in OMNeT++
// PUEADetectionNetwork.ned
package networkstructure;
import inet.node.inet.WirelessHost;
network PUEADetectionNetwork
{
parameters:
int numPUs = default(2); // Number of primary users
int numLegitimateSUs = default(5); // Number of legitimate secondary users
int numMaliciousSUs = default(2); // Number of malicious secondary users
submodules:
primaryUser[numPUs]: WirelessHost {
@display(“p=100,100”);
numApps = 1;
app[0].typename = “PrimaryUserApp”;
}
legitimateSU[numLegitimateSUs]: WirelessHost {
@display(“p=300,200”);
numApps = 1;
app[0].typename = “LegitimateSUApp”;
}
maliciousSU[numMaliciousSUs]: WirelessHost {
@display(“p=500,200”);
numApps = 1;
app[0].typename = “MaliciousSUApp”;
}
connections:
// Wireless communication is modeled, so no fixed connections are necessary
}
Generate a C++ class for the liable secondary user application that has contains a simple PUEA detection algorithm.
#include <omnetpp.h>
#include <inet/applications/base/ApplicationBase.h>
using namespace omnetpp;
using namespace inet;
class LegitimateSUApp : public ApplicationBase
{
protected:
virtual void initialize(int stage) override;
virtual void handleMessageWhenUp(cMessage *msg) override;
void detectPUEA();
public:
virtual int numInitStages() const override { return NUM_INIT_STAGES; }
};
Define_Module(LegitimateSUApp);
void LegitimateSUApp::initialize(int stage)
{
ApplicationBase::initialize(stage);
if (stage == INITSTAGE_APPLICATION_LAYER) {
// Schedule initial detection
scheduleAt(simTime() + uniform(1, 3), new cMessage(“detectPUEA”));
}
}
void LegitimateSUApp::handleMessageWhenUp(cMessage *msg)
{
if (strcmp(msg->getName(), “detectPUEA”) == 0) {
detectPUEA();
scheduleAt(simTime() + uniform(1, 3), msg); // Re-schedule detection
} else {
delete msg;
}
}
void LegitimateSUApp::detectPUEA()
{
EV << “Detecting PUEA.” << endl;
// Example: Simple signal strength analysis for PUEA detection
double signalStrength = uniform(-90, -50); // Example signal strength
if (signalStrength > -60) { // Example threshold for detecting a potential PUEA
EV << “Potential PUEA detected. Signal strength: ” << signalStrength << endl;
// Implement further action, such as avoiding the channel or reporting the attack
} else {
EV << “No PUEA detected. Signal strength: ” << signalStrength << endl;
}
}
Generate a C++ class for the malicious secondary user application that emulates the PUEA behaviour.
class MaliciousSUApp : public ApplicationBase
{
protected:
virtual void initialize(int stage) override;
virtual void handleMessageWhenUp(cMessage *msg) override;
void emulatePrimaryUser();
public:
virtual int numInitStages() const override { return NUM_INITSTAGES; }
};
Define_Module(MaliciousSUApp);
void MaliciousSUApp::initialize(int stage)
{
ApplicationBase::initialize(stage);
if (stage == INITSTAGE_APPLICATION_LAYER) {
// Schedule initial PUEA emulation
scheduleAt(simTime() + uniform(1, 3), new cMessage(“emulatePU”));
}
}
void MaliciousSUApp::handleMessageWhenUp(cMessage *msg)
{
if (strcmp(msg->getName(), “emulatePU”) == 0) {
emulatePrimaryUser();
scheduleAt(simTime() + uniform(1, 3), msg); // Re-schedule emulation
} else {
delete msg;
}
}
void MaliciousSUApp::emulatePrimaryUser()
{
EV << “Emulating primary user to create a PUEA.” << endl;
// Simulate PUEA by transmitting a signal that mimics a primary user
cMessage *fakePUSignal = new cMessage(“FakePUSignal”);
send(fakePUSignal, “wlan$o”);
}
network = networkstructure.PUEADetectionNetwork
sim-time-limit = 300s
# Legitimate SU settings
*.legitimateSU[*].wlan.mac.maxQueueSize = 1000;
*.legitimateSU[*].wlan.phy.transmitter.power = 2mW;
*.legitimateSU[*].mobility.bounds = “500m 500m”;
*.legitimateSU[*].app[0].detectionThreshold = -60dBm;
# Malicious SU settings
*.maliciousSU[*].wlan.mac.maxQueueSize = 1000;
*.maliciousSU[*].wlan.phy.transmitter.power = 10mW; # Malicious SUs may transmit at higher power to emulate PUs
*.maliciousSU[*].mobility.bounds = “500m 500m”;
Running the Simulation
Extending the Example
Finally, we explore the simple implementation procedures how to simulate the Primary User Emulation Attack (PUEA) detection in OMNeT++ tool and we also provide related information about Primary User Emulation Attack (PUEA) detection.
Researchers can receive optimal implementation assistance for PUEA Detection within the OMNeT++ tool from our team. We also provide project topic ideas related to Traffic Congestion and offer guidance in network analysis support