-
Notifications
You must be signed in to change notification settings - Fork 5
Rc/2.4.0 #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tompsota
wants to merge
13
commits into
main
Choose a base branch
from
rc/2.4.0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rc/2.4.0 #42
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
119bca8
feat: init update
tompsota 7d9205c
implement lock for multi listener registration
tompsota c483c98
move ios files
tompsota b8ebe88
feat: update source code
tompsota 802e73d
feat: update context management in android
tompsota 9bd5083
feat: add typealias
tompsota 9a9733e
chore: example app updates
tompsota a09e02f
fix ios
tompsota ed86bb1
rename compilesdk
tompsota a1cff01
update dist
tompsota 9835a17
feat: guard cache lock
tompsota e47b6e4
remove automation from ios
tompsota 104229c
feat: unregister handlers when app is finishing
tompsota File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip | ||
| networkTimeout=10000 | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
This file contains hidden or 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
121 changes: 121 additions & 0 deletions
121
android/src/main/java/com/aheaditec/freerasp/PluginThreatHandler.kt
This file contains hidden or 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,121 @@ | ||
| package com.aheaditec.freerasp | ||
|
|
||
| import android.content.Context | ||
| import com.aheaditec.talsec_security.security.api.SuspiciousAppInfo | ||
| import com.aheaditec.talsec_security.security.api.ThreatListener | ||
| import com.aheaditec.freerasp.dispatchers.ExecutionStateDispatcher | ||
| import com.aheaditec.freerasp.dispatchers.ThreatDispatcher | ||
| import com.aheaditec.freerasp.events.RaspExecutionStateEvent | ||
| import com.aheaditec.freerasp.events.ThreatEvent | ||
|
|
||
| internal object PluginThreatHandler { | ||
|
|
||
| internal val threatDispatcher = ThreatDispatcher() | ||
| internal val executionStateDispatcher = ExecutionStateDispatcher() | ||
|
|
||
| private val threatDetected = object : ThreatListener.ThreatDetected() { | ||
|
|
||
| override fun onRootDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.PrivilegedAccess) | ||
| } | ||
|
|
||
| override fun onDebuggerDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.Debug) | ||
| } | ||
|
|
||
| override fun onEmulatorDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.Simulator) | ||
| } | ||
|
|
||
| override fun onTamperDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.AppIntegrity) | ||
| } | ||
|
|
||
| override fun onUntrustedInstallationSourceDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.UnofficialStore) | ||
| } | ||
|
|
||
| override fun onHookDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.Hooks) | ||
| } | ||
|
|
||
| override fun onDeviceBindingDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.DeviceBinding) | ||
| } | ||
|
|
||
| override fun onObfuscationIssuesDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.ObfuscationIssues) | ||
| } | ||
|
|
||
| override fun onMalwareDetected(suspiciousAppInfos: MutableList<SuspiciousAppInfo>) { | ||
| threatDispatcher.dispatchMalware(suspiciousAppInfos ?: mutableListOf()) | ||
| } | ||
|
|
||
| override fun onScreenshotDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.Screenshot) | ||
| } | ||
|
|
||
| override fun onScreenRecordingDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.ScreenRecording) | ||
| } | ||
|
|
||
| override fun onMultiInstanceDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.MultiInstance) | ||
| } | ||
|
|
||
| override fun onUnsecureWifiDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.UnsecureWifi) | ||
| } | ||
|
|
||
| override fun onTimeSpoofingDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.TimeSpoofing) | ||
| } | ||
|
|
||
| override fun onLocationSpoofingDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.LocationSpoofing) | ||
| } | ||
|
|
||
| override fun onAutomationDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.Automation) | ||
| } | ||
| } | ||
|
|
||
| private val deviceState = object : ThreatListener.DeviceState() { | ||
|
|
||
| override fun onUnlockedDeviceDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.Passcode) | ||
| } | ||
|
|
||
| override fun onHardwareBackedKeystoreNotAvailableDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.SecureHardwareNotAvailable) | ||
| } | ||
|
|
||
| override fun onDeveloperModeDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.DevMode) | ||
| } | ||
|
|
||
| override fun onADBEnabledDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.ADBEnabled) | ||
| } | ||
|
|
||
| override fun onSystemVPNDetected() { | ||
| threatDispatcher.dispatchThreat(ThreatEvent.SystemVPN) | ||
| } | ||
| } | ||
|
|
||
| private val raspExecutionState = object : ThreatListener.RaspExecutionState() { | ||
| override fun onAllChecksFinished() { | ||
| executionStateDispatcher.dispatch(RaspExecutionStateEvent.AllChecksFinished) | ||
| } | ||
| } | ||
|
|
||
| private val internalListener = ThreatListener(threatDetected, deviceState, raspExecutionState) | ||
|
|
||
| internal fun registerListener(context: Context) { | ||
| internalListener.registerListener(context) | ||
| } | ||
|
|
||
| internal fun unregisterListener(context: Context) { | ||
| internalListener.unregisterListener(context) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the plugin is destroyed but the application process remains alive, the singleton will continue to hold the old Context, causing a memory leak. Therefore, the handleOnDestroy method should be overridden to release the dispatcher listeners.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onDestroy() is not guaranteed to be called in the Android activity lifecycle, so this is not the best place for such actions. However, yes I will add this