@@ -190,7 +190,10 @@ def __init__(self):
190190 self .arrangedresult = None
191191 self .arrangedresult2 = None
192192 self .platform = None
193- self .spawntargetid = None
193+ self .islistpidchecked = False
194+ self .attachtargetname = None # name to attach. need to provide on the AppList widget
195+ self .attachedname = None # main module name after frida attached successfully
196+ self .spawntargetid = None # target identifier to do frida spawn. need to provide on the AppList widget
194197 self .remoteaddr = ''
195198
196199 self .attachBtn .clicked .connect (self .attach_frida )
@@ -210,6 +213,7 @@ def __init__(self):
210213 self .memReplaceBtn .clicked .connect (self .mem_search_replace_func )
211214 self .memSearchTargetImgCheckBox .stateChanged .connect (self .mem_search_with_img_checkbox )
212215 self .memScanPatternTypeCheckBox .stateChanged .connect (self .mem_scan_pattern_checkbox )
216+ self .listPIDCheckBox .stateChanged .connect (self .list_pid )
213217 self .attachTypeCheckBox .stateChanged .connect (self .remote_attach )
214218 self .spawnModeCheckBox .stateChanged .connect (self .spawn_mode )
215219 self .memSearchReplaceCheckBox .stateChanged .connect (self .mem_search_replace_checkbox )
@@ -256,17 +260,22 @@ def searchresultaddrsig_func(self, searchresultaddrsig: str):
256260 self .addr_btn_func ()
257261
258262 @pyqtSlot (str )
259- def spawntargetsig_func (self , spawntargetidsig : str ):
260- self .spawntargetid = spawntargetidsig
263+ def targetsig_func (self , targetsig : str ):
264+ if self .isspawnchecked :
265+ self .spawntargetid = targetsig
266+ else :
267+ self .attachtargetname = targetsig
261268 if self .isremoteattachchecked is True :
262269 if re .search (r"^\d+\.\d+\.\d+\.\d+:\d+$" , self .spawndialog .spawnui .remoteAddrInput .text ()) is None :
263270 QMessageBox .information (self , "info" , "Enter IP:PORT" )
264271 self .spawntargetid = None
272+ self .attachtargetname = None
265273 return
266274 self .remoteaddr = self .spawndialog .spawnui .remoteAddrInput .text ()
267275 self .attach_frida ()
268276 self .spawndialog = None
269277 self .spawntargetid = None
278+ self .attachtargetname = None
270279 self .remoteaddr = ''
271280
272281 @pyqtSlot (str )
@@ -290,17 +299,14 @@ def adjust_label_pos(self):
290299 else :
291300 self .label_3 .setIndent (28 - (77 - text_length ) * 7 )
292301
302+ def list_pid (self , state ):
303+ self .islistpidchecked = state == Qt .CheckState .Checked .value
304+
293305 def remote_attach (self , state ):
294- if state == Qt .CheckState .Checked .value :
295- self .isremoteattachchecked = True
296- else :
297- self .isremoteattachchecked = False
306+ self .isremoteattachchecked = state == Qt .CheckState .Checked .value
298307
299308 def spawn_mode (self , state ):
300- if state == Qt .CheckState .Checked .value :
301- self .isspawnchecked = True
302- else :
303- self .isspawnchecked = False
309+ self .isspawnchecked = state == Qt .CheckState .Checked .value
304310
305311 def attach_frida (self ):
306312 if globvar .isFridaAttached is True :
@@ -314,10 +320,18 @@ def attach_frida(self):
314320 return
315321
316322 try :
317- if self .isspawnchecked and self .spawntargetid is None :
323+ if (self .islistpidchecked and not self .isspawnchecked and self .attachtargetname is None ) or \
324+ (self .isspawnchecked and self .spawntargetid is None ):
318325 self .spawndialog = spawn .SpawnDialogClass () if (
319326 platform .system () == 'Darwin' ) else spawn_win .SpawnDialogClass ()
320- self .spawndialog .spawntargetidsig .connect (self .spawntargetsig_func )
327+ if self .islistpidchecked and not self .isspawnchecked :
328+ self .spawndialog .ispidlistchecked = True
329+ self .spawndialog .spawnui .spawnTargetIdInput .setPlaceholderText ("AppStore" )
330+ self .spawndialog .spawnui .appListLabel .setText ("PID Name" )
331+ self .spawndialog .spawnui .spawnBtn .setText ("Attach" )
332+ self .spawndialog .attachtargetnamesig .connect (self .targetsig_func )
333+
334+ self .spawndialog .spawntargetidsig .connect (self .targetsig_func )
321335
322336 if self .isremoteattachchecked is False :
323337 self .spawndialog .spawnui .remoteAddrInput .setEnabled (False )
@@ -332,7 +346,8 @@ def attach_frida(self):
332346 return
333347
334348 globvar .fridaInstrument = code .Instrument ("scripts/default.js" , self .isremoteattachchecked , self .remoteaddr ,
335- self .spawntargetid )
349+ self .attachtargetname if (self .islistpidchecked and not self .isspawnchecked ) else self .spawntargetid ,
350+ self .isspawnchecked )
336351 msg = globvar .fridaInstrument .instrument ()
337352 self .remoteaddr = ''
338353 except Exception as e :
@@ -348,6 +363,7 @@ def attach_frida(self):
348363
349364 self .platform = globvar .fridaInstrument .platform ()
350365 name = globvar .fridaInstrument .list_modules ()[0 ]['name' ]
366+ self .attachedname = name
351367 self .set_status (name )
352368
353369 def detach_frida (self ):
@@ -889,36 +905,23 @@ def search_mem_search_result(self):
889905 self .memSearchFoundCount .setText (str (len (searchresult )) + ' found' )
890906
891907 def mem_search_with_img_checkbox (self , state ):
892- if state == Qt .CheckState .Checked .value :
893- self .ismemsearchwithimgchecked = True
894- self .memSearchTargetImgInput .setEnabled (True )
895- else :
896- self .ismemsearchwithimgchecked = False
897- self .memSearchTargetImgInput .setEnabled (False )
908+ isChecked = state == Qt .CheckState .Checked .value
909+ self .ismemsearchwithimgchecked = isChecked
910+ self .memSearchTargetImgInput .setEnabled (isChecked )
898911
899912 def mem_scan_pattern_checkbox (self , state ):
900- if state == Qt .CheckState .Checked .value :
901- self .ismemscanstrchecked = True
902- else :
903- self .ismemscanstrchecked = False
913+ self .ismemscanstrchecked = state == Qt .CheckState .Checked .value
904914
905915 def mem_search_replace_checkbox (self , state ):
906- if state == Qt .CheckState .Checked .value :
907- self .memReplaceBtn .setEnabled (True )
908- self .memReplacePattern .setEnabled (True )
909- self .ismemsearchreplacechecked = True
910- else :
911- self .memReplaceBtn .setEnabled (False )
912- self .memReplacePattern .setEnabled (False )
913- self .ismemsearchreplacechecked = False
916+ isChecked = state == Qt .CheckState .Checked .value
917+ self .memReplaceBtn .setEnabled (isChecked )
918+ self .memReplacePattern .setEnabled (isChecked )
919+ self .ismemsearchreplacechecked = isChecked
914920
915921 def il2cpp_checkbox (self , state ):
916- if state == Qt .CheckState .Checked .value :
917- self .isil2cppchecked = True
918- self .memDumpModuleName .setEnabled (False )
919- else :
920- self .isil2cppchecked = False
921- self .memDumpModuleName .setEnabled (True )
922+ isChecked = state == Qt .CheckState .Checked .value
923+ self .isil2cppchecked = isChecked
924+ self .memDumpModuleName .setEnabled (not isChecked )
922925
923926 def dump_module (self ):
924927 # il2cpp dump
@@ -938,7 +941,7 @@ def dump_module(self):
938941 # print("[hackcatml] il2cppFridaInstrument: ", self.il2cppFridaInstrument)
939942 if self .il2cppFridaInstrument is None or len (self .il2cppFridaInstrument .sessions ) == 0 :
940943 self .il2cppFridaInstrument = code .Instrument ("scripts/il2cppdump.js" , self .isremoteattachchecked ,
941- globvar .fridaInstrument .remoteaddr , None )
944+ globvar .fridaInstrument .remoteaddr , self . attachedname , False )
942945 msg = self .il2cppFridaInstrument .instrument ()
943946 if msg is not None :
944947 QMessageBox .information (self , "info" , msg )
0 commit comments