-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
196 lines (141 loc) · 4.7 KB
/
Makefile
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
USER := $(shell whoami)
PROJ := owtf
PYTHON := python3
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
VENV_PATH := ${HOME}/.virtualenvs/${PROJ}
SHELL := /bin/bash
.PHONY: venv setup web docs lint clean bump build release
check-root:
ifeq ($(USER), root)
@echo "WARNING: Installing as root should be avoided at all costs. Use a virtualenv."
endif
clean-pyc:
-find . -type f -a \( -name "*.pyc" -o -name "*$$py.class" \) | xargs rm -rf
-find . -type d -name "__pycache__" | xargs rm -rf
clean-build:
rm -rf build/ dist/ .eggs/ *.egg-info/ .tox/ .coverage cover/
### INSTALL
install-dependencies:
@echo "--> Installing Kali dependencies"
sudo apt-get update
sudo apt-get install -y python3 git
sudo apt-get install -y xvfb xserver-xephyr libxml2-dev libxslt-dev libssl-dev zlib1g-dev gcc python-all-dev \
python3-pip postgresql-server-dev-all postgresql-client postgresql-client-common postgresql \
libcurl4-openssl-dev proxychains tor libffi-dev golang-go
opt-tools:
sudo apt-get install -y lbd gnutls-bin o-saft metagoofil lbd \
theharvester tlssled nikto dnsrecon nmap whatweb skipfish dirbuster metasploit-framework \
wpscan wapiti hydra metagoofil o-saft
venv:
@echo "Installing the virtualenv for OWTF"
rm -rf $(VENV_PATH)
$(PYTHON) -m venv $(VENV_PATH) --clear
activate-virtualenv:
chmod +x $(VENV_PATH)/bin/activate
bash -c "$(VENV_PATH)/bin/activate"
setup: install-dependencies venv activate-virtualenv install-requirements
### REQUIREMENTS
install-python-requirements: setup.py check-root
@echo "--> Installing Python development dependencies."
pip3 install setuptools
for f in `ls requirements/` ; do pip3 install -r requirements/$$f ; done
install-ui-requirements:
@echo "--> Installing Node development dependencies."
cd owtf/webapp && yarn
install-docs-requirements:
@echo "--> Installing Sphinx dependencies"
pip3 install sphinx sphinx_rtd_theme
install-requirements: install-python-requirements install-ui-requirements install-docs-requirements
web:
ifdef OWTF_ENV
cd owtf/webapp && yarn run ${OWTF_ENV}
else
@echo "--> No environment specified. Usage: make OWTF_ENV={dev, prod} web"
endif
post-install:
@echo "--> Installing dictionaries and tools"
python3 scripts/install_tools.py
### DOCS
docs:
@echo "--> Building docs"
cd docs/ && make html
### DOCKER
docker-build:
@echo "--> Building the docker image for develop"
docker build -t owtf/owtf -f docker/Dockerfile .
docker-run:
@echo "--> Running the Docker development image"
docker run -it -p 8009:8009 -p 8008:8008 -p 8010:8010 -v $(current_dir):/owtf owtf/owtf /bin/bash
compose:
@echo "--> Running the Docker Compose setup"
docker-compose -f docker/docker-compose.dev.yml up
### DEBIAN PACKAGING
build-debian:
@echo "--> Building the Debian package"
dpkg-buildpackage -us -uc -d
### LINT
lint-py:
@echo "--> Linting Python files."
pep8 owtf tests # settings in setup.cfg
lint-js:
@echo "--> Linting JavaScript files."
cd owtf/webapp && yarn lint
lint: lint-py lint-js
### TEST
test-py: clean-py
@echo "--> Running Python tests (see test.log for output)."
py.test | tee test.log # settings in pytest.ini
test: test-py
tox: clean-py
@echo "--> Running tox."
tox "$@"
coverage-py: clean-py
@echo "--> Running Python tests with coverage (see test.log and htmlcov/ for output)."
py.test --cov-report html --cov=owtf | tee test.log # settings in pytest.ini
### CLEAN
clean-py:
@echo "--> Removing Python bytecode files."
find . -name '__pycache__' -exec rm -rf {} \; # Python 3
find . -name '*.py[co]' -exec rm -rf {} \; # Python 2
clean-js:
@echo "--> Removing JavaScript build output."
rm -rf owtf/webapp/build
clean-logs:
@echo "--> Cleaning the logs and review folders"
rm -rf owtf_review/ scans/
clean: clean-py clean-js clean-logs
### DISTCLEAN
distclean-py: clean-py
@echo "--> Removing egg-info directory."
rm -rf owtf.egg-info
rm -rf build/
rm -rf dist/
distclean-js:
@echo "--> Removing node modules."
rm -rf owtf/webapp/node_modules
distclean: distclean-py distclean-js
## MAINTAINERS
rollback:
git reset --hard HEAD~1
git tag -d `git describe --tags --abbrev=0`
bump:
bumpversion patch && \
echo -n "Now on version: " && \
git describe --tags
bump-minor:
bumpversion minor && \
echo -n "Now on version: " && \
git describe --tags
bump-major:
bumpversion major && \
echo -n "Now on version: " && \
git describe --tags
release:
python setup.py register sdist bdist_wheel upload
build:
$(PYTHON) setup.py sdist bdist_wheel
startdb:
docker-compose -p $(PROJ) -f docker/docker-compose.yml up -d --no-recreate
stopdb:
docker-compose -p $(PROJ) -f docker/docker-compose.yml down