XACT_DEPS
=
{
"frida-java-bridge"
:
"6.2.3"
,
"frida-objc-bridge"
:
"7.0.2"
,
"frida-swift-bridge"
:
"2.0.6"
}
def
generate_runtime(backends, arch, endian, input_dir, gum_dir, capstone_incdir, libtcc_incdir, quickcompile, output_dir):
frida_compile
=
output_dir
/
"node_modules"
/
".bin"
/
make_script_filename(
"frida-compile"
)
if
not
frida_compile.exists():
pkg_files
=
[output_dir
/
"package.json"
, output_dir
/
"package-lock.json"
]
for
f
in
pkg_files:
if
f.exists():
f.unlink()
(output_dir
/
"tsconfig.json"
).write_text(
"{ \"files\": [], \"compilerOptions\": { \"typeRoots\": [] } }"
, encoding
=
"utf-8"
)
node_modules
=
output_dir
/
"node_modules"
if
node_modules.exists():
shutil.rmtree(node_modules)
npm
=
os.environ.get(
"NPM"
, make_script_filename(
"npm"
))
try
:
subprocess.run([npm,
"init"
,
"-y"
],
capture_output
=
True
,
cwd
=
output_dir,
check
=
True
)
subprocess.run([npm,
"install"
]
+
[f
"{name}@{version_spec}"
for
name, version_spec
in
RELAXED_DEPS.items()],
capture_output
=
True
,
cwd
=
output_dir,
check
=
True
)
subprocess.run([npm,
"install"
,
"-E"
]
+
[f
"{name}@{version_spec}"
for
name, version_spec
in
EXACT_DEPS.items()],
capture_output
=
True
,
cwd
=
output_dir,
check
=
True
) <
=
=
=
=
=
=
=
=
=
这里下载了EXACT_DEPS里面的依赖项