FileZilla Password Decoder

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good Morning everyone,

This week, I switched from FileZilla 2 to FileZilla 3, and much to my dismay the import function doesn't import the local and remote folders properly.

Looking at the FZ2 and FZ3 XML files, it appears that it would be a simple task to write a converter that does. I have a good start on one, (so far it takes all of the parameters in the FZ2 lines and converts them into an array that I will just write back out in XML format) but FZ3 stores the passwords while FZ2 used encoded passwords.

I found a Python script at http://www.petersblog.org/node/1152 that is supposed to decode the passwords to plain text -

def DecodePassword( strPass):
    """Decode a filezilla password"""
    strKey = "FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    nPassLen = len(strPass) / 3
    nOffset = nPassLen % len(strKey)

    strDecodedPass = ""

    for i in range(nPassLen):
        c = int(strPass[i * 3:(i * 3) + 3])
        c2 = ord(strKey[(i + nOffset) % len(strKey)])
        c3 = chr((c ^ c2))

        strDecodedPass += c3

    return strDecodedPass

...and tried to convert it to PHP, but since I don't know Python and there is no documentation in the script to say what it's doing, my function doesn't spit out all of the right characters... (it does some though?? maybe coincidence)

  function DecodePassword($strPass) {
    $strKey = "FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    $nPassLen = strlen($strPass) / 3;
    $nOffset = ($nPassLen % strlen($strKey));

    $strDecodedPass = "";
	
    $passPieces = str_split($strPass,3);
	
    foreach($passPieces as $passPiece) {
	$c = intval($passPiece);
        $c2 = ord($strKey[($i + $nOffset) % strlen($strKey)]);
        $c3 = chr(($c ^ $c2));

       $strDecodedPass .= $c3;
    }

    return $strDecodedPass;
}

I know I simplified quite a bit, but I might have done it wrong...I tried to convert line-for line, but I'm not sure what the stuff on Lines 10 to 13 do. (Lack of Perl knowledge)

There are perl and Javascript functions to do the decoding at http://filezilla.sourceforge.net/forum/viewtopic.php?t=170

I'm not looking for a major undertaking, just something to do the conversion so I don't have to rebuild definitions for 200 and something websites.... If I can get it working properly, I'll probably put a version on my server so people can convert their files as well, as I can see this being a major PITA.

Thanks!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux