How to retrieve a saved ftp password from phpStorm?

tao picture tao · Sep 17, 2015 · Viewed 12.2k times · Source

I know that technically, this question should be asked on phpStorm's forums, but being a popular IDE (I bet an eventual solution would also work for other popular IDEs from JetBrains), I'm thinking:

  • someone on SO might know and share the answer (faster than I'd get it from vendor)
  • the question answer might be useful and valuable to other coders (for that matter, even if I shall need to go on the vendor's forum I will get back with the answer here, when I find it)

If there is any need of context: I accidentally switched the connection type of a saved connection from ftp to local folder and when I switched back, the saved credentials were gone.

The question: Can I retrieve the saved password...

  • Angle 1: ...from this computer?
  • Angle 2: ...from another computer that has the same credentials saved, which I could access via TeamViewer, but has the password ●●●●●●(hidden)?

Answer

Louis picture Louis · Feb 2, 2016

Edit: This method can only be used in the version of 2016.1 or before. For newer version (probably 2016.2), they changed the encode method. There is no clue for me to decode it.

  1. Open C:\Users\.WebIde100\config\options\webServers.xml
  2. Find your FTP and get the encrypted password from the password attribute.
  3. Decrypt the password. I have written a PHP script to decrypt the string:

      $pwd = "Your encrypted password here.";
      $decrypted = '';
    
      while (strlen($pwd) > 0) {
        $decrypted .= chr(hexdec(substr($pwd, 0, 4)) ^ hexdec('dfaa'));
        $pwd = substr($pwd, 4, strlen($pwd) - 1);
      }
      echo $decrypted;
    

    If you trust my tools, you can use https://louislam.net/phpstorm-decrypt-password