mirror of
https://github.com/bettercap/bettercap
synced 2025-07-08 05:51:37 -07:00
new: bot sending graphs
This commit is contained in:
parent
1be487843b
commit
6393dc1ea5
2 changed files with 41 additions and 20 deletions
|
@ -6,6 +6,10 @@ var fakeBSSID = random.Mac()
|
||||||
|
|
||||||
function onDeauthentication(event) {
|
function onDeauthentication(event) {
|
||||||
var data = event.data;
|
var data = event.data;
|
||||||
|
|
||||||
|
run('graph.to_dot ' + data.address1);
|
||||||
|
run('!dot -Tpng bettergraph.dot > /tmp/graph_deauth.png')
|
||||||
|
|
||||||
var message = '🚨 Detected deauthentication frame:\n\n' +
|
var message = '🚨 Detected deauthentication frame:\n\n' +
|
||||||
'Time: ' + event.time + "\n" +
|
'Time: ' + event.time + "\n" +
|
||||||
'GPS: lat=' + session.GPS.Latitude + " lon=" + session.GPS.Longitude + " updated_at=" + session.GPS.Updated.String() + "\n\n" +
|
'GPS: lat=' + session.GPS.Latitude + " lon=" + session.GPS.Longitude + " updated_at=" + session.GPS.Updated.String() + "\n\n" +
|
||||||
|
@ -17,17 +21,38 @@ function onDeauthentication(event) {
|
||||||
|
|
||||||
// send to telegram bot
|
// send to telegram bot
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
|
sendPhoto("/tmp/graph_deauth.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
function onNewAP(event){
|
||||||
|
var ap = event.data;
|
||||||
|
if(ap.hostname == fakeESSID) {
|
||||||
|
run('graph.to_dot ' + ap.mac);
|
||||||
|
run('!dot -Tpng bettergraph.dot > /tmp/graph_ap.png')
|
||||||
|
|
||||||
|
var message = '🚨 Detected possible 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" +
|
||||||
|
'AP: ' + ap.mac + ' (' + ap.vendor + ')';
|
||||||
|
|
||||||
|
// send to telegram bot
|
||||||
|
sendMessage(message);
|
||||||
|
sendPhoto("/tmp/graph_ap.png");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onHandshake(event){
|
function onHandshake(event){
|
||||||
var data = event.data;
|
var data = event.data;
|
||||||
var what = 'handshake';
|
var what = 'handshake';
|
||||||
|
|
||||||
|
run('graph.to_dot ' + data.station);
|
||||||
|
run('!dot -Tpng bettergraph.dot > /tmp/graph_handshake.png')
|
||||||
|
|
||||||
if(data.pmkid != null) {
|
if(data.pmkid != null) {
|
||||||
what = "RSN PMKID";
|
what = "RSN PMKID";
|
||||||
} else if(data.full) {
|
} else if(data.full) {
|
||||||
what += " (full)";
|
what += " (full)";
|
||||||
} else if(hand.half) {
|
} else if(data.half) {
|
||||||
what += " (half)";
|
what += " (half)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,21 +64,7 @@ function onHandshake(event){
|
||||||
|
|
||||||
// send to telegram bot
|
// send to telegram bot
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
sendPhoto("/tmp/graph_handshake.png");
|
||||||
|
|
||||||
function onNewAP(event){
|
|
||||||
var ap = event.data;
|
|
||||||
if(ap.hostname == fakeESSID) {
|
|
||||||
log("DETECTED KARMA ATTACK!!!");
|
|
||||||
// TODO: add reporting
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAnyEvent(event){
|
|
||||||
// if endpoint.new or endpoint.lost, clear the screen and show hosts
|
|
||||||
if( event.tag.indexOf('endpoint.') === 0 ) {
|
|
||||||
// run('clear; net.show');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTick(event) {
|
function onTick(event) {
|
||||||
|
@ -62,13 +73,18 @@ function onTick(event) {
|
||||||
|
|
||||||
log("session script loaded, fake AP is " + fakeESSID);
|
log("session script loaded, fake AP is " + fakeESSID);
|
||||||
|
|
||||||
|
// enable the graph module
|
||||||
|
run('graph on')
|
||||||
|
|
||||||
// create an empty ticker so we can run commands every few seconds
|
// create an empty ticker so we can run commands every few seconds
|
||||||
run('set ticker.commands ""')
|
run('set ticker.commands ""')
|
||||||
run('set ticker.period 10')
|
run('set ticker.period 10')
|
||||||
run('ticker on')
|
run('ticker on')
|
||||||
|
|
||||||
// enable recon and probing of new hosts
|
// enable recon and probing of new hosts
|
||||||
run('net.recon on');
|
run('net.recon on');
|
||||||
run('net.probe on');
|
run('net.probe on');
|
||||||
|
|
||||||
// enable wifi scanning
|
// enable wifi scanning
|
||||||
run('set wifi.interface ' + wifiInterface);
|
run('set wifi.interface ' + wifiInterface);
|
||||||
run('wifi.recon on');
|
run('wifi.recon on');
|
||||||
|
@ -81,6 +97,3 @@ onEvent('wifi.deauthentication', onDeauthentication);
|
||||||
onEvent('wifi.client.handshake', onHandshake);
|
onEvent('wifi.client.handshake', onHandshake);
|
||||||
// register for wifi.ap.new events
|
// register for wifi.ap.new events
|
||||||
onEvent('wifi.ap.new', onNewAP);
|
onEvent('wifi.ap.new', onNewAP);
|
||||||
|
|
||||||
// register for any event
|
|
||||||
onEvent(onAnyEvent);
|
|
|
@ -1,4 +1,6 @@
|
||||||
function sendMessage(message) {
|
function sendMessage(message) {
|
||||||
|
log(message);
|
||||||
|
|
||||||
var url = 'https://api.telegram.org/bot' + telegramToken +
|
var url = 'https://api.telegram.org/bot' + telegramToken +
|
||||||
'/sendMessage?chat_id=' + telegramChatId +
|
'/sendMessage?chat_id=' + telegramChatId +
|
||||||
'&text=' + http.Encode(message);
|
'&text=' + http.Encode(message);
|
||||||
|
@ -8,3 +10,9 @@ function sendMessage(message) {
|
||||||
log("error while running sending telegram message: " + resp.Error.Error());
|
log("error while running sending telegram message: " + resp.Error.Error());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendPhoto(path) {
|
||||||
|
var url = 'https://api.telegram.org/bot' + telegramToken + '/sendPhoto';
|
||||||
|
var cmd = 'curl -s -X POST "' + url + '" -F chat_id=' + telegramChatId + ' -F photo="@' + path + '"';
|
||||||
|
run("!"+cmd);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue