Java 实现登录SVN(可3690端口爆破)
很多扫描SVN工具都是扫描的.svn文件,不能通过端口去扫描SVN。Java有SVN的扩展库,已实现了SVN客户端的所有功能。
SVN有个未授权访问问题,默认不开启。一般人都会设置必须登录才能访问资源,但不排除少部分偷懒的人。其次就是SVN弱口令了。
svnserve.conf:
authz-db = authz去年写了个简单的SVN客户端放着也没用。下面给的一个认证的demo程序,需要jar包自己去找。引入jar就可以登录SVN了,稍微改改或许可以做个暴力破解了。(String user,String pass参数是帐号密码,如果考虑authz-db = authz可以在调用createDefaultAuthenticationManager的时候不传值)
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 TestLogin { @SuppressWarnings("deprecation") public 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; } public static void main(String[] args) { TestLogin l = new TestLogin(); System.out.println(l.login("svn://xxx.net", "xxxxxx", "xxxxx")); } }