MCPcopy Create free account
hub / github.com/BruceDevices/firmware / processQueuedProbeEvents

Function processQueuedProbeEvents

src/modules/wifi/karma_attack.cpp:1478–1559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1476}
1477
1478void processQueuedProbeEvents() {
1479 if (!karmaQueue) return;
1480
1481 QueuedProbeEvent event = {};
1482 while (xQueueReceive(karmaQueue, &event, 0) == pdTRUE) {
1483 ProbeRequest probe = {};
1484 strncpy(probe.mac, event.mac, sizeof(probe.mac) - 1);
1485 probe.mac[sizeof(probe.mac) - 1] = '\0';
1486 strncpy(probe.ssid, event.ssid, sizeof(probe.ssid) - 1);
1487 probe.ssid[sizeof(probe.ssid) - 1] = '\0';
1488 probe.rssi = event.rssi;
1489 probe.timestamp = event.timestamp;
1490 probe.channel = event.channel;
1491 probe.fingerprint = event.fingerprint;
1492
1493 analyzeClientBehavior(probe);
1494 updateChannelActivity(probe.channel);
1495 updateSSIDFrequency(probe.ssid);
1496
1497 String ssid = probe.ssid;
1498 String mac = probe.mac;
1499
1500 if ((karmaMode == MODE_PASSIVE || karmaMode == MODE_FULL) && broadcastAttack.isActive() &&
1501 ssid != "*WILDCARD*" && SSIDDatabase::contains(ssid)) {
1502 handleBroadcastResponse(ssid, mac);
1503 }
1504
1505 bool isRandomizedMAC = false;
1506 if (mac.startsWith("12:") || mac.startsWith("22:") || mac.startsWith("32:") ||
1507 mac.startsWith("42:")) {
1508 isRandomizedMAC = true;
1509 }
1510
1511 static uint32_t fakeMACCounter = 0;
1512 if (isRandomizedMAC) {
1513 fakeMACCounter++;
1514 if (fakeMACCounter % 50 == 0) {
1515 if (macBlacklist.find(mac) == macBlacklist.end() && macBlacklist.size() >= MAC_CACHE_SIZE) {
1516 macBlacklist.erase(macBlacklist.begin());
1517 }
1518 macBlacklist[mac] = millis();
1519 continue;
1520 }
1521 }
1522
1523 if (broadcastAttack.isActive()) broadcastAttack.processProbeResponse(ssid, mac);
1524
1525 if (!karmaConfig.enableAutoKarma) continue;
1526
1527 auto it = clientBehaviors.find(probe.fingerprint);
1528 if (it == clientBehaviors.end()) continue;
1529
1530 ClientBehavior &client = it->second;
1531 uint8_t priority = calculateAttackPriority(client, probe);
1532 if (priority < attackConfig.priorityThreshold) continue;
1533 if (millis() - client.lastKarmaAttempt <= 10000) continue;
1534
1535 queueProbeResponse(probe, event.rsn);

Callers 1

karma_setupFunction · 0.85

Calls 15

analyzeClientBehaviorFunction · 0.85
updateChannelActivityFunction · 0.85
updateSSIDFrequencyFunction · 0.85
handleBroadcastResponseFunction · 0.85
millisFunction · 0.85
calculateAttackPriorityFunction · 0.85
queueProbeResponseFunction · 0.85
determineAttackTierFunction · 0.85
probeSSIDEqualsFunction · 0.85
getPortalDurationFunction · 0.85
enqueuePendingPortalFunction · 0.85
isActiveMethod · 0.80

Tested by

no test coverage detected