mirror of
https://github.com/bettercap/bettercap
synced 2025-07-11 07:37:00 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
3c506b7809
commit
2b4188bb52
3 changed files with 45 additions and 5 deletions
|
@ -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" +
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -104,3 +120,5 @@ onEvent('wifi.deauthentication', onDeauthentication);
|
|||
onEvent('wifi.client.handshake', onHandshake);
|
||||
// register for wifi.ap.new events
|
||||
onEvent('wifi.ap.new', onNewAP);
|
||||
|
||||
onEvent('graph.node.new', onNewNode);
|
|
@ -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',
|
||||
|
@ -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)
|
||||
/*
|
||||
|
@ -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>
|
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue