`

DISCUE盖楼器

    博客分类:
  • java
 
阅读更多

package com.soft.hr.per.service;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

/**
* CrashForm.java
*

*
* Modification History:

* Date             Author           Description

* ------------------------------------------------------------------

* Oct 23, 2013                new    

*/
public class CopyOfCrashForm {

public static void main(String[] args) throws ClientProtocolException, IOException {
HttpClient client = new DefaultHttpClient();
HttpPost httpost = new HttpPost(
"http://172.20.32.66/member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash=Lln4l");
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("username", "--"));
// nvps.add(new BasicNameValuePair("ticket2", "hy2012"));
nvps.add(new BasicNameValuePair("password", "--"));
httpost.setEntity(new UrlEncodedFormEntity(nvps, "GBK"));
HttpResponse response = client.execute(httpost);
// System.out.println(EntityUtils.toString(response.getEntity()) +
// "--");
httpost.abort();
HttpGet httget = new HttpGet("http://172.20.32.66/forum.php?mod=viewthread&tid=1587&page=1#pid9397");
HttpResponse response2 = client.execute(httget);
//System.out.println(EntityUtils.toString(response2.getEntity()) + "--");

Document doc = Jsoup.parse(EntityUtils.toString(response2.getEntity()));
//System.out.println(doc.html());
String formhash = doc.select("input[name=formhash]").val();
long posttime = Long.valueOf(doc.select("input[name=posttime]").val());
System.out.println(formhash+"--"+posttime);

httget.abort();
String message="olala,加油↖(^ω^)↗";
//forum.php?mod=post&action=reply&fid=31&tid=1583&extra=&replysubmit=yes&infloat=yes&handlekey=fastpost
for (int i = 1; i < 100000; i++) {

HttpPost h2 = new HttpPost(
"http://172.20.32.66/forum.php?mod=post&action=reply&fid=31&tid=1587&extra=&replysubmit=yes&infloat=yes&handlekey=fastpost");

List<NameValuePair> invps = new ArrayList<NameValuePair>();

invps.add(new BasicNameValuePair("message", message+i));
invps.add(new BasicNameValuePair("formhash", formhash));
invps.add(new BasicNameValuePair("posttime", posttime+""));
posttime+=6000;
invps.add(new BasicNameValuePair("usesig", "1"));
invps.add(new BasicNameValuePair("subject", "  "));
// invps.add(new BasicNameValuePair("referer",
// "http://172.20.32.66/forum.php?mod=post&action=reply&fid=61&tid=1584"));
// nvps.add(new BasicNameValuePair("ticket2", "hy2012"));

h2.setEntity(new UrlEncodedFormEntity(invps, "GBK"));
HttpResponse iresponse = client.execute(h2);
System.out.println(EntityUtils.toString(iresponse.getEntity()) + "--");
h2.abort();
}
}
}
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics