Skip to content

Commit

Permalink
misc: small fix or general refactoring i did not bother commenting
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Apr 9, 2021
1 parent 3c506b7 commit 2b4188b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
22 changes: 20 additions & 2 deletions _example/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function onNewAP(event){
if(ap.hostname == fakeESSID) {
graph(ap.mac, '/tmp/graph_ap.png');

var message = '🚨 Detected possible rogue AP:\n\n' +
var message = '🦠 Detected rogue AP:\n\n' +
// 'Time: ' + event.time + "\n" +
// 'GPS: lat=' + session.GPS.Latitude + " lon=" + session.GPS.Longitude + " updated_at=" +
//session.GPS.Updated.String() + "\n\n" +
Expand Down Expand Up @@ -74,6 +74,22 @@ function onHandshake(event){
sendPhoto("/tmp/graph_handshake.png");
}

function onNewNode(event) {
var node = event.data;

if(node.type != 'ssid' && node.type != 'ble_server') {
graph(node.id, '/tmp/graph_node.png');

var message = '🖥️ Detected previously unknown ' + node.type + ':\n\n' +
'Type: ' + node.type + "\n" +
'MAC: ' + node.id;

// send to telegram bot
sendMessage(message);
sendPhoto("/tmp/graph_node.png");
}
}

function onTick(event) {
run('wifi.probe ' + fakeBSSID + ' ' + fakeESSID);
}
Expand Down Expand Up @@ -103,4 +119,6 @@ onEvent('wifi.deauthentication', onDeauthentication);
// register for wifi.client.handshake events
onEvent('wifi.client.handshake', onHandshake);
// register for wifi.ap.new events
onEvent('wifi.ap.new', onNewAP);
onEvent('wifi.ap.new', onNewAP);

onEvent('graph.node.new', onNewNode);
26 changes: 24 additions & 2 deletions graphpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
<div id="3d-graph"></div>

<script>
const typeNodeColors = {
'ble_server': '#0066ff',

'ssid': 'transparent',
'station': '#ffcc33',
'access_point': '#ff9900',

'endpoint': '#33cc33',
'gateway': '#006600'
};

const typeColors = {
'ble_server': '#0066ff',
Expand All @@ -40,7 +50,7 @@
(document.getElementById('3d-graph'))
.jsonUrl('bettergraph.json')
.nodeLabel('id')
.nodeColor(node => typeColors[node.type])
.nodeColor(node => typeNodeColors[node.type])
.linkDirectionalArrowLength(3.5)
.linkDirectionalArrowRelPos(1)
/*
Expand Down Expand Up @@ -130,8 +140,20 @@

nodeEl.style.color = typeColors[node.type];
nodeEl.className = 'node-label';

return new THREE.CSS2DObject(nodeEl);
})
.nodeThreeObjectExtend(true);
.nodeThreeObjectExtend(true)
.onNodeClick(node => {
// Aim at node from outside it
const distance = 40;
const distRatio = 1 + distance/Math.hypot(node.x, node.y, node.z);

Graph.cameraPosition(
{ x: node.x * distRatio, y: node.y * distRatio, z: node.z * distRatio }, // new position
node, // lookAt ({ x, y, z })
3000 // ms transition duration
);
});
</script>
</body>
2 changes: 1 addition & 1 deletion modules/wifi/wifi_recon_handshakes.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (mod *WiFiModule) discoverHandshakes(radiotap *layers.RadioTap, dot11 *laye
})

if target != nil {
mod.Info("saving extra %s frame (%d bytes) for %s",
mod.Debug("saving extra %s frame (%d bytes) for %s",
dot11.Type.String(),
len(packet.Data()),
target.String())
Expand Down

0 comments on commit 2b4188b

Please sign in to comment.