Git Product home page Git Product logo

icloud-photos-backup's Introduction

⚠️ Archived, use icloud-photos-downloader ⚠️

iCloud Photos backup

Security Scanning Docker Image CI Duplicated Lines (%) Reliability Rating Quality Gate Status Technical Debt Lines of Code Code Smells Maintainability Rating Security Rating Bugs Vulnerabilities Known Vulnerabilities

a tool to backup your photos from iCloud

Like many others I keep all my family photos in Photos and take comfort that Apple handle the storage + backup.

However something got me worried, what if I got infected with some ransomware that encrypted or destroyed my photos, from an attack point of view, that'd probably be a pretty lucrative attack.

Or what if the pictures I have of my kids were misclassified by a well intentioned Apple and I lost access to the originals like this guy did with his google life.

Usage

mkdir -p session keyring photos
### Get or renew a login session with 2FA

docker run \
  --rm -ti \
  -v ${PWD}/session:/tmp/pyicloud \
  -v ${PWD}/keyring:/home/app/.local/share/python_keyring \
  -e USERNAME="[email protected]" \
  ghcr.io/chrisns/icloud-photos-backup

# If it works this should start downloading photos, but they're only going to a docker volume, not to your host machine to ^C to exit

docker run \
  --name photobackup \
  -d \
  -v ${PWD}/backup:/app/photos \
  -v ${PWD}/keyring:/home/app/.local/share/python_keyring \
  -v ${PWD}/session:/tmp/pyicloud \
  -e USERNAME="[email protected]" \
  ghcr.io/chrisns/icloud-photos-backup

# you can follow the logs to see progress, initial backup could take a LONG time (days-weeks)
docker logs -f photobackup

# you can then maybe add a cron job to do:

docker start -a photobackup

But I don't trust you @chrisns with my credentials

No, why on earth would you, you'd be mad to blindly run the above docker command, so I'd really urge you to pull this repo, check all the dependencies and use very much at your own discretion.

My target intention is to personally run this on an isolated Raspberry pi with no remote access, and just enough network to talk to iCloud and also syslog so I can observe errors and manually fix.

icloud-photos-backup's People

Contributors

chrisns avatar dependabot-preview[bot] avatar dependabot[bot] avatar itavero avatar madsleejensen avatar renovate-bot avatar renovate[bot] avatar the-repository-manager[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

icloud-photos-backup's Issues

PyiCloudNoStoredPasswordAvailableException occurs when trying to get a login session

Tried following the commands from the README.md, but when issuing the second command (Get or renew a login session with 2FA), I get the following error after entering my password:

docker run \
  -u $USERID \
  --rm -ti \
  -v ${PWD}/session:/tmp/pyicloud \
  -v ${PWD}/keyring:/home/app/.local/share/python_keyring \
  -e USERNAME="[email protected]" \
  ghcr.io/chrisns/icloud-photos-backup
iCloud Password: 
Traceback (most recent call last):
  File "/app/backup.py", line 137, in authenticate
    api = PyiCloudService(username)
  File "/usr/local/lib/python3.10/site-packages/pyicloud/base.py", line 217, in __init__
    password = get_password_from_keyring(apple_id)
  File "/usr/local/lib/python3.10/site-packages/pyicloud/utils.py", line 41, in get_password_from_keyring
    raise PyiCloudNoStoredPasswordAvailableException(
pyicloud.exceptions.PyiCloudNoStoredPasswordAvailableException: No pyicloud password for [email protected] could be found in the system keychain.  Use the `--store-in-keyring` command-line option for storing a password for this username.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/backup.py", line 186, in <module>
    backup()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/app/backup.py", line 56, in backup
    icloud = authenticate(username)
  File "/app/backup.py", line 141, in authenticate
    store_password_in_keyring(username, password)
  File "/usr/local/lib/python3.10/site-packages/pyicloud/utils.py", line 55, in store_password_in_keyring
    return keyring.set_password(
  File "/usr/local/lib/python3.10/site-packages/keyring/core.py", line 60, in set_password
    get_keyring().set_password(service_name, username, password)
  File "/usr/local/lib/python3.10/site-packages/keyrings/alt/file_base.py", line 129, in set_password
    self._write_config_value(service, username, password_base64)
  File "/usr/local/lib/python3.10/site-packages/keyrings/alt/file_base.py", line 137, in _write_config_value
    self._ensure_file_path()
  File "/usr/local/lib/python3.10/site-packages/keyrings/alt/file_base.py", line 163, in _ensure_file_path
    os.makedirs(storage_root)
  File "/usr/local/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/local/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/local/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/.local'

Any clue how to solve this?

Note that I am running macOS 12.6 Monterey and I have run the earlier chown command using sudo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.