forked from MobSF/Mobile-Security-Framework-MobSF
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HOTFIX][EFR] Priority Bug Fixes (MobSF#2275)
* P1.1 AAR Permissions not properly listed * P1.2 Local variable table not listed in proper section * P1.3 static library strings are not listed * P1.5 Stripping of dynamic and static libraries are not correctly reported * Dependency bump * MobSF version bump
- Loading branch information
1 parent
abb4765
commit 98296f5
Showing
13 changed files
with
766 additions
and
622 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
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
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,36 @@ | ||
"""Common String Extraction Module.""" | ||
import logging | ||
import shutil | ||
import subprocess | ||
|
||
from mobsf.StaticAnalyzer.tools.strings import ( | ||
strings_util, | ||
) | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def get_os_strings(filename): | ||
try: | ||
strings_bin = shutil.which('strings') | ||
if not strings_bin: | ||
return None | ||
strings = subprocess.check_output([strings_bin, filename]) | ||
return strings.decode('utf-8', 'ignore').splitlines() | ||
except Exception: | ||
return None | ||
|
||
|
||
def strings_on_binary(bin_path): | ||
"""Extract strings from binary.""" | ||
try: | ||
strings = get_os_strings(bin_path) | ||
if strings: | ||
return list(set(strings)) | ||
if isinstance(strings, list): | ||
return [] | ||
# Only run if OS strings is not present | ||
return list(set(strings_util(bin_path))) | ||
except Exception: | ||
logger.exception('Extracting strings from binary') |
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
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
Oops, something went wrong.