Skip to content

Commit

Permalink
Merge pull request #95 from /issues/94-readonly-properties
Browse files Browse the repository at this point in the history
Improve model classes with read-only properties
  • Loading branch information
TomasKypta committed Mar 22, 2024
2 parents 90e2dff + d1b7791 commit e0a2cab
Show file tree
Hide file tree
Showing 17 changed files with 403 additions and 143 deletions.
1 change: 1 addition & 0 deletions docs/Release-Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Update Malwarelytics for Android to 1.1.1 (#87, #92)
- Update ApkThreat with flags (#89)
- Improve model classes with read-only properties (#94)


## Previous Releases
Expand Down
4 changes: 2 additions & 2 deletions scripts/android/model/ApkInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ interface ApkInfo {
/**
* Application name as displayed in the system.
*/
label: String;
readonly label: String;

/**
* Base64 encode PNG icon in the original size.
* You can use it in html as `<img src="data:image/jpeg;base64,${apkInfo.icon}" width="96" />`
*/
icon?: String;
readonly icon?: String;
}
6 changes: 3 additions & 3 deletions scripts/android/model/SmartProtectionResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ interface SmartProtectionResult {
/**
* Wether was the UI displayed. A UI can be either a threat screen or a notification.
*/
uiDisplayed: Boolean;
readonly uiDisplayed: Boolean;
/**
* Whether data update from server succeeded.
*/
onlineUpdateSucceeded: Boolean;
readonly onlineUpdateSucceeded: Boolean;
/**
* Whether evaluation of threats succeeded.
*/
evaluationSucceeded: Boolean;
readonly evaluationSucceeded: Boolean;
}
22 changes: 21 additions & 1 deletion scripts/android/model/rasp/ActiveCallDetection.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
/** Active call detection data. */
interface ActiveCallDetection {
callState: CallState;
/** State of ongoing call. */
readonly callState: CallState;
}

/** State of ongoing call. */
enum CallState {
/** Idle state: not ringing and no call established. */
IDLE = "IDLE",
/** Device is ringing. An incoming call is being signaled. */
RINGING = "RINGING",
/** In call. A telephony call is established. */
ACTIVE_CALL = "ACTIVE_CALL",
/** In communication. An audio/video chat or VoIP call is established. */
ACTIVE_COMMUNNICATION = "ACTIVE_COMMUNNICATION",
/**
* Call screening is in progress.
* The call is connected, and audio is accessible to call screening applications,
* but other audio use cases are still possible.
*/
CALL_SCREENING = "CALL_SCREENING",
/**
* A telephony call is established, and its audio is being redirected to another device.
*/
ACTIVE_CALL_REDIRECT = "ACTIVE_CALL_REDIRECT",
/**
* An audio/video chat or VoIP call is established,
* and its audio is being redirected to another device.
*/
ACTIVE_COMMUNICATION_REDIRECT = "ACTIVE_COMMUNICATION_REDIRECT",
/** Unknown state. */
UNKNOWN = "UNKNOWN"
}
15 changes: 8 additions & 7 deletions scripts/android/model/rasp/AppPresenceDetection.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/** App presence detection data. */
interface AppPresenceDetection {
remoteDesktopApps: [NamedApkItemInfo];
/** Detected remote desktop apps. */
readonly remoteDesktopApps: [NamedApkItemInfo];
}

/** Rasp detection app item. */
interface NamedApkItemInfo {
/** Display name item as defined in the configuration. */
displayName: string;
readonly displayName: string;
/** Obtained application name. */
appName: string;
readonly appName: string;
/** Package name (application ID) of the app. */
packageName: string;
readonly packageName: string;
/** Version name. */
versionName: string;
readonly versionName: string;
/** Version code. */
versionCode: number;
readonly versionCode: number;
/** Base64 encoded SHA-1 signature hash. */
signatureHash: string;
readonly signatureHash: string;
}
27 changes: 25 additions & 2 deletions scripts/android/model/rasp/BiometryDetection.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
/** Biometry config detection data. */
interface BiometryDetection {
biometricStatus: BiometricStatus;
androidxLibStatus: number;
/** Status of the biometry config on the device. */
readonly biometricStatus: BiometricStatus;
/**
* Status of the biometry config on the device, the raw value obtained
* from 'androidx.biometric.BiometricManager'.
*/
readonly androidxLibStatus: number;
}

enum BiometricStatus {
/**
* Corresponds to 'androidx.biometric.BiometricManager.BIOMETRIC_SUCCESS'.
*/
CONFIGURED = "CONFIGURED",
/**
* Corresponds to 'androidx.biometric.BiometricManager.BIOMETRIC_STATUS_UNKNOWN'.
*/
UNKNOWN = "UNKNOWN",
/**
* Corresponds to either 'androidx.biometric.BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED'
* or 'androidx.biometric.BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE'.
*/
UNSUPPORTED = "UNSUPPORTED",
/**
* Corresponds to either 'androidx.biometric.BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE'
* or 'androidx.biometric.BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED'.
*/
CURRENTLY_UNAVAILABLE = "CURRENTLY_UNAVAILABLE",
/**
* Corresponds to 'androidx.biometric.BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED'.
*/
NONE_ENROLLED = "NONE_ENROLLED"
}
11 changes: 7 additions & 4 deletions scripts/android/model/rasp/DebuggerDetection.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

/** Debugger detection data. */
interface DebuggerDetection {
isDebuggerAttached: boolean;
isWaitingForDebugger: boolean;
debuggerType: [DebuggerType];
/** Whether a debugger is attached. */
readonly isDebuggerAttached: boolean;
/** Whether one or more threads is waiting for a debugger to attach. */
readonly isWaitingForDebugger: boolean;
/** Type of detected debugger. */
readonly debuggerType: [DebuggerType];
}

enum DebuggerType {
Expand Down
12 changes: 8 additions & 4 deletions scripts/android/model/rasp/EmulatorDetection.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

/** Emulator detection data. */
interface EmulatorDetection {
isEmulator: boolean;
detectedEmulatorType?: EmulatorType;
emulatorDetectionProofs: [EmulatorDetectionProof];
/** Whether the device is recognized as an emulator. */
readonly isEmulator: boolean;
/** Type of detected emulator. */
readonly detectedEmulatorType?: EmulatorType;
/** Some troubleshooting information. */
readonly emulatorDetectionProofs: [EmulatorDetectionProof];
}

/** Type of the emulator. */
enum EmulatorType {
AVD = "AVD",
GENYMOTION = "GENYMOTION",
Expand Down
14 changes: 7 additions & 7 deletions scripts/android/model/rasp/HttpProxyDetection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
*/
interface HttpProxyDetection {
/** Whether the proxy data indicate that a proxy is enabled. */
isHttpProxyEnabled: boolean;

isUsingAutoConfig: boolean;
readonly isHttpProxyEnabled: boolean;
/** Whether the HTTP proxy is using an auto-config with a PAC script. */
readonly isUsingAutoConfig: boolean;
/** Host of the proxy server or null if proxy is not enabled. */
host?: string;
readonly host?: string;
/** Port of the proxy server or null if proxy is not enabled. */
port?: number;
readonly port?: number;
/** Comma separated list of host for which the proxy is ignored or null if there are no excluded hosts. */
exclusionList?: string;
readonly exclusionList?: string;
/** he URL of the current PAC script or null if there is no PAC script. */
pacFileUrl?: string;
readonly pacFileUrl?: string;
}
8 changes: 7 additions & 1 deletion scripts/android/model/rasp/RepackagingResult.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@

/** The result type of repackaging detection. */
enum RepackagingResult {
/** The app is repackaged. */
REPACKAGED_APP = "REPACKAGED_APP",
/** The app is original, unaltered. */
ORIGINAL_APP = "ORIGINAL_APP",
/**
* Invalid configuration of repackaging detection.
* Repackaging can't be determined.
*/
INVALID_CONFIG = "INVALID_CONFIG"
}
17 changes: 11 additions & 6 deletions scripts/android/model/rasp/RootDetection.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@

/** Root detection data. */
interface RootDetection {
isRooted: boolean;
isRootCloaked: boolean;
rootDetectionProofs: [RootDetectionProof];
rootDetectionConfidence: number;
rootCloakDetectionConfidence: number;
/** Whether the device is rooted with a non-zero confidence. */
readonly isRooted: boolean;
/** Whether there's an attempt to cloak the root. */
readonly isRootCloaked: boolean;
/** Some troubleshooting information. */
readonly rootDetectionProofs: [RootDetectionProof];
/** Confidence of root detection, value from 0.0 to 1.0. */
readonly rootDetectionConfidence: number;
/** Confidence of root cloak detection, value from 0.0 to 1.0. */
readonly rootCloakDetectionConfidence: number;
}

enum RootDetectionProof {
Expand Down
8 changes: 4 additions & 4 deletions scripts/android/model/rasp/ScreenReaderDetection.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/** Screen reader blocking data. */
interface ScreenReaderDetection {
/** Whether a not allowed screen reader is enabled. */
isNotAllowedScreenReaderEnabled: boolean;
readonly isNotAllowedScreenReaderEnabled: boolean;
/** Not allowed screen readers that are enabled. Identified by their package names (application IDs). */
notAllowedScreenReaders: [string];
readonly notAllowedScreenReaders: [string];
/** List of all enabled screen readers on the device. */
enabledScreenReaders: [string];
readonly enabledScreenReaders: [string];
/** List of all installed screen readers on the device. */
installedScreenReaders: [string];
readonly installedScreenReaders: [string];
}
14 changes: 7 additions & 7 deletions scripts/android/model/rasp/ScreenSharingDetection.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/** Screen sharing detection data. */
interface ScreenSharingDetection {
/** Number of detected displays that the content is displayed on. */
numberOfDisplays: number;
readonly numberOfDisplays: number;
/** Whether a device screen is being shared (mirror) elsewhere. */
isScreenShared: number;
readonly isScreenShared: number;
/** Transient data containing information about detected transient changes. */
transientData: TransientScreenSharingData;
readonly transientData: TransientScreenSharingData;
/** Whether the detection result is problematic for the app. */
isProblematic: boolean;
readonly isProblematic: boolean;
/** Whether the detection result indicates a transient change. */
isTransientChange: boolean;
readonly isTransientChange: boolean;
}

/** Obtained transient data. */
interface TransientScreenSharingData {
/** Whether an added display has just been detected. */
displayAdded: boolean;
readonly displayAdded: boolean;
/** Whether a removed display has just been detected. */
displayRemoved: boolean;
readonly displayRemoved: boolean;
}
12 changes: 9 additions & 3 deletions scripts/android/model/rasp/TapjackingDetection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

/** Tapjacking detection data. */
interface TapjackingDetection {
isTapjackingBlocked: boolean;
tapjackingCapableApps: [string];
/** Whether the SDK is currently blocking tapjacking. */
readonly isTapjackingBlocked: boolean;
/**
* List of "bad" apps capable of performing tapjacking.
* A bad app is one that has a treat index same or higher
* than @see MalwarelyticsAndroidTapjackingBlockConfig.blockTapjackingSensitivity.
*/
readonly tapjackingCapableApps: [string];
}
Loading

0 comments on commit e0a2cab

Please sign in to comment.