Java爆破SVN、FTP、任何数据库、SMTP、SSH、LDAP
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也可以爆破,之前发过了这里就不发了吧。
>更多相关文章
首页推荐
佛山市东联科技有限公司一直秉承“一切以用户价值为依归
- 01-11全球最受赞誉公司揭晓:苹果连续九年第一
- 12-09罗伯特·莫里斯:让黑客真正变黑
- 12-09谁闯入了中国网络?揭秘美国绝密黑客小组TA
- 12-09警示:iOS6 惊现“闪退”BUG
- 12-25优酷推出U镜到底等直播功能 已应用在羽毛球
- 12-25百川智能正式发布全链路领域增强大模型
- 12-25SHEIN4家仓储物流园获“零废工厂”认证
- 12-25西方博主在TikTok上展现中国风貌,“China
- 12-05亚马逊推出新一代基础模型 任意模态生成大模
相关文章
24小时热门资讯
24小时回复排行
热门推荐
最新资讯
操作系统
黑客防御