Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
108.7k stars 10.47k forks source link

Does not work with apps that block screenshots #36

Closed nvllsvm closed 6 years ago

nvllsvm commented 6 years ago

Apps such as Bitwarden and Silence block screenshots. Attemtping to take a screenshot on the device results in this error.

screenshot_kiss_launcher_20180310-224624

Using scrcpy, the app functions normally on the device, but scrcpy displays a black background with the status bar visible. No notification or log output indicates anything abnormal. The screenshot notifciation does not appear.

out

Strangely enough, LineageOS's built-in screen recording app captures these applications without problems. The device is not rooted.

Tested on a OnePlus 3T running LineageOS 15.1 20180305.

rom1v commented 6 years ago

You can disable it in Silence settings → Privacy → Screen security.

Strangely enough, LineageOS's built-in screen recording app captures these applications without problems.

They probably modified the feature in the ROM, because on AOSP, even screenrecord do not display the screen content.

rom1v commented 6 years ago

Since I added an entry in the FAQ, I'm closing.

rom1v commented 5 years ago

Now you can (on dev branch): https://github.com/Genymobile/scrcpy/commit/1fdde490fd2a0b89680a2b5da5e5274192398023

npes87184 commented 5 years ago

Now you can (on dev branch): 1fdde49

After Testing SafeInCloud and Enpass, I can confirm that it works.

inxomnyaa commented 4 years ago

Very great, thanks for fixing! I now can finally see the password field for paypal on my phone with broken screen :heart:

abele17 commented 4 years ago

I really enjoy using scrcpy. I think that it's a great product. Unfortunately I am having the black screen issue mentioned above on some specific apps. I am new to coding so I apologize. I was wondering if someone could explain more in details how you fixed the issue so that I can do it myself. Thanks for the help!

rom1v commented 4 years ago

The apps which remain black could not be mirrored with scrcpy (some drm prevent it to be captured).

abele17 commented 4 years ago

Thank you. Great app.

arekolek commented 3 years ago

@rom1v Do you know if an app is able to detect the case when an app such as scrcpy is pretending to be a secure display even though it's not?

The problem I have is that scrcpy allows taking screenshots and screen recordings, even though it pretends to be a secure screen, which creates a security vulnerability.

Furthermore, even if scrcpy filtered out protected content from screenshots and recordings, it would be possible to record the whole screen on the computer, unless scrcpy would filter that too.

But even then, anybody could build scrcpy from source as it is currently and use it to take screenshots of content that was supposed to be protected. So do you know if it's possible to detect "fake" secure displays?

(I know that it's always possible to take a photo of the phone with an ordinary camera, but I don't need to worry about that, I just need to prevent taking screenshots)

rom1v commented 3 years ago

I don't know.

FWIW, I think that the users should always be able to take screenshots or videos of ther screen (it's their own device). It's ok that app developers provide a hint that some screen should not be captured by default, but device users should always have the possibility to easily bypass this setting. (I know that this is not the current trend from Google or others.)

Rajssss commented 2 years ago

I am having the same issue again with some banking app, which prevents taking screenshots too. I am using android 12. Tried the latest dev branch.

kwanice commented 2 years ago

any update onhow to bypass that? some Bank app are black..even on v 1.23 thanks for help

rom1v commented 2 years ago

It's not possible on Android >= 12. See #2129

hmcomer commented 1 year ago

Any updates on this issue? Is there any possibility to bypass it?

rom1v commented 1 year ago

Not since Android 12 #2129.

CoolSpot commented 1 year ago

Any updates on this issue? Is there any possibility to bypass it?

You can bypass it by decompiling the APK, disabling FLAG_SECURE for the main view, and recompiling the APK back. It is very easy to do using "APKLab" extension for Visual Studio Code. 1) Open APK using APKLab, it decompiles it into a folder structure with smali files 2) in the resulting folder structure search for RegExp android/view/Window;->(set|add)Flag 3) Ignore all occurrences in androidx/* or any third-party namespaces 4) find (usually only one per app) occurrence that is preceded by setting register to 0x2000 like this:

    .line 143
    invoke-virtual {p0}, Landroid/app/Activity;->getWindow()Landroid/view/Window;

    move-result-object v0

    const/16 v1, 0x2000

    # invoke-virtual {v0, v1, v1}, Landroid/view/Window;->setFlags(II)V

5) comment out whole line calling addFlag/setFlags (as shown above) 6) rebuild&sign APK back by right clicking on the "apktool.yml" file and clicking "APKLab: Rebuild the APK" 7) install the APK on your device 8) enjoy

This approach has been tested on both RSA Authenticator and MS Athenticator apps running on Android 12.

Ddfulton commented 1 year ago

Addendum to @CoolSpot's comment for Duo Mobile

From grepping android/view/Window;->(set|add)Flag I got five hits. None of them were prefixed with 0x2000. They were prefixed with other register addresses.

I just commented out all of them and it worked like a charm.

KaKi87 commented 1 year ago

Hello,

Rooted users can bypass FLAG_SECURE using this LSPosed plugin.

Just tested it successfully.

Thanks

RiggiG commented 1 year ago

Root users may also use this fork which simply runs the scrcpy-server as the system user: https://github.com/Genymobile/scrcpy/issues/3049#issuecomment-1603612740

ZwieslerLehrer commented 1 year ago

Root users may also use this fork which simply runs the scrcpy-server as the system user: #3049 (comment)

Is there a non root version for some apps which do not run on rooted devices such as banking apps. Editing the banking app apk to remove the secure flag as suggested above does not seem advisable.

KaKi87 commented 1 year ago

In order to make a banking app work on a rooted device, you just have to add it to Magisk's DenyList.