论坛首页 Java企业应用论坛

用GAE开发了一个开心网外挂,开源了

浏览 2999 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-09-19  
上开心网,浪费越来越多的时间,最近使用Java版Google App Engine,开发了一个开心网外挂,这样随时随地,登录开心大盗,就可以直接偷菜了,方便、快捷、开源、免费、放心使用。暂时只支持收获菜地,偷菜,打工

源代码放在Google code中,详细介绍:http://bit.ly/1Lle0N

关键代码
	/**
	 * 打工
	 * @param resultBuilder
	 * @param verifyValue
	 */
	private void processJob(String verifyValue){
		StringBuilder resultBuilder = getHttpContent(URL_PREFIX_HOUSE_JOB+verifyValue);
		String result = resultBuilder.toString();
		int jobIdPos = result.lastIndexOf("<option value=\"");
		String sMaxJobId = findText(result, "<option value=\"", "\"", jobIdPos);
		if (sMaxJobId == null) return;
		
		//prepare post 
		// petid=12&verify=11111_111111_121212829_e33f851c27b60165ac0e7b9156ba01e6_kx
        StringBuilder postData = new StringBuilder()
        .append("petid=").append(sMaxJobId)
        .append("&verify=").append(verifyValue)
        ;
        
        StringBuilder doJobResult = postHttpContent(URL_PREFIX_HOUSE_JOB_DO, postData.toString(), URL_PREFIX_HOUSE_JOB+verifyValue);
        if (doJobResult==null) return;
        String sDoJobResult = findText(doJobResult.toString(), "<div class=\"tips1\">", "<br/>", 0);
        logBuilder.append(sDoJobResult).append("\r\n");
	}


收获菜地
	private void harvest(String url){
		StringBuilder resultBuilder = getHttpContent(url);
		if (resultBuilder!=null){
			String sGarden = resultBuilder.toString();
			//收获
			int indexUrl = sGarden.indexOf("garden/havest.php?");
			String havestUrl = null;
			while((havestUrl=findText(sGarden, "garden/havest.php?", "\"", indexUrl))!=null){
				indexUrl = sGarden.indexOf("garden/havest.php?", indexUrl)+1;
				havestUrl = URL_PREFIX_HOUSE_GARDEN_HAVEST+havestUrl;
				havestUrl = havestUrl.replaceAll("&amp;", "&");
				StringBuilder havestBuilder = getHttpContent(havestUrl);
				if (havestBuilder != null){
					String sHavest = havestBuilder.toString();
					String what = findText(sHavest, "你已经收获了", "</div>", 0);
					if (what != null){
						logBuilder.append("收获了"+what).append("\r\n");
					}
					else{
						what = findText(sHavest, "你已经成功偷到", "</div>", 0);
						if (what != null){
							logBuilder.append("偷到"+what).append("\r\n");
						}
					}
						
				}
			}
		}
	}

  • 大小: 4.9 KB
  • 大小: 27.2 KB
  • 大小: 40.7 KB
  • 大小: 9.7 KB
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics