How to Audit Android Apps (for screenshot activity)


Question

How do I audit my android's apps to determine which apps are taking screenshots of my activity?



I recently installed & ran diskdigger to undelete an image I had accidentally deleted, but the image remnants that diskdigger found were shocking. There were dozens (maybe >100?) screenshots of my activity--ranging from innocuous shots of my home screen to images taken when I was inside my (encrypted) chat apps and bitcoin wallet.



Needless to say, I did not take or delete these screenshots.



My phone is a rooted Nexus 5X running Lineage OS 15-1 (Android 8.1.0). I'm using mostly software from fdroid, though I do have a few sideloaded from yalp (I don't have gapps installed), such as whatsapp and diskdigger.



How do I audit the apps that I have installed to determine what is responsible for taking (then deleting) these screenshots of my activity? To start, how do I:




  1. List all of my apps, sorted by number of times the app has taken a

    screenshot since installed

  2. List all of my apps, sorted by number of times the app has written a
    file to disk since installed

  3. Generate a log and/or toast every time a screenshot is
    taken--recording the timestamp, app responsible, and filename

  4. Generate a log and/or toast every time an app writes a file to
    disk--recording the timestamp, app responsible, and filename

  5. Generate a log and/or toast every time an app deletes a file from
    disk--recording the timestamp, app responsible, and filename



TIA!


Answer

Taking a screenshot requires root or system permissions (or an root exploit). I assume your ROM is a official Lineage release. Assuming further that their signing key has not leaked the app you are searching for should use root permissions is part of the OS. Therefore a first step would be revoke all allowances for apps to use root permissions.





  1. List all of my apps, sorted by number of times the app has taken a
    screenshot since installed




Android is an OS optimized for Smartphones with flash memory. Flash memory degrades by writing to it, therefore Android is optimized to reduce write operations. Therefore Android does not create extensive log files. Only some small logs in RAM exists (e.g. logcat). Hence AFAIK there is no such thing like a log that records which app has created a screenshot.





  1. List all of my apps, sorted by number of times the app has written a file to disk since installed




Again there is no such log. However if the app is still active you can monitor "disk" activity using the inotifywait-for-Android - a command-line application that can record read and/or write access to certain folder on your phone. It looks like you have to compile it yourself using NDK before using it - I did not found an pre-compiled version.



A similar API as used by inotifytools is available to Android apps, therefore there may be apps providing similar functionality.





  1. Generate a log and/or toast every time a screenshot is taken--recording the timestamp, app responsible, and filename




If the screenshots you found were created using the screencap binary (the android tool for creating screenshots which is included in Android) you could try to replace this binary with some other binary.



However if the screenshots were created using a different way I don't see a way to detect or prevent this.





  1. Generate a log and/or toast every time an app writes a file to disk--recording the timestamp, app responsible, and filename.

  2. Generate a log and/or toast every time an app deletes a file from disk--recording the timestamp, app responsible, and filename




-> See what I wrote in (2.) about inotifytools


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes