Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Export passwords from Firefox into Keepass
#!/usr/bin/env perl
use 5.20.0;
use warnings;
use autodie;
use experimental 'postderef';
use File::KeePass;
use Text::CSV;
my ($file, $password) = @ARGV;
my $csv = Text::CSV->new;
my $k = File::KeePass->new;
$k->load_db($file, $password);
open my $fh, '<', "$HOME/password-export-2015-05-24";
# see
my $group = $k->find_group({ 'title =~' => qr/firefox/i });
title => $_->{hostname},
username => $_->{username},
password => $_->{password},
group => $group->{id},
}) for $csv->getline_hr_all($fh)->@*;
$k->save_db($file, $password)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment