-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add support for pulling split apks from device, Fixes #2271 * Replace Quark with Behaviour analysis using quark rules
- Loading branch information
1 parent
e5af3a8
commit ee2cb73
Showing
16 changed files
with
3,140 additions
and
261 deletions.
There are no files selected for viewing
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
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
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,45 @@ | ||
# -*- coding: utf_8 -*- | ||
"""Perform behaviour analysis.""" | ||
import logging | ||
from pathlib import Path | ||
|
||
from django.conf import settings | ||
|
||
from mobsf.MobSF.utils import ( | ||
append_scan_status, | ||
get_android_src_dir, | ||
) | ||
from mobsf.StaticAnalyzer.views.sast_engine import ( | ||
scan, | ||
) | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def analyze(checksum, app_dir, typ): | ||
"""Perform behaviour analysis.""" | ||
try: | ||
root = Path(settings.BASE_DIR) / 'MalwareAnalyzer' / 'views' | ||
rules = root / 'android' / 'rules' / 'behaviour_rules.yaml' | ||
app_dir = Path(app_dir) | ||
src = get_android_src_dir(app_dir, typ) | ||
skp = settings.SKIP_CLASS_PATH | ||
msg = 'Android Behaviour Analysis Started' | ||
logger.info(msg) | ||
append_scan_status(checksum, msg) | ||
# Behaviour Analysis | ||
findings = scan( | ||
checksum, | ||
rules.as_posix(), | ||
{'.java', '.kt'}, | ||
[src.as_posix() + '/'], | ||
skp) | ||
msg = 'Android Behaviour Analysis Completed' | ||
logger.info(msg) | ||
append_scan_status(checksum, msg) | ||
return findings | ||
except Exception as exp: | ||
msg = 'Failed to perform behaviour analysis' | ||
logger.exception(msg) | ||
append_scan_status(checksum, msg, repr(exp)) | ||
return {} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.