Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker support #61

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions DOCKER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Docker

Setup requirements:

1. Configured web server proxypass to port 8000
2. Domain pointing to your web server
3. Let's Encrypt configured to your domain

Note: For testing you can still run the container and access dwpa at port 8000

Clone repository

```
git clone https://github.com/kbeflo/dwpa
```

Download and generate wordlists at `dwpa/misc`

```
wget rockyou.txt
./create_gz.sh
set url https://example.com/dict/
```

Move `*.txt.gz` to `dwpa/web/dict`

Change `help_crack.py` `base_url`

Move `CHANGELOG`, `help_crack.py` and `help_crack.py.version` to `web/hc`

Configure `reCAPTCHA`, `bosskey`, `3wifi` and `wigle` keys at `dwpa/web/conf.php`

Build image and start container

```
docker-compose build
docker-compose up
```

Import `dict.sql` generated by `./create_gz.sh` at `dwpa/misc`

```
docker exec -i dwpa_db_1 mysql -uwpa -pwpapass wpa -v < dict.sql
```
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM php:7.2.30-apache-buster
RUN docker-php-ext-install mysqli

RUN apt-get update
RUN apt-get install -y build-essential cron git qt5-default libssl-dev zlib1g-dev libcurl4-openssl-dev supervisor

COPY misc/services.conf /etc/supervisor/conf.d

COPY --chown=1000:crontab misc/rkg.cron /var/spool/cron/crontabs/www-data
RUN /bin/bash -c 'chmod 0600 /var/spool/cron/crontabs/www-data'

RUN usermod -u 1000 www-data

WORKDIR /tools
RUN mkdir /tools/bin

RUN git clone https://github.com/routerkeygen/routerkeygenPC
WORKDIR /tools/routerkeygenPC/cli
RUN qmake
RUN make
RUN cp -v /tools/routerkeygenPC/cli/routerkeygen-cli /tools/bin

WORKDIR /tools
RUN git clone https://github.com/ZerBea/hcxtools
WORKDIR /tools/hcxtools
RUN make
RUN cp -v /tools/hcxtools/hcxpcaptool /tools/bin
WORKDIR /tools/bin

RUN rm -rf /tools/routerkeygenPC
RUN rm -rf /tools/hcxtools

CMD ["/usr/bin/supervisord"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ Live installation:
https://wpa-sec.stanev.org

To install dwpa on your server, please refer to [INSTALL.md](INSTALL.md)

Quickstart with [Docker](DOCKER.md)
2 changes: 2 additions & 0 deletions conf/mysqld_events.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mysqld]
event_scheduler=ON
28 changes: 0 additions & 28 deletions db/wpa-data.sql

This file was deleted.

28 changes: 28 additions & 0 deletions db/wpa.sql
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,31 @@ UPDATE stats SET pvalue=(SELECT count(1) FROM bssids WHERE lat IS NOT NULL) WHER
END$$

CREATE EVENT `e_cleanup_n2d` ON SCHEDULE EVERY 1 HOUR ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM n2d WHERE hkey IS NOT NULL AND TIMESTAMPDIFF(DAY, ts, CURRENT_TIMESTAMP) > 0$$
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `wpa`
--

--
-- Dumping data for table `stats`
--

INSERT INTO `stats` (`pname`, `pvalue`) VALUES
('nets', '0'),
('nets_unc', '0'),
('cracked', '0'),
('cracked_unc', '0'),
('cracked_rkg', '0'),
('cracked_rkg_unc', '0'),
('cracked_pmkid', '0'),
('cracked_pmkid_unc', '0'),
('pmkid', '0'),
('pmkid_unc', '0'),
('24getwork', '0'),
('24psk', '0'),
('24sub', '0'),
('24founds', '0'),
('words', '0'),
('triedwords', '0'),
('wigle_found', '0');
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: "3.3"
services:
www:
build: .
ports:
- "8000:80"
volumes:
- ./web:/var/www/html
links:
- db
networks:
- default

db:
image: mysql:8.0
ports:
- "3306:3306"
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_DATABASE: wpa
MYSQL_USER: wpa
MYSQL_PASSWORD: wpapass
MYSQL_ROOT_PASSWORD: wpapass
volumes:
- ./db:/docker-entrypoint-initdb.d
- ./conf:/etc/mysql/conf.d
- dwpa:/var/lib/mysql
networks:
- default

volumes:
dwpa:
3 changes: 1 addition & 2 deletions misc/rkg.cron
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# This is cron entry every 5 minutes for rkg.php. You have to adjust your path.
*/5 * * * * www-data cd /var/www/wpa-sec && /usr/bin/flock -n /tmp/rkg.php.lock /usr/bin/php rkg.php

* * * * * cd /var/www/html && /usr/bin/flock -n /tmp/rkg.php.lock /usr/local/bin/php rkg.php
9 changes: 9 additions & 0 deletions misc/services.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[supervisord]
nodaemon=true
user=root

[program:apache]
command=/usr/local/bin/apache2-foreground

[program:cron]
command=/usr/sbin/cron -f
16 changes: 8 additions & 8 deletions web/conf.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
// DB Configuration
$cfg_db_host = '';
$cfg_db_user = '';
$cfg_db_pass = '';
$cfg_db_name = '';
$cfg_db_host = 'db';
$cfg_db_user = 'wpa';
$cfg_db_pass = 'wpapass';
$cfg_db_name = 'wpa';

// reCaptcha auth
$publickey = '';
Expand All @@ -19,11 +19,11 @@
$wigleapikey = '';

// App specific defines
define('HCXPCAPTOOL', '/var/www/wpa-sec/cap/hcxpcaptool');
define('RKG', '/var/www/wpa-sec/cap/routerkeygen-cli');
define('HCXPCAPTOOL', '/tools/bin/hcxpcaptool');
define('RKG', '/tools/bin/routerkeygen-cli');

define('CAP', '/var/www/wpa-sec/cap/');
define('CRACKED', '/var/www/wpa-sec/dict/cracked.txt.gz');
define('CAP', '/var/www/html/cap/');
define('CRACKED', '/var/www/html/dict/cracked.txt.gz');
if (is_dir('/run/shm'))
define('SHM', '/run/shm/');
elseif (is_dir('/dev/shm'))
Expand Down