GithubHelp home page GithubHelp logo

tiefkuehlpizze / oandbackupx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neoapplications/neo-backup

5.0 5.0 0.0 81.64 MB

backup manager for android

License: GNU Affero General Public License v3.0

HTML 5.87% Kotlin 93.98% Shell 0.15%
android android-root backup hacktoberfest

oandbackupx's People

Contributors

70h avatar akrai avatar andreaugustodev avatar atrate avatar bomzhellino avatar cges30901 avatar comradekingu avatar dl200010 avatar generator avatar hg42 avatar jensstein avatar jll5 avatar machiav3lli avatar madis0 avatar mapi68 avatar nykula avatar omarnamis avatar padanian avatar rex07 avatar santossi avatar smarquespt avatar smojo avatar sn-o-w avatar sr093906 avatar stas-zinchenko avatar tiefkuehlpizze avatar tsiflimagas avatar unbiaseduser avatar weblate avatar yzx23333 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

oandbackupx's Issues

'unable to stat "/proc/self/exe": No such file or directory' error

I'm trying to backup the phone and app settings using OAndBackupX. It seems to be working because it is creating files in the folder specificed for the backup. However, I get an error message for each item I try to backup. Using AntennaPod as an example: 'AntennaPod: unable to stat "/proc/self/exe": No such file or directory. Any idea of what it might be?

I'm running Lineage4MicroG based on Android 9.

Never kill uid 1000's processes (system apps)

Backing up or restoring a system app lets OABX kill all processes of the owning UID which is 1000 in a system app's case.
This is equal to killing the operating system.

Two steps have to be taken:

  1. Never kill processes by UID 1000! Refuse it in the method.
  2. Never kill a process if a system app is backed up or restored.

Additional steps:

  1. Stop offering problematic system apps for a backup such as "Android"
  2. Don't kill and instead suspend processes:

@hg42x did some great testing on this topic and shared it in the Telegram channel:

example test: using clock display (showing seconds)

pm suspend com.google.android.deskclock ; sleep 5 ; pm unsuspend com.google.android.deskclock

works somehow but closes the app, makes the widget showing it's icon, then resumes the widget, but the clock remains closed. You also get a refresh of the whole home screen on suspend and unsuspend (I saw this on another backup app, may be buggybackup).

The command:
kill -STOP 13799 ; sleep 5 ; kill -CONT 13799
works without closing, the secsonds stop and resume afterwards.

I used this to find the PID:

# ps -A | grep com\.google\.android\.deskclock
u0_a205      13799   717 5594500 170908 SyS_epoll_wait      0 S com.google.android.deskclock

may be there are better ways
I think a complete group of corresponding processes (the app may have sub processes and a service etc.) should be suspended. I never used that, but it seems, a process group is the corresponding "thing".

use e.g.:
ps -A -o PGID,PPID,PID,USER,GROUP,CMDLINE | sort
to show the groups (first number) sorted.
On my phone I have a lot of processes in group 717, which is the PID of zygote64.

If I use:
kill -STOP -717 ; sleep 5 ; kill -CONT -717
(note the -PGID parameter)
they all will be stopped.
I tested thsi by looking at different apps like internet radio or clock. They are all stopped until CONT is sent.

Oh...that will not help, because all user apps run in this group (unless suspending all to gether, but OABX would stop itself).
Listing all PIDs of the app user should do the same

Are there devices with Android 7+ without staging directory /data/local/tmp?

Are there devices with Android 7+ without staging directory /data/local/tmp?

There are codepaths in restore procedure, that define installation from different paths to for restoring apks.
The expected way to restore apks is to use the staging directory /data/local/tmp because this is the only path the package manager accepts to install apks from (alternatively stream the apk contents like adb install does).

The second way is used, when the staging directory does not exist and the backup directory is oandbackupx's own data directory. (I don't know how to configure oandbackupx to use this as backup path. Backup location is always on the external storage). The strategy is to copy the apk to the external storage and install it then.
With the definition from above, that package manager would refuse to install from another path than the /dat/local/tmp this would fail on recent Android versions. This might be a relict that works on older, unsupported versions.
I would suggest to drop this and see if anybody reports issues when restoring. Maybe a niche vendor uses a broken Android configuration that would need this.

Third way is to install the backup from the location where it is. I would assume this would happen more likely than the second way and then there is a chance that it would succeed.

Without having it tested, it might make sense to always use apk streaming.

Symlinks and tar.gz issues

