Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dstuecken/eab85786bc00a92f4bd7aec7170faa69 to your computer and use it in GitHub Desktop.
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
<?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