// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: [url]http://www.kpdus.com/jad.html[/url]
// Decompiler options: packimports(3)
// Source File Name: MyAddress.java
import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import netscape.javascript.JSObject;
public class MyAddress extends Applet
implements MouseListener, MouseMotionListener
{
private String MyIP(boolean flag)
{
String s1 = "unknown";
String s2 = getDocumentBase().getHost();
int i = 80;
if(getDocumentBase().getPort() != -1)
i = getDocumentBase().getPort();
try
{
String s = (new Socket(s2, i)).getLocalAddress().getHostAddress();
if(!s.equals("255.255.255.255"))
s1 = s;
}
catch(SecurityException _ex)
{
s1 = "FORBIDDEN";
}
catch(Exception _ex)
{
s1 = "ERROR";
}
if(flag)
try
{
s1 = (new Socket(s2, i)).getLocalAddress().getHostName();
}
catch(Exception _ex)
{
Stat = "Cannot Lookup this IP";
}
return s1;
}
public void init()
{
if(getParameter("Status") != null)
Status = getParameter("Status");
if(getParameter("LOOKUP") != null)
Lookup = getParameter("LOOKUP").toUpperCase().equals("YES");
if(getParameter("TEXT") != null)
Text = getParameter("TEXT");
if(getParameter("BGCOLOR") != null && getParameter("BGCOLOR").toUpperCase().equals("BLACK"))
{
BgColor = Color.black;
FgColor = Color.white;
}
Ip = MyIP(false);
IpL = MyIP(Lookup);
if(getParameter("URL") != null)
{
Url = getParameter("URL");
Url = Url + IpL;
try
{
URL url = new URL(getDocumentBase(), Url);
Status = " " + url;
}
catch(Exception _ex)
{
Status = "BAD URL " + Url;
}
if(getParameter("TARGET") != null)
Target = getParameter("TARGET");
if(getParameter("ACTION") != null && getParameter("ACTION").toUpperCase().equals("AUTO"))
Action = "AUTO";
if(getParameter("ACTION") != null && getParameter("ACTION").equals(Ip))
Action = "AUTO";
if(getParameter("NOACTION") != null && getParameter("NOACTION").equals(Ip))
Action = "CLICK";
}
addMouseListener(this);
addMouseMotionListener(this);
}
public String ip()
{
return Ip;
}
public void start()
{
if(Action == "AUTO")
{
if(Target.toUpperCase().equals("_STEALTH"))
try
{
URL url = new URL(getDocumentBase(), Url);
url.openConnection().getContent();
Stat = "Has been Notified";
}
catch(Exception _ex)
{
Stat = "ERROR Notifying URL";
}
else
try
{
URL url1 = new URL(getDocumentBase(), Url);
getAppletContext().showDocument(url1, Target);
Stat = "Is being Opened";
}
catch(Exception _ex)
{
Stat = "ERROR Opening URL";
}
showStatus(Status + " " + Stat);
}
if(getParameter("CALL") != null)
Call = getParameter("CALL");
try
{
JSObject jsobject = JSObject.getWindow(this);
String as[] = {
IpL
};
jsobject.call(Call, as);
return;
}
catch(Exception _ex) { }
if(getParameter("CALL") != null)
Stat = "ERROR Calling " + Call;
}
public void paint(Graphics g)
{
g.setColor(BgColor);
g.fillRect(0, 0, 1000, 100);
g.setColor(FgColor);
g.drawString(Text + " " + Ip, 2, 12);
}
public void mouseEntered(MouseEvent mouseevent)
{
showStatus(Status + " " + Stat);
}
public void mouseExited(MouseEvent mouseevent)
{
showStatus(" ");
}
public void mouseMoved(MouseEvent mouseevent)
{
showStatus(Status + " " + Stat);
}
public void mouseDragged(MouseEvent mouseevent)
{
}
public void mousePressed(MouseEvent mouseevent)
{
showStatus(Status0);
}
public void mouseReleased(MouseEvent mouseevent)
{
showStatus(" ");
}
public void mouseClicked(MouseEvent mouseevent)
{
if(Url != "")
{
try
{
URL url = new URL(getDocumentBase(), Url);
getAppletContext().showDocument(url, Target);
showStatus("Going to " + url);
return;
}
catch(Exception _ex)
{
Stat = "ERROR Opening URL";
}
return;
} else
{
return;
}
}
public MyAddress()
{
Text = "";
BgColor = Color.white;
FgColor = Color.black;
Lookup = false;
Url = "";
Action = "CLICK";
Target = "";
Ip = "unknown";
IpL = "unknown";
Status0 = "MyAddress Applet 1.3 is Freeware from [url]www.reglos.de[/url] \251Lars Kindermann";
Call = "MyAddress";
Status = Status0;
Stat = "";
}
String Text;
Color BgColor;
Color FgColor;
boolean Lookup;
String Url;
String Action;
String Target;
String Ip;
String IpL;
String Status0;
String Call;
String Status;
String Stat;
}