Created
January 29, 2017 14:47
-
-
Save mauricesvay/916a6f60ced66bd55ffe666a99bc9e0f to your computer and use it in GitHub Desktop.
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 | |
/* | |
How to use: | |
- In Dashlane, export data as CSV | |
- Copy this file in the same folder as the exported csv | |
- Run in a terminal: php dashlane-to-1password.php | |
- This should generate 2 files: Dashlane_passwords.csv and Dashlane_others.csv | |
- In 1Password, import Dashlane_passwords.csv | |
- Do whatever you want with Dashlane_others.csv | |
*/ | |
$row = 1; | |
$filename = "Dashlane Export.csv"; | |
$out = array(); | |
$file_out = fopen("Dashlane_passwords.csv", 'w'); | |
$others = array(); | |
$file_others = fopen("Dashlane_others.csv", 'w'); | |
if (($handle = fopen($filename, "r")) !== FALSE) { | |
while (($data = fgetcsv($handle, 1000, ",", '"')) !== FALSE) { | |
if (count($data) === 5) { | |
$out[] = array( | |
$data[0], | |
$data[1], | |
$data[2], | |
$data[3], | |
$data[4], | |
); | |
} else { | |
$others[] = $data; | |
} | |
} | |
fclose($handle); | |
foreach ($out as $fields) { | |
fputcsv($file_out, $fields); | |
} | |
foreach ($others as $fields) { | |
fputcsv($file_others, $fields); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment