MCPcopy Create free account
hub / github.com/SySS-Research/hallucinate / java_attach_runtime

Function java_attach_runtime

hallucinate/java.py:113–134  ·  view source on GitHub ↗
(pid, h, args)

Source from the content-addressed store, hash-verified

111
112
113def java_attach_runtime(pid, h, args):
114 global _javaserver, _agentcfg
115 if _javaserver is not None:
116 logging.warning("Java server can only be initialized once")
117 return
118 logging.info('Java process detected, starting server')
119 s, key, host, port = start_server(h, host=args.javaagenthost, port=args.javaagentport, key=args.javaagentkey)
120 debug = ''
121 if args.verbose > 1:
122 debug = 'debug;'
123 _agentcfg = '%sserverport=%d;serveraddr=%s;serverkey=%s' % (debug, port, host, key)
124 # need to resume, otherwise attach fails
125 try:
126 frida.resume(pid)
127 except frida.InvalidArgumentError as e:
128 logging.debug('Failed to resume process', exc_info=e)
129 pass
130 _javaserver = s
131 logging.info('Attaching to target process %d with args %s', pid, _agentcfg)
132 java_attach(pid, _agentcfg,
133 java=args.javavm,
134 agentjar=args.agentjar)
135
136
137def java_attach_startup(cmdline, h, args):

Callers 1

java_detectedFunction · 0.90

Calls 2

start_serverFunction · 0.85
java_attachFunction · 0.85

Tested by

no test coverage detected