Skip to content
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

Update ApkThreat with flags #91

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions demoapp/www/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ h1 {
grid-column: 2;
grid-row: 2;
}
.threat-flags {
font-size: 8px;
grid-column: 2;
grid-row: 3;
}
.threat-malware {
color: #ac0b2a;
}
Expand Down
7 changes: 6 additions & 1 deletion demoapp/www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,11 @@ var demoApp = {
else {
icon = "<img src=\"../img/icon-placeholder.svg\" />";
}
var flagsDiv = "";
if (apk.flags.length > 0) {
var flStr = apk.flags.map(function (fl) { return fl.type + ": " + fl.name; });
flagsDiv = "<div class=\"threat-flags\">".concat(flStr.join('; '), "</div>");
}
var threatCls = "";
switch (apk.threatIndex) {
case "MALWARE":
Expand All @@ -792,7 +797,7 @@ var demoApp = {
threatCls = "threat-dangerous";
break;
}
node.innerHTML = "<div class=\"threat\">".concat(icon, "<div class=\"appname\">").concat(apkInfo.label || apk.packageName, "</div><div class=\"threatindex ").concat(threatCls, "\">").concat(apk.threatIndex, "</div></div>");
node.innerHTML = "<div class=\"threat\">".concat(icon, "<div class=\"appname\">").concat(apkInfo.label || apk.packageName, "</div><div class=\"threatindex ").concat(threatCls, "\">").concat(apk.threatIndex, "</div>").concat(flagsDiv, "</div>");
appList.appendChild(node);
});
return [3, 7];
Expand Down
7 changes: 6 additions & 1 deletion demoapp/www/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ var demoApp = {
} else {
icon = `<img src="../img/icon-placeholder.svg" />`
}
var flagsDiv = "";
if (apk.flags.length > 0) {
let flStr = apk.flags.map(fl => fl.type + ": " + fl.name)
flagsDiv = `<div class="threat-flags">${flStr.join('; ')}</div>`
}
var threatCls = ""
switch (apk.threatIndex) {
case "MALWARE":
Expand All @@ -336,7 +341,7 @@ var demoApp = {
threatCls = "threat-dangerous";
break;
}
node.innerHTML = `<div class="threat">${icon}<div class="appname">${apkInfo.label || apk.packageName}</div><div class="threatindex ${threatCls}">${apk.threatIndex}</div></div>`;
node.innerHTML = `<div class="threat">${icon}<div class="appname">${apkInfo.label || apk.packageName}</div><div class="threatindex ${threatCls}">${apk.threatIndex}</div>${flagsDiv}</div>`;
appList.appendChild(node);
});
} catch(e) {
Expand Down
1 change: 1 addition & 0 deletions docs/Release-Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Release 5.1.1-dev

- Update Malwarelytics for Android to 1.1.0 (#87)
- Update ApkThreat with flags (#89)


## Previous Releases
Expand Down
37 changes: 31 additions & 6 deletions scripts/android/model/apkThreat/ApkThreat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,45 @@
interface ApkThreat {

/** Package name (application Id) of the app posing a threat to the current app. */
packageName: string;
readonly packageName: string;

/** Threat index indicating severity of the threat. */
threatIndex: ThreatIndex;
readonly threatIndex: ThreatIndex;

/** Evaluated threat index indicating severity of the threat. */
readonly evaluatedThreatIndex: ThreatIndex

/** Suggested threat index. If the value is `UNKNOWN` then there's no suggestion. */
readonly suggestedThreatIndex: ThreatIndex

/** Optional name of malware detection. This is not bound to the thratIndex, can appear independently. */
malwareDetectionName?: string;
readonly malwareDetectionName?: string;

/** Set of recommended mitigations for handling the threat. */
mitigations: ThreatMitigation[];
readonly mitigations: ThreatMitigation[];

/** Evaluated threat reasons marking what is dangerous about the app. */
reasons: ThreatReason[];
readonly reasons: ThreatReason[];

/** Store the app was installed from (for example google play). */
threatInstaller: ThreatInstaller;
readonly threatInstaller?: ThreatInstaller;

/** List of malware flags - malware types and malware families. */
readonly flags: MalwareFlag[];
}

/** Flag designating malware info. */
interface MalwareFlag {
readonly name: string;
readonly type: MalwareFlagType;
}

/** Type of MalwareFlag. */
enum MalwareFlagType {
/** Unknown type of malware flag. */
UNKNOWN = "UNKNOWN",
/** Name of the malware family. */
MALWARE_FAMILY = "MALWARE_FAMILY",
/** Type of the malware, relates with used attack techniques. */
MALWARE_TYPE = "MALWARE_TYPE"
}
32 changes: 26 additions & 6 deletions www/MalwarelyticsPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -818,17 +818,37 @@ interface SmartProtectionResult {
*/
interface ApkThreat {
/** Package name (application Id) of the app posing a threat to the current app. */
packageName: string;
readonly packageName: string;
/** Threat index indicating severity of the threat. */
threatIndex: ThreatIndex;
readonly threatIndex: ThreatIndex;
/** Evaluated threat index indicating severity of the threat. */
readonly evaluatedThreatIndex: ThreatIndex;
/** Suggested threat index. If the value is `UNKNOWN` then there's no suggestion. */
readonly suggestedThreatIndex: ThreatIndex;
/** Optional name of malware detection. This is not bound to the thratIndex, can appear independently. */
malwareDetectionName?: string;
readonly malwareDetectionName?: string;
/** Set of recommended mitigations for handling the threat. */
mitigations: ThreatMitigation[];
readonly mitigations: ThreatMitigation[];
/** Evaluated threat reasons marking what is dangerous about the app. */
reasons: ThreatReason[];
readonly reasons: ThreatReason[];
/** Store the app was installed from (for example google play). */
threatInstaller: ThreatInstaller;
readonly threatInstaller?: ThreatInstaller;
/** List of malware flags - malware types and malware families. */
readonly flags: MalwareFlag[];
}
/** Flag designating malware info. */
interface MalwareFlag {
readonly name: string;
readonly type: MalwareFlagType;
}
/** Type of MalwareFlag. */
declare enum MalwareFlagType {
/** Unknown type of malware flag. */
UNKNOWN = "UNKNOWN",
/** Name of the malware family. */
MALWARE_FAMILY = "MALWARE_FAMILY",
/** Type of the malware, relates with used attack techniques. */
MALWARE_TYPE = "MALWARE_TYPE"
}
/**
* A threat level that is posed by an app.
Expand Down
10 changes: 10 additions & 0 deletions www/MalwarelyticsPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,16 @@ var InitializationResult;
InitializationResult["TEMPORARY_OFFLINE_MODE"] = "TEMPORARY_OFFLINE_MODE";
InitializationResult["PERMANENT_OFFLINE_MODE"] = "PERMANENT_OFFLINE_MODE";
})(InitializationResult || (InitializationResult = {}));
/** Type of MalwareFlag. */
var MalwareFlagType;
(function (MalwareFlagType) {
/** Unknown type of malware flag. */
MalwareFlagType["UNKNOWN"] = "UNKNOWN";
/** Name of the malware family. */
MalwareFlagType["MALWARE_FAMILY"] = "MALWARE_FAMILY";
/** Type of the malware, relates with used attack techniques. */
MalwareFlagType["MALWARE_TYPE"] = "MALWARE_TYPE";
})(MalwareFlagType || (MalwareFlagType = {}));
/** Result of an update. */
var UpdateResult;
(function (UpdateResult) {
Expand Down
32 changes: 26 additions & 6 deletions www/MalwarelyticsPlugin.module.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -818,17 +818,37 @@ export interface SmartProtectionResult {
*/
export interface ApkThreat {
/** Package name (application Id) of the app posing a threat to the current app. */
packageName: string;
readonly packageName: string;
/** Threat index indicating severity of the threat. */
threatIndex: ThreatIndex;
readonly threatIndex: ThreatIndex;
/** Evaluated threat index indicating severity of the threat. */
readonly evaluatedThreatIndex: ThreatIndex;
/** Suggested threat index. If the value is `UNKNOWN` then there's no suggestion. */
readonly suggestedThreatIndex: ThreatIndex;
/** Optional name of malware detection. This is not bound to the thratIndex, can appear independently. */
malwareDetectionName?: string;
readonly malwareDetectionName?: string;
/** Set of recommended mitigations for handling the threat. */
mitigations: ThreatMitigation[];
readonly mitigations: ThreatMitigation[];
/** Evaluated threat reasons marking what is dangerous about the app. */
reasons: ThreatReason[];
readonly reasons: ThreatReason[];
/** Store the app was installed from (for example google play). */
threatInstaller: ThreatInstaller;
readonly threatInstaller?: ThreatInstaller;
/** List of malware flags - malware types and malware families. */
readonly flags: MalwareFlag[];
}
/** Flag designating malware info. */
export interface MalwareFlag {
readonly name: string;
readonly type: MalwareFlagType;
}
/** Type of MalwareFlag. */
export declare enum MalwareFlagType {
/** Unknown type of malware flag. */
UNKNOWN = "UNKNOWN",
/** Name of the malware family. */
MALWARE_FAMILY = "MALWARE_FAMILY",
/** Type of the malware, relates with used attack techniques. */
MALWARE_TYPE = "MALWARE_TYPE"
}
/**
* A threat level that is posed by an app.
Expand Down