-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
demos/ios/MASVS-PLATFORM/MASTG-DEMO-0021/MASTG-DEMO-0020.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
platform: ios | ||
title: References to Screen Capturing API | ||
code: [swift] | ||
id: MASTG-DEMO-0020 | ||
test: MASTG-TEST-0240 | ||
--- | ||
|
||
### Sample | ||
|
||
{{ MastgTest.swift }} | ||
|
||
### Steps | ||
|
||
1. Unzip the app package and locate the main binary file (@MASTG-TECH-0058), which in this case is `./Payload/MASTestApp.app/MASTestApp`. | ||
2. Open the app binary with @MASTG-TOOL-0073 with the `-i` option to run this script. | ||
|
||
{{ screen-capture.r2 }} | ||
|
||
{{ run.sh }} | ||
|
||
### Observation | ||
|
||
The output contains all uses of [sceneCaptureState](https://developer.apple.com/documentation/uikit/uitraitcollection/scenecapturestate) and [isCaptured](https://developer.apple.com/documentation/uikit/uiscreen/iscaptured) functions in the binary. | ||
|
||
{{ output.txt }} | ||
|
||
### Evaluation | ||
|
||
The test succeeds because the app contains API that detects screen capturing. It's difficult to say whether the app actually uses this API but its presence indicates that the developer is aware of this API. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import SwiftUI | ||
|
||
struct MastgTest { | ||
|
||
static func mastgTest(completion: @escaping (String) -> Void) { | ||
// Check if screen is recorded | ||
if #available(iOS 17.0, *) { | ||
if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene { | ||
let state = scene.keyWindow?.traitCollection.sceneCaptureState | ||
switch state { | ||
case .active: | ||
completion("Scene is actively being captured") | ||
|
||
case .inactive: | ||
completion("Scene capture is inactive") | ||
|
||
case .none: | ||
completion("Scene capture cannot be identified inactive") | ||
|
||
case .some(_): | ||
completion("Scene capture cannot be identified inactive") | ||
} | ||
} else { | ||
if UIScreen.main.isCaptured{ | ||
completion("Scene is actively being captured") | ||
} | ||
else{ | ||
completion("Scene capture is inactive") | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 0x00008a80 0x100008a80 10 11 8.__TEXT.__objc_methname ascii isCaptured | ||
6 0x00008abe 0x100008abe 17 18 8.__TEXT.__objc_methname ascii sceneCaptureState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
r2 -q -i screen-capture.r2 -A MASTestApp > output.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
e asm.bytes=false | ||
e scr.color=false | ||
e asm.var=false | ||
|
||
iz | grep objc | grep isCaptured | ||
iz | grep objc | grep sceneCaptureState |