def
monitor_thread(
self
):
while
True
:
thread_list
=
[]
time.sleep(
30
)
for
thread
in
threading.
enumerate
():
thread_list.append(thread.getName())
thread_error_status
=
self
.redis_client.hget(
"frida_app_error"
, thread.getName())
if
thread_error_status:
thread_error_status
=
thread_error_status.decode()
else
:
time.sleep(
3
)
continue
time.sleep(
2
)
if
thread_error_status
=
=
'1'
:
exctype
=
SystemExit
tid
=
ctypes.c_long(thread.ident)
if
not
inspect.isclass(exctype):
exctype
=
type
(exctype)
res
=
ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype))
if
res
=
=
0
:
raise
ValueError(
"invalid thread id"
)
elif
res !
=
1
:
ctypes.pythonapi.PyThreadState_SetAsyncExc(tid,
None
)
raise
SystemError(
"PyThreadState_SetAsyncExc failed"
)
pass
time.sleep(
5
)
run_device
=
self
.redis_client.hget(
"frida_device_name_ip_hash"
, thread.getName()).decode()
thread_i
=
myThread(thread.getName(), thread.ident, run_device)
thread_i.start()
thread_i.join()
time.sleep(
5
)