diff --git a/DOCKER.md b/DOCKER.md new file mode 100644 index 0000000..59c527f --- /dev/null +++ b/DOCKER.md @@ -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 +``` diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..10d5c5d --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/README.md b/README.md index c9304a2..a5ad713 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/conf/mysqld_events.cnf b/conf/mysqld_events.cnf new file mode 100644 index 0000000..777f542 --- /dev/null +++ b/conf/mysqld_events.cnf @@ -0,0 +1,2 @@ +[mysqld] +event_scheduler=ON \ No newline at end of file diff --git a/db/wpa-data.sql b/db/wpa-data.sql deleted file mode 100644 index 71592aa..0000000 --- a/db/wpa-data.sql +++ /dev/null @@ -1,28 +0,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'); diff --git a/db/wpa.sql b/db/wpa.sql index dbdf553..95c9544 100644 --- a/db/wpa.sql +++ b/db/wpa.sql @@ -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'); diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7fbe166 --- /dev/null +++ b/docker-compose.yml @@ -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: \ No newline at end of file diff --git a/misc/rkg.cron b/misc/rkg.cron index 88dd29d..c59463e 100644 --- a/misc/rkg.cron +++ b/misc/rkg.cron @@ -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 diff --git a/misc/services.conf b/misc/services.conf new file mode 100644 index 0000000..e915afc --- /dev/null +++ b/misc/services.conf @@ -0,0 +1,9 @@ +[supervisord] +nodaemon=true +user=root + +[program:apache] +command=/usr/local/bin/apache2-foreground + +[program:cron] +command=/usr/sbin/cron -f \ No newline at end of file diff --git a/web/conf.php b/web/conf.php index 80ac1cb..ce8c93d 100644 --- a/web/conf.php +++ b/web/conf.php @@ -1,9 +1,9 @@