对äºå å¯çç½ç«è¿æ²¡å»ç 究ï¼ä¸ç¥éè½ä¸è½æåï¼ç°å¨åªæ¯å¯¹ä¸äºæ²¡æå å¯çç½ç«è¿è¡ç½é¡µæ°æ®æåãååå¼å§åçæ¶å以为å¾å¤ç½ç«é½è½æåï¼ä½æ¯åç°å¾å¤é½å å¯äºï¼æ¬æ¥ä»¥ä¸ºä¸äºå°åå¯ä»¥éè¿ç½é¡µæ°æ®æ£æµå·¥å
·æµåºä»çæ°æ®ååï¼ä½æ¯åªè½çæµå°ä¸äºéè¿jsæ¾ç¤ºçæ°æ®ï¼ä¾ç¶ä¸è½æåå°å å¯çç½ç«ãå¨ï¼è¿ä¸ªé®é¢ä»¥åå说å§ã
[java]
import java.net.* ;
import java.io.* ;
import java.util.regex.* ;
public class Capture{
public static void main(String args[])throws Exception{
System.out.println("*************************ææºå·æ¥è¯¢************************") ;
System.out.println("æçä½ç½®æ¯ï¼" + new GrabMobile().grabMobileLocation("15023141745")) ;
System.out.println("ææºå¡ç±»åæ¯ï¼" + new GrabMobile().grabMobileType("15023141745")) ;
System.out.println("æçé®ç¼æ¯ï¼" + new GrabMobile().grabMobilePost("15023141745")) ;
System.out.println("*************************身份è¯æ¥è¯¢************************") ;
System.out.println("æçæ§å«æ¯ï¼" + new GrabIdentity().grabIdentitySex("362203199208243575")) ;
System.out.println("æççæ¥æ¯ï¼" + new GrabIdentity().grabIdentityBirth("362203199208243575")) ;
System.out.println("æç家乡æ¯ï¼" + new GrabIdentity().grabIdentityHome("362203199208243575")) ;
}
}
class GrabMobile{
public String grabMobileLocation(String m)throws Exception{
String strUrl = "
http://www.ip138.com:8080/search.asp?action=mobile&mobile=" + m;
URL url = new URL(strUrl) ;
HttpURLConnection httpUrlCon = (HttpURLConnection)url.openConnection() ;
InputStreamReader inRead = new InputStreamReader(httpUrlCon.getInputStream(),"GBK") ;
BufferedReader bufRead = new BufferedReader(inRead) ;
StringBuffer strBuf = new StringBuffer() ;
String line = "" ;
while ((line = bufRead.readLine()) != null) {
strBuf.append(line);
}
String strStart = "å¡å·å½å±å°" ;
String strEnd = "å¡ ç±» å";
String strAll = strBuf.toString() ;
int start = strAll.indexOf(strStart) ;
int end = strAll.indexOf(strEnd) ;
String result = strAll.substring(start+42,end-33) ;
result = drawChMob(result) ;
return result ;
}
public String grabMobileType(String m)throws Exception{
String strUrl = "
http://www.ip138.com:8080/search.asp?action=mobile&mobile=" + m;
URL url = new URL(strUrl) ;
HttpURLConnection httpUrlCon = (HttpURLConnection)url.openConnection() ;
InputStreamReader inRead = new InputStreamReader(httpUrlCon.getInputStream(),"GBK") ;
BufferedReader bufRead = new BufferedReader(inRead) ;
StringBuffer strBuf = new StringBuffer() ;
String line = "" ;
while ((line = bufRead.readLine()) != null) {
strBuf.append(line);
}
String strStart = "å¡ ç±» å" ;
String strEnd = "<TD align=\"center\">åº å·</TD>";
String strAll = strBuf.toString() ;
int start = strAll.indexOf(strStart) ;
int end = strAll.indexOf(strEnd) ;
String result = strAll.substring(start+12,end) ;
result = drawChMob(result) ;
result = result.substring(1) ;
return result ;
}
public String grabMobilePost(String m)throws Exception{
String strUrl = "
http://www.ip138.com:8080/search.asp?action=mobile&mobile=" + m;
URL url = new URL(strUrl) ;
HttpURLConnection httpUrlCon = (HttpURLConnection)url.openConnection() ;
InputStreamReader inRead = new InputStreamReader(httpUrlCon.getInputStream(),"GBK") ;
BufferedReader bufRead = new BufferedReader(inRead) ;
StringBuffer strBuf = new StringBuffer() ;
String line = "" ;
while ((line = bufRead.readLine()) != null) {
strBuf.append(line);
}
String strStart = "é® ç¼" ;
String strEnd = "æ´è¯¦ç»ç..";
String strAll = strBuf.toString() ;
int start = strAll.indexOf(strStart) ;
int end = strAll.indexOf(strEnd) ;
String result = strAll.substring(start+40,end-55) ;
return result ;
}
public String drawChMob(String str){
StringBuffer strBuf = new StringBuffer() ;
String regex="([\u4e00-\u9fa5]+)";
Matcher matcher = Pattern.compile(regex).matcher(str);
while(matcher.find()){
strBuf.append(matcher.group(0)).toString() ;
}
return strBuf.toString() ;
}
}
class GrabIdentity{
public String grabIdentitySex(String userid)throws Exception{
String strUrl = "
http://qq.ip138.com/idsearch/index.asp?action=idcard&userid=" + userid + "&B1=%B2%E9+%D1%AF";
URL url = new URL(strUrl) ;
HttpURLConnection httpUrlCon = (HttpURLConnection)url.openConnection() ;
InputStreamReader inRead = new InputStreamReader(httpUrlCon.getInputStream(),"GBK") ;
BufferedReader bufRead = new BufferedReader(inRead) ;
StringBuffer strBuf = new StringBuffer() ;
String line = "" ;
while ((line = bufRead.readLine()) != null) {
strBuf.append(line);
}
String strStart = " å«" ;
String strEnd = "åºçæ¥æ";
String strAll = strBuf.toString() ;
int start = strAll.indexOf(strStart) ;
int end = strAll.indexOf(strEnd) ;
String result = strAll.substring(start+7,end) ;
result = drawCh(result) ;
return result ;
}
public String grabIdentityBirth(String userid)throws Exception{
String strUrl = "
http://qq.ip138.com/idsearch/index.asp?action=idcard&userid=" + userid + "&B1=%B2%E9+%D1%AF";
URL url = new URL(strUrl) ;
HttpURLConnection httpUrlCon = (HttpURLConnection)url.openConnection() ;
InputStreamReader inRead = new InputStreamReader(httpUrlCon.getInputStream(),"GBK") ;
BufferedReader bufRead = new BufferedReader(inRead) ;
StringBuffer strBuf = new StringBuffer() ;
String line = "" ;
while ((line = bufRead.readLine()) != null) {
strBuf.append(line);
}
String strStart = "åºçæ¥æï¼</td><td class=\"tdc2\">" ;
String strEnd = "</td><tr><tr><td class=";
String strAll = strBuf.toString() ;
int start = strAll.indexOf(strStart) ;
int end = strAll.indexOf(strEnd) ;
String result = strAll.substring(start+27,end) ;
return result ;
}
public String grabIdentityHome(String userid)throws Exception{
String strUrl = "
http://qq.ip138.com/idsearch/index.asp?action=idcard&userid=" + userid + "&B1=%B2%E9+%D1%AF";
URL url = new URL(strUrl) ;
HttpURLConnection httpUrlCon = (HttpURLConnection)url.openConnection() ;
InputStreamReader inRead = new InputStreamReader(httpUrlCon.getInputStream(),"GBK") ;
BufferedReader bufRead = new BufferedReader(inRead) ;
StringBuffer strBuf = new StringBuffer() ;
String line = "" ;
while ((line = bufRead.readLine()) != null) {
strBuf.append(line);
}
String strStart = "è¯ å°ï¼</td><td class=\"tdc2\">" ;
String strEnd = "<br/></td></tr><tr><td class=\"tdc3\" valign=\"top\" align=\"right\">é¨åæ" ;
String strAll = strBuf.toString() ;
int start = strAll.indexOf(strStart) ;
int end = strAll.indexOf(strEnd) ;
String result = strAll.substring(start+31,end) ;
return result ;
}
public String drawCh(String str){
StringBuffer strBuf = new StringBuffer() ;
String regex="([\u4e00-\u9fa5]+)";
Matcher matcher = Pattern.compile(regex).matcher(str);
if(matcher.find()){
str = strBuf.append(matcher.group(0)).toString() ;
}
return str ;
}
}
å¾
ä¼ä¼ ä¸æ¹è£
æçandroidå°ç¨åºï¼å¯ä»¥ææºå·æ¥è¯¢å身份è¯æ¥è¯¢ã