ProtonMail / proton-mail-export

https://proton.me/support/proton-mail-export-tool
GNU General Public License v3.0
2 stars 2 forks source link

Remember login info #5

Closed julianfairfax closed 1 month ago

julianfairfax commented 7 months ago

Having to login each time you want to use the tool makes using it more difficult.

FairyNatza commented 5 months ago

I looked at the code, and at least you can pass some parameters to the program. So you could create a shortcut in Windows for this program and add the parameters to the path in the target. It should look like this: "proton-mail-export-cli.exe" --user=username@proton.me --password=****** --export-dir="C:\Export" --totp=123456 --mbox-password=****

You only need "totp" if you have the second factor (time-based one-time password) enabled, and "mbox-password" if you have the second password active in your account.

Hope this helps.

julianfairfax commented 1 month ago

--export-dir didn't work for me and --totp doesn't make sense for my use case, but the username and password work! Thank you @FairyNatza!

net47 commented 1 week ago

Just came across this issue, here's a really dirty script to get it even with TOTP working:

#!/bin/bash

# base credentials
username=your-user
password=your-password

# calculate the TOTP from the secret
totp=$(/usr/bin/oathtool --base32 --totp "your-totp-secret" -d 6)

# if TOTP calculation successful, run the backup
if [ $? -eq 0 ]; then
  ./proton-mail-export-cli --operation backup --dir . --user $username --password $password --totp $totp
else
  echo "TOTP calculation failed!"
  exit 1
fi

You'll need oathtool (https://packages.debian.org/bookworm/oathtool) for calculating the TOTP code.