How can I get a list of all domains in logins in 1Password?

XIII
XIII
Community Member
edited October 2021 in Lounge

To create a Fastmail whitelist I want to export a list of all domains in logins in 1Password (I will make a vCard using that list and import that card into Fastmail).

How can I get a list of all domains in logins in 1Password?

(export in 1Password 8 seems to be binary, not plain text)

Comments

  • MerryBit
    MerryBit
    Community Member

    The 1P8 export is a zip file. Try opening that up to see what's inside. Maybe you'll find what you're looking for inside.

  • XIII
    XIII
    Community Member

    Oh, yes, I read about that, but completely forgot it... Thanks!

    This might be a good start after unzipping?

    grep url export.data | cut -d\" -f4 | sort -u

    (I'll remove/replace https://www., www., etc., in an editor I think)

  • MrC
    MrC
    Volunteer Moderator
    edited October 2021

    @XIII

    If you have the jq utility, you can use it to extract the elements you need. Below is an example that grabs URLs from the secureContents section of items. I'm employing my pp_1pif script to convert the 1PIF into proper JSON (all it does is remove the 1Password entry markers, replaces each with a comma, and wraps the items in an array).

    $ pp_1pif export.1pif | jq -r 'map(select(.secureContents.URLs)) | .[] | .secureContents.URLs | .[] | .url' | sort -u
    http://anything.example.com
    https://www2.example.com
    www.sample.com
    www1.example.com
    
    $ cat ~/bin/pp_1pif
    #!/usr/bin/perl
    
    binmode STDOUT, ":utf8";
    binmode STDERR, ":utf8";
    
    my @lines;
    while (<>) {
        chomp;
        next if $_ eq '***5642bee8-a5ff-11dc-8314-0800200c9a66***';
        push @lines, $_;
    }
    
    if (@lines) {
        open(my $f, "|-", "json_pp");
        print $f "[", join(',', @lines), "]";
    }
    
  • XIII
    XIII
    Community Member

    Oh, yes, jq. And I forgot about the 1Password CLI too...

    Not my best day ;)

  • XIII
    XIII
    Community Member

    My approach seems wrong anyway: Fastmail will only block/whitelist domain.com, but not email.domain.com, customerservice.domain.com, etc. (the domain actually used by a company for email - which is apparently quite often not their main domain).

    Looks like I'm better off trying to write a script that fetches actual domains from the "From: " field in each mail on the Fastmail IMAP server.

    (no idea yet whether I'm capable...)

  • MrC
    MrC
    Volunteer Moderator

    Tangentially, and perhaps off-topic, whitelisting is generally not necessary for legitimate email senders, and is usually discouraged as a means of spam control. Perhaps you've set very restrictive filtering and now must use it.

    It's better to be less restrictive, and instead, properly train your Fastmail anti-spam filters. Once trained for your mail, you'll get excellent results. Ask if you're not sure how to do this.

  • XIII
    XIII
    Community Member

    It’s not really spam control, but managing blocking of remote images.

    I have configured Fastmail to show images from known senders only.

    The whitelist (a contact with many wildcard email addresses) should make that “work”.

  • XIII
    XIII
    Community Member

    Looks like I'm better off trying to write a script that fetches actual domains from the "From: " field in each mail on the Fastmail IMAP server.

    A small Node.js script using node-imap was all it took :)

This discussion has been closed.