-
Notifications
You must be signed in to change notification settings - Fork 14
/
install.py
114 lines (93 loc) · 3.61 KB
/
install.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import requests
import shutil
import subprocess
import find_ida_user_dir
from brick.logger import log_operation, log_step
from collections import namedtuple
from pathlib import Path
import os
import shutil
DependencyDescriptor = namedtuple('DependencyDescriptor', ['name', 'source', 'target'])
def download_file(url, local_path):
log_operation(f'Downloading {url} into {local_path}')
dirname = os.path.dirname(local_path)
if dirname and not os.path.exists(dirname):
os.makedirs(dirname)
r = requests.get(url)
open(local_path, 'wb').write(r.content)
def install_dependency(dep: DependencyDescriptor):
log_operation(f'Installing {dep.name} into {dep.target}')
if not dep.target.parent.exists():
# Create intermediate directories, if necessary.
os.makedirs(dep.target.parent)
shutil.copy(dep.source, dep.target)
def install_ida_plugins():
plugins_dir = Path(find_ida_user_dir.find_path('plugins'))
deps_dir = Path(__file__).parent / 'deps'
DEPENDENCIES = {
# Codatify.
# See https://github.com/tacnetsol/ida/tree/master/plugins for more details.
DependencyDescriptor(
'codatify',
deps_dir / 'codatify.py',
plugins_dir / 'codatify.py'),
# Rizzo.
# See https://github.com/tacnetsol/ida/tree/master/plugins for more details.
DependencyDescriptor(
'rizzo',
deps_dir / 'rizzo.py',
plugins_dir / 'rizzo.py'),
# AlleyCat
# See https://github.com/tacnetsol/ida/tree/master/plugins for more details.
DependencyDescriptor(
'alleycat',
deps_dir / 'alleycat.py',
plugins_dir / 'alleycat.py'),
# IDA shims
# See https://github.com/tacnetsol/ida/tree/master/plugins for more details.
DependencyDescriptor(
'shims',
deps_dir / 'ida_shims.py',
plugins_dir / 'shims' / 'ida_shims.py'),
# HexRaysCodeXplorer
# See https://github.com/REhints/HexRaysCodeXplorer for more details.
DependencyDescriptor(
'HexRaysCodeXplorer',
deps_dir / 'HexRaysCodeXplorer' / 'HexRaysCodeXplorer.dll',
plugins_dir / 'HexRaysCodeXplorer.dll'),
DependencyDescriptor(
'HexRaysCodeXplorer64',
deps_dir / 'HexRaysCodeXplorer' / 'HexRaysCodeXplorer64.dll',
plugins_dir / 'HexRaysCodeXplorer64.dll'),
# efiXplorer
# See https://github.com/binarly-io/efiXplorer for more details.
DependencyDescriptor(
'efiXplorer',
deps_dir / 'efiXplorer' / 'efiXplorer.dll',
plugins_dir / 'efiXplorer.dll'),
DependencyDescriptor(
'efiXplorer64',
deps_dir / 'efiXplorer' / 'efiXplorer64.dll',
plugins_dir / 'efiXplorer64.dll'),
}
for dep in DEPENDENCIES:
install_dependency(dep)
def install_bip():
try:
bip_url = 'https://github.com/synacktiv/bip/archive/refs/heads/develop.zip'
download_file(bip_url, 'bip-develop.zip')
log_operation('Unpacking Bip')
shutil.unpack_archive('bip-develop.zip')
log_operation('Installing Bip')
subprocess.check_call('python bip-develop/install.py')
finally:
log_operation('Removing temporary Bip files')
os.remove('bip-develop.zip')
shutil.rmtree('bip-develop')
def main():
with log_step('Installing Bip'):
install_bip()
with log_step('Installing IDA plugins'):
install_ida_plugins()
if __name__ == '__main__':
main()