📄 iahttp.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: IAHttp.java
package com.barryliu.ia;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Random;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
public class IAHttp
{
private static IAHttp instance;
private HttpClient client;
private String p_HostIP;
private int p_HostPort;
private String p_UserName;
private String p_UserPassword;
private IAHttp()
{
p_HostIP = "www.xiaoi.com";
p_HostPort = 80;
p_UserName = "ILoveYouI";
p_UserPassword = "123456";
client = new HttpClient();
setHost();
System.out.println("ok");
}
public static synchronized IAHttp getInstance()
{
if(instance == null)
instance = new IAHttp();
return instance;
}
private void setHost()
{
client.getHostConfiguration().setHost(p_HostIP, p_HostPort);
client.getHttpConnectionManager().getParams().setSoTimeout(0x249f0);
client.getHttpConnectionManager().getParams().setConnectionTimeout(15000);
}
private boolean loginHost()
{
boolean flag = true;
try
{
PostMethod postmethod = new PostMethod("/user/indexLogin.do");
NameValuePair namevaluepair = new NameValuePair("nicknameOrPassport", p_UserName);
NameValuePair namevaluepair1 = new NameValuePair("password", p_UserPassword);
NameValuePair namevaluepair2 = new NameValuePair("Image3.x", "28");
NameValuePair namevaluepair3 = new NameValuePair("Image3.y", "10");
postmethod.setRequestBody(new NameValuePair[] {
namevaluepair, namevaluepair1, namevaluepair2, namevaluepair3
});
client.executeMethod(postmethod);
postmethod.releaseConnection();
}
catch(Exception exception)
{
flag = false;
exception.printStackTrace();
}
return flag;
}
public String getLTCon(String s)
{
String s1 = null;
try
{
s = filterStr(s);
PostMethod postmethod = new PostMethod("/engine.isp");
NameValuePair namevaluepair = new NameValuePair("font", "Arial");
NameValuePair namevaluepair1 = new NameValuePair("bold", "0");
NameValuePair namevaluepair2 = new NameValuePair("italic", "0");
NameValuePair namevaluepair3 = new NameValuePair("underline", "0");
NameValuePair namevaluepair4 = new NameValuePair("fontColor", "0");
NameValuePair namevaluepair5 = new NameValuePair("messageText", new String(s.getBytes(), "8859_1"));
NameValuePair namevaluepair6 = new NameValuePair("botid", "popup-bot");
postmethod.setRequestBody(new NameValuePair[] {
namevaluepair, namevaluepair1, namevaluepair2, namevaluepair3, namevaluepair4, namevaluepair5, namevaluepair6
});
client.executeMethod(postmethod);
InputStream inputstream = postmethod.getResponseBodyAsStream();
byte abyte0[] = new byte[8096];
inputstream.read(abyte0);
inputstream.close();
s1 = analyisLTCon((new String(abyte0)).trim());
postmethod.releaseConnection();
}
catch(Exception exception)
{
exception.printStackTrace();
}
return s1;
}
private String analyisLTCon(String s)
{
StringBuffer stringbuffer = new StringBuffer();
String s1 = "";
String s2 = "<textarea id=\"answer\">";
String s3 = "</textarea>";
for(int i = 0; s.indexOf(s2) >= 0; i++)
{
if(i > 1)
stringbuffer.append(",").append(s.substring(s.indexOf(s2) + s2.length(), s.indexOf(s3)));
else
stringbuffer.append(s.substring(s.indexOf(s2) + s2.length(), s.indexOf(s3)));
s = s.substring(s.indexOf(s3) + s3.length());
}
s1 = stringbuffer.toString();
s1 = replace(s1, "★", "");
s1 = replace(s1, " ", "").trim();
s1 = replace(s1, " ", "").trim();
s1 = replace(s1, "小i机器人", "动力小新").trim();
s1 = replace(s1, "小I机器人", "动力小新").trim();
s1 = replace(s1, "小I机器人", "动力小新").trim();
s1 = replace(s1, "小i机器人", "动力小新").trim();
s1 = replace(s1, "http://www.xiaoi.com", "").trim();
s1 = replace(s1, "www.xiaoi.com", "").trim();
s1 = replace(s1, "86-21-52393850", "").trim();
s1 = replace(s1, "xiaoisupport@incesoft.com", "").trim();
s1 = replace(s1, "xiaoimaster@hotmail.com", "").trim();
s1 = replace(s1, "404539607", "").trim();
s1 = replace(s1, "小i", "小新").trim();
s1 = replace(s1, "xiaoi", "小新").trim();
s1 = replace(s1, "小I", "小新").trim();
s1 = replace(s1, "小I", "小新").trim();
s1 = replace(s1, "小i", "小新").trim();
if(s1.indexOf("<IHTML>") >= 0)
s1 = "";
if(s1.indexOf("<ihtml>") >= 0)
s1 = "";
if(s1 == null || s1.equals(""))
s1 = randomMsg();
return s1;
}
private String replace(String s, String s1, String s2)
{
int i = 0;
if(s == null || s1 == null)
return null;
if((i = s.indexOf(s1, i)) >= 0)
{
int j = s1.length();
int k = s2.length();
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append(s.substring(0, i)).append(s2);
i += j;
int l;
for(l = i; (i = s.indexOf(s1, i)) > 0; l = i)
{
stringbuffer.append(s.substring(l, i)).append(s2);
i += j;
}
stringbuffer.append(s.substring(l));
return stringbuffer.toString();
} else
{
return s;
}
}
private String filterStr(String s)
{
String s1 = s;
if(s1 != null)
{
s1 = replace(s1, "xlcs", "");
s1 = replace(s1, "joke", "");
s1 = replace(s1, "cyjl", "");
s1 = replace(s1, "周公", "");
s1 = replace(s1, "情缘测试", "");
s1 = replace(s1, "歌曲", "");
s1 = replace(s1, "词典", "");
s1 = replace(s1, "计算器", "");
s1 = replace(s1, "手机预测", "");
s1 = replace(s1, "手机预测", "");
if(s1.indexOf("黄历") != 0)
{
s1 = replace(s1, ":", "");
s1 = replace(s1, ":", "");
}
s1 = replace(s1, "qwqs", "");
s1 = replace(s1, "help", "");
s1 = replace(s1, "?", "");
}
if(s1 == null || s1.equals(""))
s1 = "你好";
return s1;
}
public static String randomMsg()
{
Random random = new Random();
String s = "你好,你想说什么呢?";
if(random.nextInt(6) == 1)
s = "你好,你想说什么呢?";
else
if(random.nextInt(6) == 2)
s = "我有点搞不懂你在说什么了";
else
if(random.nextInt(6) == 3)
s = "想占卜一下你的手机吗?输入(手机预测:你的手机号),我会告诉你答案哦";
else
if(random.nextInt(6) == 4)
s = "有什么心事就跟我说吧";
else
if(random.nextInt(6) == 5)
s = "我知道你想说什么了";
else
s = "我有点累了,换个话题好吗?";
return s;
}
public static void main(String args[])
{
System.out.println(getInstance().getLTCon("黄历:2006/01/01"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -