Created
November 28, 2019 02:58
-
-
Save dstuecken/eab85786bc00a92f4bd7aec7170faa69 to your computer and use it in GitHub Desktop.
Small PHP script to convert Avast Password Manager export into a CSV file that is readable by e.g. LastPass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author dennis stücken | |
* | |
* Usage: | |
* Put the export into same directory as the script and execute the following in your terminal (replace /path/to/script with the directory): | |
* cd /path/to/script && php avast-password-manager-json-to-lastpass-csv.php | |
*/ | |
$json = json_decode(file_get_contents("passwords.json"), true); | |
$csv = ""; | |
if (isset($json["logins"])) { | |
foreach ($json["logins"] as $login) { | |
$line = []; | |
$line[] = '"' . (isset($login["custName"]) ? $login["custName"] : "") . '"'; | |
$line[] = '"' . $login["url"] . '"'; | |
$line[] = '"' . $login["loginName"] . '"'; | |
$line[] = '"' . $login["pwd"] . '"'; | |
$csv .= implode(",", $line) . "\n"; | |
} | |
} | |
file_put_contents("passwords.csv", $csv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment