|
发表于 2003-9-2 11:00:55
|
显示全部楼层
package net.bbiagent.explorer.ui.admin;
import java.applet.Applet;
import java.awt.TextComponent;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;
import java.util.Locale;
import java.util.zip.CRC32;
import net.bbiagent.explorer.BBIagent;
import net.bbiagent.explorer.ui.base.MenuPanel;
// Referenced classes of package net.bbiagent.explorer.ui.admin:
// Register
class php extends Thread
{
public void run()
{
if(agent.regMAC.length() < 12 || !agent.execute("/bin/pfd"))
{
Register.access$000(Register.this, true);
return;
}
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append("ref=" + agent.getRefNo(""));
agent.regMAC = agent.regMAC.substring(0, 12);
stringbuffer.append("&mac=" + agent.regMAC);
stringbuffer.append("&name=" + BBIagent.encode(tfName.getText()));
stringbuffer.append("&email=" + BBIagent.encode(tfEmail.getText()));
stringbuffer.append("&sn=" + BBIagent.encode(tfSerialNo.getText()));
try
{
Thread.sleep(1000L);
}
catch(Exception exception) { }
String s = php + "/reg." + php;
URLConnection urlconnection = postURL(getRootURL() + s, getEncodedVer() + "&" + stringbuffer.toString() + "&" + getEncodedEnv(), "RG");
if(urlconnection != null)
{
byte abyte0[] = new byte[1024];
try
{
InputStream inputstream = urlconnection.getInputStream();
int i = inputstream.read(abyte0);
inputstream.close();
if(i > 0)
{
int j = 0;
String s1 = new String(abyte0, 1, i - 1);
Register _tmp = Register.this;
String s6 = agent.readFile(BBIagent.ROUTER_SETUP);
CRC32 crc32 = new CRC32();
crc32.update(s6.getBytes(), 0, s6.getBytes().length);
String s3 = Long.toHexString(crc32.getValue());
crc32 = new CRC32();
crc32.update(agent.regMAC.getBytes(), 0, 12);
String s4 = Long.toHexString(crc32.getValue());
String s5 = s3 + s4 + "1111111111111111";
crc32 = new CRC32();
crc32.update(s5.getBytes(), 0, 32);
String s2 = Long.toHexString(crc32.getValue());
s1 = s2 + s5;
abyte0[0] = 48;
if(abyte0[0] != 48)
agent.alert(s1 + "(" + new String(abyte0, 0, 1) + ")");
else
if((j = Register.access$100(Register.this, s1)) > 0)
agent.alert(agent.rc("esn") + "(" + j + ")");
} else
{
agent.alert(agent.rc("esn") + "(" + i + ")");
}
}
catch(Exception exception1) { }
}
Register.access$000(Register.this, true);
}
private String getRootURL()
{
String s = agent.get("BP");
String s1;
if(agent.isStandalone)
{
s1 = "http://" + agent.routerIP + ":" + s + "/";
} else
{
s1 = agent.getCodeBase().toString();
s1 = s1.substring(0, s1.length() - 1) + ":" + s + "/";
}
return s1;
}
private URLConnection postURL(String s, String s1, String s2)
{
try
{
URL url = new URL(s);
URLConnection urlconnection = url.openConnection();
urlconnection.setDoInput(true);
urlconnection.setDoOutput(true);
urlconnection.setUseCaches(false);
urlconnection.setAllowUserInteraction(false);
urlconnection.setRequestProperty("Referer", s2);
urlconnection.setRequestProperty("Content-length", Integer.toString(s1.length()));
urlconnection.setRequestProperty("content-type", "application/x-www-form-urlencoded");
PrintWriter printwriter = new PrintWriter(urlconnection.getOutputStream());
printwriter.print(s1);
printwriter.flush();
printwriter.close();
return urlconnection;
}
catch(Exception exception)
{
return null;
}
}
private String getEncodedVer()
{
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append("bversion=" + BBIagent.encode("1.8.1"));
stringbuffer.append("&bbuild=" + BBIagent.encode("001"));
stringbuffer.append("&country=" + BBIagent.encode(agent.locale.getCountry()));
stringbuffer.append("&lang=" + BBIagent.encode(agent.locale.getLanguage()));
stringbuffer.append("&mode=" + agent.runMode);
return stringbuffer.toString();
}
private String getEncodedEnv()
{
Object aobj[][] = {
{
"cversion", "java.class.version"
}, {
"jversion", "java.version"
}, {
"oname", "os.name"
}, {
"oarch", "os.arch"
}, {
"oversion", "os.version"
}
};
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append("tz=" + BBIagent.encode((new Date()).toString()));
for(int i = 0; i < aobj.length; i++)
stringbuffer.append("&" + (String)aobj[i][0] + "=" + BBIagent.encode(System.getProperty((String)aobj[i][1])));
return stringbuffer.toString();
}
String php;
()
{
php = "php";
}
} |
|