1717from frida import __version__ as frida_version
1818
1919from mobsf .DynamicAnalyzer .tools .webproxy import (
20+ create_ca ,
2021 get_ca_file ,
2122 get_http_tools_url ,
2223 start_proxy ,
3536from mobsf .StaticAnalyzer .models import StaticAnalyzerAndroid
3637
3738logger = logging .getLogger (__name__ )
38- ANDROID_API_SUPPORTED = 29
39+ ANDROID_API_SUPPORTED = 30
3940
4041
4142class Environment :
@@ -51,8 +52,9 @@ def __init__(self, identifier=None):
5152
5253 def wait (self , sec ):
5354 """Wait in Seconds."""
54- logger .info ('Waiting for %s seconds...' , str (sec ))
55- time .sleep (sec )
55+ if sec > 0 :
56+ logger .info ('Waiting for %s seconds...' , str (sec ))
57+ time .sleep (sec )
5658
5759 def check_connect_error (self , output ):
5860 """Check if connect failed."""
@@ -61,12 +63,19 @@ def check_connect_error(self, output):
6163 return False
6264 return True
6365
64- def run_subprocess_verify_output (self , cmd ):
66+ def run_subprocess_verify_output (self , cmd , wait = 2 ):
6567 """Run subprocess and verify execution."""
6668 out = subprocess .check_output (cmd ) # lgtm [py/command-line-injection]
67- self .wait (2 ) # adb shell is allowed
69+ self .wait (wait ) # adb shell is allowed
6870 return self .check_connect_error (out )
6971
72+ def connect (self ):
73+ """ADB Connect."""
74+ logger .info ('Connecting to Android %s' , self .identifier )
75+ self .run_subprocess_verify_output ([get_adb (),
76+ 'connect' ,
77+ self .identifier ], 0 )
78+
7079 def connect_n_mount (self ):
7180 """Test ADB Connection."""
7281 self .adb_command (['kill-server' ])
@@ -564,6 +573,7 @@ def mobsfy_init(self):
564573
565574 def mobsf_agents_setup (self , agent ):
566575 """Setup MobSF agents."""
576+ create_ca ()
567577 # Install MITM RootCA
568578 self .install_mobsf_ca ('install' )
569579 # Install MobSF Agents
0 commit comments