mirror of
https://github.com/MobSF/Mobile-Security-Framework-MobSF.git
synced 2026-10-12 02:06:59 +00:00
Hotfix psutil fix + QA
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
.git
|
||||
.github
|
||||
.gitmodules
|
||||
.tox
|
||||
.dockerignore
|
||||
.sonarcloud.properties
|
||||
|
||||
+10
-13
@@ -414,15 +414,9 @@ def get_random():
|
||||
def find_process_by(name):
|
||||
"""Return a set of process path matching name."""
|
||||
proc = set()
|
||||
try:
|
||||
for p in psutil.process_iter(attrs=['name', 'exe', 'cmdline']):
|
||||
if (name == p.info['name'] or p.info['exe']
|
||||
and os.path.basename(p.info['exe']) == name
|
||||
or p.info['cmdline'] and p.info['cmdline'][0] == name):
|
||||
proc.add(p.info['exe'])
|
||||
except FileNotFoundError:
|
||||
# Bug in OSX 10.6 ?
|
||||
pass
|
||||
for p in psutil.process_iter(attrs=['name']):
|
||||
if (name == p.info['name']):
|
||||
proc.add(p.exe())
|
||||
return proc
|
||||
|
||||
|
||||
@@ -446,6 +440,10 @@ def get_device():
|
||||
def get_adb():
|
||||
"""Get ADB binary path."""
|
||||
try:
|
||||
adb_loc = None
|
||||
adb_msg = ('Set adb path, ADB_BINARY in MobSF/settings.py'
|
||||
' with same adb binary used'
|
||||
' by Genymotion VM/Emulator AVD.')
|
||||
global ADB_PATH
|
||||
if (len(settings.ADB_BINARY) > 0
|
||||
and is_file_exists(settings.ADB_BINARY)):
|
||||
@@ -458,15 +456,14 @@ def get_adb():
|
||||
else:
|
||||
adb_loc = find_process_by('adb')
|
||||
if len(adb_loc) > 1:
|
||||
logger.warning('Multiple ADB locations found. '
|
||||
'Set adb path, ADB_BINARY in MobSF/settings.py'
|
||||
' with same adb binary used'
|
||||
' by Genymotion VM/Emulator AVD.')
|
||||
logger.warning('Multiple ADB locations found. %s', adb_msg)
|
||||
logger.warning(adb_loc)
|
||||
if adb_loc:
|
||||
ADB_PATH = adb_loc.pop()
|
||||
return ADB_PATH
|
||||
except Exception:
|
||||
if not adb_loc:
|
||||
logger.warning('Cannot find adb! %s', adb_msg)
|
||||
logger.exception('Getting ADB Location')
|
||||
finally:
|
||||
if ADB_PATH:
|
||||
|
||||
+2
-2
@@ -21,6 +21,6 @@ distro==1.5.0
|
||||
IP2Location==8.4.1
|
||||
# Do not update the following
|
||||
apkid==2.1.0
|
||||
cryptography<2.5,>=2.1.4 # pyup: ignore
|
||||
pyOpenSSL==19.0.0 # pyup: ignore
|
||||
cryptography<3.0,>=2.9 # pyup: ignore
|
||||
pyOpenSSL<19.2,>=19.1.0 # pyup: ignore
|
||||
http-tools==1.1.1
|
||||
|
||||
Reference in New Issue
Block a user