Just a quick update, before I'm leaving for a short night:
I'm reworking the whole core backup stuff (namely ShellCommands.java).
At some points, I ran into issues just related to SDK <26 (namely Android 7.x). I'm currently testing on Android 7 and I've noticed that many apps are not available on the Play Store (many Games and Spotify). I guess it's because of split APK. So Titanium Backup would probably perform well on Android 7.x.

As you might have seen, I have .tar.gz archiving implemented. It's working fine and I think, I even got the crypto running (some password to key expansion with PBKDF2 and then wrap the tar.gz output stream through it).

But now the bummer: I already mentioned the problem with symlinks and zipfiles the other day and when I was testing the restore function, I've noticed issues with the lib directory in the app's data because it's a symlink. Too many symlinks. Well. The backup procedure does not create symlinks in the tar.gz archive. Even when I tried to implement it. That's because it's copying the data to the external storage first which is formatted in FAT. And FAT does not support symlinks.

I guess, the restore of the data works in the released versions, because it's dereferencing the symlinks and replaces it with the actual files. This might go well for some time, but I guess the time will come, when the app updates the original file and you'll have mixed versions in your data. Either you'll have to fix it manually or you'll have to delete the app's data.

I can think of another solution which is to use toybox's tar command to create the archive right from the data directory and to the encryption afterwards. It would double the writes on the storage if you have encryption enabled because it would first create the archive and then encrypt it (and being picky: it leaves the traces of the unencrypted deleted archive, so an attacker could be able to restore the data).

Last for today, I want to mention a potential bug with the AppInfo class, because it stores and restores the original data directories, which is fine on the same device. On my emulator, I have adopted storage and then it tries to restore the data to /mnt/expand/86e4a97c-661b-4611-971a-b66b093be72e/user/0/com.supercell.clashofclans. Obviously a dynamic path that is different after a wipe or change of device. So I needed to get the fresh path from the package manager.
I guess you also have noticed, that the app does not do a good job updating the information an action and here it even causes issues on the technical site.

That's so far from my site. I'll go on tomorrow. I need some sleep now.

Check Permissions in /data/data

drwxr-x--x  4 u0_a94    u0_a94    4096 2019-11-15 13:05 com.google.android.launcher
drwxrwx--x 12 u0_a121   u0_a121   4096 2020-06-28 12:25 com.spotify.music
drwx------  8 u0_a123   u0_a123   4096 2020-06-28 12:25 com.sunborn.girlsfrontline.en

com.spotify.music has been restored while com.sunborn.girlsfrontline.en was installed by Google Play.
But also some other system apps have these permissions set.

It does not seem to break anything, but data privacy might be reduced.

[Bug] Custom List for Scheduled Backup does not work

Description
The list is not stored neither restored or processed

Steps To Reproduce

  1. Create a scheduled job
  2. Select custom list and select elements
  3. Confirm the Dialog
  4. Reopen the dialog -> List has no checked elements
  5. Run the Task and see line "OAndBackupX.HandleScheduledBackups: Starting scheduled backup for 0 items" in logcat

Expected behavior
List shows previously checked elements and processes them

Screenshots
None

System Information(please complete the following information):

  • Device: Emulator
  • Android Version: 8.1 (API 27) / with PlayStore injected
  • ROM: (AOSP, MIUI, OOS...) android-27/default/x86
  • App's Version: 4.0.0-dev

Recreate IntroActivity

I'm just noting this down, because it's a mess. Just to create it as official issue later.

Asking for permissions with 3 or more ways to exit. I'm trying to add the necessary query for the backup directory if it's not set (or accessible). It's spaghetti.

It would be nice, if we could have a nice and friendly setup guide. The app launches, it checks what is missing and adds setup pages to the user's todo list.

  1. ๐Ÿ” Check for root; if not available, no further checks are done. Instead an error page is shown, leaving the user no other option as to exit the app
  2. ๐Ÿ“‚ Check if backup directory is defined and exists; if not: Show a page that explains what is expected from the user with a button that opens the file browser intent.
  3. ๐Ÿ”“ Check for usage stat permissions; if not allowed: Show a page that explains why the user has to enable it and how (it's not as easy as with the battery optimization ๐Ÿ˜• )
  4. ๐Ÿ”‹ Optional: Check for battery optimization; if not set: Show a page that explains why the user should enable this. Add two buttons; first is to start the intent to enable it, and second one is to skip this setting. Store a flag, that the user skipped this option so the question is not asked again.
  5. ๐Ÿ”‘ Optional: Check if encryption is enabled; if not: Show a page that explains why the user should set a password. Add two buttons; first is to start the intent to enable it, and second one is to skip this setting. Store a flag, that the user skipped this option so the question is not asked again.

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.