-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathbuild.py
executable file
·89 lines (64 loc) · 1.96 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python3
import os
import subprocess
import click
@click.group()
def cli():
pass
@click.command()
@click.option(
"--hexrays_sdk",
"hexrays_sdk",
type=str,
default=str(),
help="path to hexrays_sdk directory",
)
@click.argument("idasdk")
def build_plugin(idasdk: str, hexrays_sdk: str):
"""Build efiXplorer plugin"""
os.chdir("efiXplorer")
if not os.path.isdir("build"):
os.mkdir("build")
os.chdir("build")
command = ["cmake", "..", f"-DIdaSdk_ROOT_DIR={idasdk}"]
if hexrays_sdk:
print("[INFO] HexRays analysis will be enabled")
command.append(f"-DHexRaysSdk_ROOT_DIR={hexrays_sdk}")
subprocess.call(command)
subprocess.call(["cmake", "--build", ".", "--config", "Release", "--parallel"])
@click.command()
@click.argument("idasdk")
def build_loader(idasdk: str):
"""Build efiXloader"""
os.chdir("efiXloader")
if not os.path.isdir("build"):
os.mkdir("build")
os.chdir("build")
command = ["cmake", "..", f"-DIdaSdk_ROOT_DIR={idasdk}"]
subprocess.call(command)
subprocess.call(["cmake", "--build", ".", "--config", "Release", "--parallel"])
@click.command()
@click.option(
"--hexrays_sdk",
"hexrays_sdk",
type=str,
default=str(),
help="path to hexrays_sdk directory",
)
@click.argument("idasdk")
def build_everything(idasdk: str, hexrays_sdk: str):
"""Build plugin (efiXplorer) and loader (efiXloader)"""
if not os.path.isdir("build"):
os.mkdir("build")
os.chdir("build")
command = ["cmake", "..", f"-DIdaSdk_ROOT_DIR={idasdk}"]
if hexrays_sdk:
print("[INFO] HexRays analysis will be enabled")
command.append(f"-DHexRaysSdk_ROOT_DIR={hexrays_sdk}")
subprocess.call(command)
subprocess.call(["cmake", "--build", ".", "--config", "Release", "--parallel"])
cli.add_command(build_plugin)
cli.add_command(build_loader)
cli.add_command(build_everything)
if __name__ == "__main__":
cli()