😎 FileZilla Recovery Tool

Posts 1–5 of 5 Β· Page 1 of 1
😎 FileZilla Recovery Tool
This is the first time I post something useful here Roflmao I really wanted to post a Chrome recovery tool, but I wasn't finished with the SQL class, so maybe next time. Victoire
I know FileZilla recovery tools have been posted on this forum, but most are old and don't work anymore for some reason so here is one that works and this one is for the new and old version of FileZilla (base64 encoded and not).
I made this in VB.net with framework 2.0.
everyone with knowledge in VB.net and Xml could make this, but this is for the lazy and new people to VB.net.


Code:
Imports System
Imports System****
Imports System.Xml
Imports System.Text

    Friend Function FileZillaRecovery() As String
      Dim FileZilla As New StringBuilder
      Try
      If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)​ & "\FileZilla\recentservers.xml") Then
      Dim FileZillaXmlDocument As New XmlDocument
      FileZillaXmlDocument.Load(Environment.GetFolderPath(Environment.SpecialFold​er.ApplicationData) & "\FileZilla\recentservers.xml")
      Dim FileZillaNodeList As XmlNodeList = FileZillaXmlDocument.SelectNodes("//Server")

      FileZilla.AppendLine("FileZilla:")
      For Each FileZillaXmlElement As XmlElement In FileZillaNodeList
      FileZilla.AppendLine(Environment.NewLine & "Host: " & FileZillaXmlElement.Item("Host").InnerText)
      FileZilla.AppendLine("Username: " & FileZillaXmlElement.Item("User").InnerText)

      Dim Password As String
      If FileZillaXmlElement.Item("Pass").Attributes("encoding").InnerText = "base64" Then
      Password = Encoding.UTF8.GetString(Convert.FromBase64String(FileZillaXmlElement.Item("Pass").InnerText)) 'New version (base64 encoded)
      Else
      Password = FileZillaXmlElement.Item("Pass").InnerText 'Old version (not base64 encoded)
      End If

      FileZilla.AppendLine("Password: " & Password)
      FileZilla.AppendLine("Port: " & FileZillaXmlElement.Item("Port").InnerText)
      Next
      Else Return String.Empty
      End If
      Catch : End Try
      Return FileZilla.ToString
    End Function

How to use?
Code:
TextBox1.Text = FileZillaRecovery()

Leave a comment if you liked it or if you have anything to say about my code.
* A namespace
Code:
Imports System
isn't used.
* You started to respect the CamelCase, so we must use it for the whole code.
* Describe what does the method do using <summary> tags.
* Dim FileZilla As New StringBuilder has a bad name. Replace it with an adequate name (e.g: RecentServerList).
* Same thing with Password (an adequate name would be HostPassword).
* The Try/Catch isn't useful in this case. Catch is used to show the exception to the user, don't ignore it - fair example:

Code:
Try
' Code
Catch Ex As Exception
MessageBox.Show(Ex.Message) ' Show the error
End Try
Your code is like:
Code:
Try
' Code
Catch {_ As Exception} ' Each character inside the braces is implied - The _ (underscore) means that you won't use the exception index (variable) - Also, the exception is generic as I've already shown
' Do nothing
End Try
* Avoid generic exceptions, always specify the exception, it swallows any error - so it's hard to debug.
*
Code:
Else : Return String.Empty
don't do this. It increases the reading difficulty level.
*
Code:
Return String.Empty
returns an empty string in the case that the file {ApplicationData folder}\FileZilla\recentservers.xml doesn't exist.
You should warn the user that it doesn't exist instead of returning an empty string.
*
Code:
Return FileZilla.ToString
is in the wrong place. It should be inside the "carry handling" to check the path (at the end of If File.Exists(XmlFilePath) Then)

Finally, the clean code would be:
Code:
  ''' <summary>
    ''' This function does a recovery for FileZilla
    ''' </summary>
    ''' <returns> Returns recovery status/recent server settings </returns>
    ''' <remarks></remarks>
    Function FileZillaRecovery() As String
        Dim XmlFilePath As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\FileZilla\recentservers.xml"
        Dim RecentServerList As New StringBuilder
        Try
            If File.Exists(XmlFilePath) Then
                Dim FileZillaXmlDocument As New XmlDocument
                FileZillaXmlDocument.Load(XmlFilePath)
                Dim FileZillaNodeList As XmlNodeList = FileZillaXmlDocument.SelectNodes("//Server")

                RecentServerList.AppendLine("FileZilla:")
                For Each FileZillaXmlElement As XmlElement In FileZillaNodeList
                    RecentServerList.AppendLine(Environment.NewLine & "Host: " & FileZillaXmlElement.Item("Host").InnerText)
                    RecentServerList.AppendLine("Username: " & FileZillaXmlElement.Item("User").InnerText)

                    Dim HostPassword As String
                    If FileZillaXmlElement.Item("Pass").Attributes("encoding").InnerText = "base64" Then
                        HostPassword = Encoding.UTF8.GetString(Convert.FromBase64String(FileZillaXmlElement.Item("Pass").InnerText)) ' New Version (Base64 encoded)
                    Else
                        HostPassword = FileZillaXmlElement.Item("Pass").InnerText ' Old Version (Not Base64 encoded)
                    End If

                    RecentServerList.AppendLine("Password: " & HostPassword)
                    RecentServerList.AppendLine("Port: " & FileZillaXmlElement.Item("Port").InnerText)
                Next

                Return RecentServerList.ToString
            Else
                Return XmlFilePath & " was not found"
            End If
        Catch Ex As Exception ' You must specify the exception
            Return Ex.Message
        End Try
    End Function
Fair usage:
Code:
MessageBox.Show(FileZillaRecovery()) ' Shows what that function returns
All i got to say is, you should atleast credit the person whom wrote this. Not doubting you but i googled the code and it was posted on another "hacking" forum under a different username.
Give credit to the person whom you got the code from.
Like the user above me stated, the code can be easily found when Googled.
I hate when people take credit for other peoples work. it gets under my skin..
Posts 1–5 of 5 Β· Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us