FileZilla decrypt

Every now and then I get someone asking me for an ftp password. Mine have always been stored in FileZilla. I don’t know them by heart. There is no problem with this except that FileZilla encrypts them. Thank God decrypting FileZilla 2 passwords is easy. Here is some as2 code to accomplish it:

function decrypt(numeric:String):String {
  var decrypted:String = "";
  var encrypted:String = "";
  var secret:String = "FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  if (numeric.length % 3 == 0) {
    for (var i:Number = 0; i < numeric.length; i += 3) {
      var charCode:Number = parseInt(numeric.substr(i, 3), 10);
      encrypted += String.fromCharCode(charCode);
    }
    for (var i:Number = 0; i < encrypted.length; i++) {
      var secretCharIndex:Number = (encrypted.length + i) % secret.length;
      var numA:Number = encrypted.charCodeAt(i);
      var numB:Number = secret.charCodeAt(secretCharIndex);
      decrypted += String.fromCharCode(numA ^ numB);
    }
  } else {
    decrypted = "ERROR: Length must be multiple of 3.";
  }
  return decrypted;
}

function encrypt(decrypted:String):String {
  var numeric:String = "";
  var encrypted:String = "";
  var secret:String = "FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for (var i:Number = 0; i < decrypted.length; i++) {
    var secretCharIndex:Number = (decrypted.length + i) % secret.length;
    var numA:Number = decrypted.charCodeAt(i);
    var numB:Number = secret.charCodeAt(secretCharIndex);
    var charCode:Number = numA ^ numB;
    encrypted += String.fromCharCode(charCode);
    var paddedcharCode:String = charCode.toString(10);
    while (paddedcharCode.length < 3) {
      paddedcharCode = "0" + paddedcharCode;
    }
    numeric += paddedcharCode;
  }
  return numeric;
}

And a working example:

3 Responses to “FileZilla decrypt”

  1. t4ke.com says:

    Hi
    I just translated it in Javascript.
    So it’s now available online :
    http://static.t4ke.com/web/filezilla-password-recovery/

  2. ShavenYak says:

    Dude, this just saved me quite a bit of embarassment. Thanks!

  3. Pete says:

    This code sure saved me a lot of trouble when attempting to recover a password from a backed-up Filezilla xml file that is more than two years old… Thanks so much!