(event)
| 117 | |
| 118 | // triggered when a new WiFi access point is detected |
| 119 | function onNewAP(event){ |
| 120 | var ap = event.data; |
| 121 | |
| 122 | // check fake ap first |
| 123 | if(ap.hostname == fakeESSID) { |
| 124 | if(notifyRogueAPs) { |
| 125 | var message = '🦠 Detected rogue AP:\n\n' + |
| 126 | decorateMac('AP', ap.mac, ap.vendor); |
| 127 | // send to telegram bot |
| 128 | sendMessage(message); |
| 129 | } |
| 130 | return; |
| 131 | } |
| 132 | |
| 133 | if( ap.mac in db.aps ) { |
| 134 | updateAP(ap); |
| 135 | } else { |
| 136 | createAP(ap); |
| 137 | } |
| 138 | |
| 139 | saveJSON(db, dbPath); |
| 140 | } |
| 141 | |
| 142 | // pretty print a MAC depending if it's an IP endpoint or WiFi access point |
| 143 | function decorateAddress(label, mac) { |
nothing calls this directly
no test coverage detected