-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_volatility.yaml
200 lines (178 loc) · 5.35 KB
/
install_volatility.yaml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
---
# Inspired by: https://seanthegeek.net/1172/how-to-install-volatility-2-and-volatility-3-on-debian-ubuntu-or-kali-linux/
# Variables:
# venv_path (str): the path where vol.py and volatility virtualenv will be created. Default: $HOME
# install_path (str): the path where vol.py and volatility script symlinks will be created. Default: $HOME/.local/bin
- hosts: localhost
become: yes
gather_facts: no
connection: local
tasks:
- name: Install system dependencies for volatility 2
tags: [vol2]
ansible.builtin.apt:
update_cache: yes
state: present
name:
- build-essential
- libdistorm3-dev
- yara
- libyara-dev
- libraw1394-11
- libcapstone-dev
- capstone-tool
- tzdata
- python2-pip-whl
- python2-setuptools-whl
- virtualenv
- name: Install system dependencies for volatility 3
tags: [vol3]
ansible.builtin.apt:
update_cache: no
state: present
name:
- python3
- python3-dev
- libpython3-dev
- python3-setuptools
- python3-wheel
- python3-virtualenv
- hosts: localhost
become: no
gather_facts: no
connection: local
vars:
venv_path: "{{ lookup('ansible.builtin.env', 'HOME') }}"
install_path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.local/bin"
tasks:
- name: Ensure install_path is a directory
tags: [vol2, vol3]
ansible.builtin.file:
path: "{{ install_path }}"
state: directory
- name: Install volatility 2
tags: [vol2]
block:
- name: Setup volatility 2 virtual env
ansible.builtin.pip:
virtualenv: "{{ venv_path }}/volatility2"
virtualenv_command: virtualenv
virtualenv_python: python2.7
state: present
name:
- pip
- setuptools
- wheel
- name: Install volatility 2 requirements
ansible.builtin.pip:
virtualenv: "{{ venv_path }}/volatility2"
state: present
name:
- distorm3
- yara
- pycrypto
- pillow
- openpyxl
- ujson
- pytz
- ipython
- capstone
- yara
- name: Find libyara.so
ansible.builtin.find:
path: "{{ venv_path }}/volatility2"
file_type: file
recurse: yes
use_regex: yes
patterns: "^libyara.so$"
register: libyara_path
- name: Assert that we found libyara.so
ansible.builtin.assert:
that: libyara_path.matched > 0
fail_msg: "'libyara.so' was not found in {{ venv_path }}/volatility2"
- name: Symlink to libyara.so
ansible.builtin.file:
src: "{{ libyara_path.files[0].path }}"
dest: "{{ venv_path }}/volatility2/lib/libyara.so"
state: link
- name: Install volatility 2
ansible.builtin.pip:
virtualenv: "{{ venv_path }}/volatility2"
state: present
name: git+https://github.com/volatilityfoundation/volatility.git
- name: "Link volatility 2 in '{{ install_path }}'"
ansible.builtin.file:
src: "{{ venv_path }}/volatility2/bin/vol.py"
dest: "{{ install_path }}/vol2"
state: link
- name: Install volatility 3
tags: [vol3]
block:
- name: Setup volatility 3 virtual env
ansible.builtin.pip:
virtualenv: "{{ venv_path }}/volatility3"
virtualenv_command: python3 -m venv
state: present
name:
- pip
- setuptools
- wheel
- name: Install volatility 3 requirements
ansible.builtin.pip:
virtualenv: "{{ venv_path }}/volatility3"
state: present
name:
- distorm3
- yara
- pycrypto
- pillow
- openpyxl
- ujson
- pytz
- ipython
- capstone
- name: Find libyara.so
ansible.builtin.find:
path: "{{ venv_path }}/volatility2"
file_type: file
recurse: yes
use_regex: yes
patterns: "^libyara.so$"
register: libyara_path
- name: Assert that we found libyara.so
ansible.builtin.assert:
that: libyara_path.matched > 0
fail_msg: "'libyara.so' was not found in {{ venv_path }}/volatility2"
- name: Symlink to libyara.so
ansible.builtin.file:
src: "{{ libyara_path.files[0].path }}"
dest: "{{ venv_path }}/volatility3/lib/libyara.so"
state: link
- name: Install volatility 3
ansible.builtin.pip:
virtualenv: "{{ venv_path }}/volatility3"
state: present
name: git+https://github.com/volatilityfoundation/volatility3.git
- name: "Link volatility 3 in '{{ install_path }}'"
ansible.builtin.file:
src: "{{ venv_path }}/volatility3/bin/vol"
dest: "{{ install_path }}/vol3"
state: link
- name: "Link volshell in '{{ install_path }}'"
ansible.builtin.file:
src: "{{ venv_path }}/volatility3/bin/volshell"
dest: "{{ install_path }}/volshell"
state: link
- name: Recap
tags: [vol2]
ansible.builtin.debug:
msg: You can run volatility 2 by running vol2!
- name: Recap
tags: [vol3]
ansible.builtin.debug:
msg:
- You can run volatility 3 by running vol3!
- You can run volshell by simply running volshell!
- name: Recap
ansible.builtin.debug:
msg: "If you have a 'command not found' error, make sure '{{ install_path }}' is in your PATH!"