I am not busy this week, I have nothing to do, and I have nothing to do.
CrackVote. java
Package crack;
Import java. io. OutputStreamWriter;
Import java.net. HttpURLConnection;
Import java.net. URL;
Import java. util. Iterator;
Import java. util. Map;
Import java. util. Map. Entry;
Public class CrackVote implements Runnable {
Private HttpURLConnection conn = null;
String urlAddr;
Map map;
Int num;
Public CrackVote (String urlAddrTest, Map mapTest, int num ){
UrlAddr = urlAddrTest;
Map = mapTest;
Num = num;
}
@ Override
Public void run (){
While (true ){
Boolean isSuccess = false;
StringBuffer params = new StringBuffer ();
Iterator it = map. entrySet (). iterator ();
While (it. hasNext ()){
Entry element = (Entry) it. next ();
Params. append (element. getKey ());
Params. append ("= ");
Params. append (element. getValue ());
Params. append ("&");
}
If (params. length ()> 0 ){
Params. deleteCharAt (params. length ()-1 );
}
Try {
URL url = new URL (urlAddr );
Conn = (HttpURLConnection) url. openConnection ();
Conn. setDoOutput (true );
Conn. setRequestMethod ("POST ");
Conn. setUseCaches (false );
Conn. setRequestProperty ("Content-Type", "application/x-www-form-urlencoded ");
Conn. setRequestProperty ("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.2; zh-CN; rv: 1.9) Gecko/2008052906 Firefox/3.0 ");
Conn. setRequestProperty ("Accept", "text/html, application/xhtml + xml, application/xml; q = 0.9, */*; q = 0.8 ");
Conn. setRequestProperty ("Accept-Language", "zh-cn, zh; q = 0.5 ");
Conn. setRequestProperty ("Referer", "xxx ");
Conn. setRequestProperty ("Content-Length", String. valueOf (params. length ()));
Conn. setDoInput (true );
Conn. connect ();
OutputStreamWriter out = new OutputStreamWriter (conn. getOutputStream (), "UTF-8 ");
Out. write (params. toString ());
Out. flush ();
Out. close ();
Int code = conn. getResponseCode ();
If (code! = 200 ){
System. out. println ("ERROR =" + code );
} Else {
IsSuccess = true;
System. out. println ("Success! ");
}
} Catch (Exception ex ){
Ex. printStackTrace ();
} Finally {
Conn. disconnect ();
}
}
}
}
Crack. java
Package crack;
Import java. util. HashMap;
Import java. util. Map;
Import crack. CrackVote;
Public class Crack {
Public static void main (String args []) {
Map hash = new HashMap ();
Hash. put ("id", "25 ");
Hash. put ("button", "% CD % B6 % D2 % BB % C6 % B1 ");
String addstr = "asp"> http://www.xxx.com/xxx/6/vote_pass.asp ";
For (int I = 0; I <20; I ++ ){
// CrackVote crackvote = new CrackVote (addstr, hash, I );
// New Thread (crackvote). start ();
New Thread (new CrackVote (addstr, hash, I). start ();
}
}
}