Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- login as: pi
- pi@172.16.0.26's password:
- The programs included with the Debian GNU/Linux system are free software;
- the exact distribution terms for each program are described in the
- individual files in /usr/share/doc/*/copyright.
- Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
- permitted by applicable law.
- Last login: Wed Apr 19 17:34:37 2017 from 172.16.0.2
- SSH is enabled and the default password for the 'pi' user has not been changed.
- This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
- pi@raspberrypi:~ $ cd /var/www/html/admin
- pi@raspberrypi:/var/www/html/admin $ git show
- commit 1355e6a42ce5706e0ddadcedf4b42fd92a633496
- commit 1355e6a42ce5706e0ddadcedf4b42fd92a633496
- commit 1355e6a42ce5706e0ddadcedf4b42fd92a633496
- Author: Adam Warner <PromoFaux@users.noreply.github.com>
- Date: Tue Mar 14 13:17:18 2017 +0000
- Merge pull request #443 from pi-hole/fix/teleporter
- Bugfix: Teleporter Export feature
- diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
- new file mode 100644
- index 0000000..6f277b2
- --- /dev/null
- +++ b/.github/ISSUE_TEMPLATE.md
- @@ -0,0 +1,33 @@
- +**In raising this issue, I confirm the following (please check boxes, eg [X] - no spaces) Failure to fill the template will close your issue:**
- +
- +- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md).
- +- [] The issue I am reporting can be *replicated*
- +- [] The issue I'm reporting isn't a duplicate (see [FAQs](https://github.com/pi-hole/pi-hole/wiki/FAQs), [closed issues](https://github.com/pi-hole/pi-hole/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), and [open issues](https://github.com/pi-hole/pi-hole/issues)).
- +
- +**How familiar are you with the codebase?:**
- +
- +_{replace this text with a number from 1 to 10, with 1 being not familiar, and 10 being very familiar}_
- +
- +---
- +**[FEATURE REQUEST | QUESTION | OTHER]:**
- +
- +Please [submit your feature request here](https://discourse.pi-hole.net/c/feature-requests), so it is votable by the community. It's also easier for us to track.
- +
- +**[BUG | ISSUE] Expected Behaviour:**
- +
- +
- +**[BUG | ISSUE] Actual Behaviour:**
- +
- +
- +**[BUG | ISSUE] Steps to reproduce:**
- +
- +-
- +-
- +-
- +-
- +
- +**(Optional) Debug token generated by `pihole -d`:**
- +
- +`<token>`
- +
- +_This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
- new file mode 100644
- index 0000000..2c39142
- --- /dev/null
- +++ b/.github/PULL_REQUEST_TEMPLATE.md
- @@ -0,0 +1,19 @@
- +**By submitting this pull request, I confirm the following (please check boxes, eg [X] - no spaces) _Failure to fill the template will close your PR_:**
- +
- +***Please submit all pull requests against the `development` branch. Failure to do so will delay or deny your request***
- +
- +- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md).
- +- [] I have checked that [another pull request](https://github.com/pi-hole/pi-hole/pulls) for this purpose does not exist.
- +- [] I have considered, and confirmed that this submission will be valuable to others.
- +- [] I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
- +- [] I give this submission freely, and claim no ownership to its content.
- +
- +**How familiar are you with the codebase?:**
- +
- +_{replace this text with a number from 1 to 10, with 1 being not familiar, and 10 being very familiar}_
- +
- +---
- +_{replace this line with your pull request content}_
- +
- +
- +_This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
- diff --git a/.gitignore b/.gitignore
- new file mode 100644
- index 0000000..a4c3ecb
- --- /dev/null
- +++ b/.gitignore
- @@ -0,0 +1,17 @@
- +*.DS_Store
- +.idea
- +/nbproject/private/
- +/nbproject/
- +/node_modules/
- +TODO
- +*.zip
- +test.html
- +*.log
- +
- +# Intellij IDEA Project Files
- +*.iml
- +*.ipr
- +*.iws
- +
- +# vim
- +*.swp
- diff --git a/.pullapprove.yml b/.pullapprove.yml
- new file mode 100644
- index 0000000..8bd8f0a
- --- /dev/null
- +++ b/.pullapprove.yml
- @@ -0,0 +1,38 @@
- +version: 2
- +
- +always_pending:
- + title_regex: '(WIP|wip)'
- + labels:
- + - wip
- + explanation: 'This PR is a work in progress...'
- +
- +group_defaults:
- + reset_on_push:
- + enabled: true
- + reject_value: -2
- + approve_regex: '^(Approved|:shipit:|:\+1:|Engage)'
- + reject_regex: '^(Rejected|:-1:|Borg)'
- + author_approval:
- + auto: true
- +
- +
- +groups:
- + development:
- + approve_by_comment:
- + enabled: true
- + conditions:
- + branches:
- + - devel
- + required: 2
- + teams:
- + - approvers
- +
- + master:
- + approve_by_comment:
- + enabled: true
- + conditions:
- + branches:
- + - master
- + required: -1
- + teams:
- + - admin
- diff --git a/.user.php.ini b/.user.php.ini
- new file mode 100644
- index 0000000..7660f85
- --- /dev/null
- +++ b/.user.php.ini
- @@ -0,0 +1,2 @@
- +memory_limit = 256M
- +max_execution_time = 300
- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
- new file mode 100644
- index 0000000..64e702f
- --- /dev/null
- +++ b/CONTRIBUTING.md
- @@ -0,0 +1,9 @@
- +This is a basic checklist for now, We will update it in the future.
- +
- +* Fork the repo and create your new branch based on the `devel` (development) branch.
- +* Use 4 spaces instead of tabs
- +* Commit Unix line endings
- +* If you want, try to keep to the theme of black holes/gravity. This can add some fun to your submission.
- +* Submit Pull Requests to the development branch only.
- +* Before Submitting your Pull Request, merge `devel` with your new branch and fix any conflicts. (Make sure you don't break anything in development!)
- +* Be patient. We will review all submitted pull requests, but our focus is on stability.. please don't be offended if we reject your PR, or it appears we're doing nothing with it! We'll get around to it..
- diff --git a/LICENSE b/LICENSE
- new file mode 100644
- index 0000000..1a3787f
- --- /dev/null
- +++ b/LICENSE
- @@ -0,0 +1,166 @@
- +Copyright (C) 2017 Pi-hole, LLC (https://pi-hole.net)
- +Pi-hole web interface
- +
- +This software is licensed under the European Union Public License (EUPL)
- +The license is available in the 22 official languages of the EU. The English version is included here.
- +Please see https://joinup.ec.europa.eu/community/eupl/og_page/eupl for official translations of the other languages.
- +
- +This license applies to the whole project EXCEPT the files located under
- + - styles/vendor, and
- + - scripts/vendor
- +whose licenses are located therein.
- +
- +-------------------------------------------------------------
- +
- +European Union Public Licence
- +V. 1.1
- +
- +EUPL (C) the European Community 2007
- +
- +This European Union Public Licence (the "EUPL") applies to the Work or Software (as defined below) which is provided under the terms of this Licence. Any use of the Work, other than as authorised under this Licence is prohibited (to the extent such use is covered by a right of the copyright holder of the Work).
- +
- +The Original Work is provided under the terms of this Licence when the Licensor (as defined below) has placed the following notice immediately following the copyright notice for the Original Work:
- +
- +Licensed under the EUPL V.1.1
- +
- +or has expressed by any other mean his willingness to license under the EUPL.
- +
- +1. Definitions
- +
- +In this Licence, the following terms have the following meaning:
- +
- +- The Licence: this Licence.
- +
- +- The Original Work or the Software: the software distributed and/or communicated by the Licensor under this Licence, available as Source Code and also as Executable Code as the case may be.
- +
- +- Derivative Works: the works or software that could be created by the Licensee, based upon the Original Work or modifications thereof. This Licence does not define the extent of modification or dependence on the Original Work required in order to classify a work as a Derivative Work; this extent is determined by copyright law applicable in the country mentioned in Article 15.
- +
- +- The Work: the Original Work and/or its Derivative Works.
- +
- +- The Source Code: the human-readable form of the Work which is the most convenient for people to study and modify.
- +
- +- The Executable Code: any code which has generally been compiled and which is meant to be interpreted by a computer as a program.
- +
- +- The Licensor: the natural or legal person that distributes and/or communicates the Work under the Licence.
- +
- +- Contributor(s): any natural or legal person who modifies the Work under the Licence, or otherwise contributes to the creation of a Derivative Work.
- +
- +- The Licensee or "You": any natural or legal person who makes any usage of the Software under the terms of the Licence.
- +
- +- Distribution and/or Communication: any act of selling, giving, lending, renting, distributing, communicating, transmitting, or otherwise making available, on-line or off-line, copies of the Work or providing access to its essential functionalities at the disposal of any other natural or legal person.
- +
- +2. Scope of the rights granted by the Licence
- +
- +The Licensor hereby grants You a world-wide, royalty-free, non-exclusive, sub-licensable licence to do the following, for the duration of copyright vested in the Original Work:
- +
- +- use the Work in any circumstance and for all usage,
- +- reproduce the Work,
- +- modify the Original Work, and make Derivative Works based upon the Work,
- +- communicate to the public, including the right to make available or display the Work or copies thereof to the public and perform publicly, as the case may be, the Work,
- +- distribute the Work or copies thereof,
- +- lend and rent the Work or copies thereof,
- +- sub-license rights in the Work or copies thereof.
- +
- +Those rights can be exercised on any media, supports and formats, whether now known or later invented, as far as the applicable law permits so.
- +
- +In the countries where moral rights apply, the Licensor waives his right to exercise his moral right to the extent allowed by law in order to make effective the licence of the economic rights here above listed.
- +
- +The Licensor grants to the Licensee royalty-free, non exclusive usage rights to any patents held by the Licensor, to the extent necessary to make use of the rights granted on the Work under this Licence.
- +
- +3. Communication of the Source Code
- +
- +The Licensor may provide the Work either in its Source Code form, or as Executable Code. If the Work is provided as Executable Code, the Licensor provides in addition a machine-readable copy of the Source Code of the Work along with each copy of the Work that the Licensor distributes or indicates, in a notice following the copyright notice attached to the Work, a repository where the Source Code is easily and freely accessible for as long as the Licensor continues to distribute and/or communicate the Work.
- +
- +4. Limitations on copyright
- +
- +Nothing in this Licence is intended to deprive the Licensee of the benefits from any exception or limitation to the exclusive rights of the rights owners in the Original Work or Software, of the exhaustion of those rights or of other applicable limitations thereto.
- +
- +5. Obligations of the Licensee
- +
- +The grant of the rights mentioned above is subject to some restrictions and obligations imposed on the Licensee. Those obligations are the following:
- +
- +Attribution right: the Licensee shall keep intact all copyright, patent or trademarks notices and all notices that refer to the Licence and to the disclaimer of warranties. The Licensee must include a copy of such notices and a copy of the Licence with every copy of the Work he/she distributes and/or communicates. The Licensee must cause any Derivative Work to carry prominent notices stating that the Work has been modified and the date of modification.
- +
- +Copyleft clause: If the Licensee distributes and/or communicates copies of the Original Works or Derivative Works based upon the Original Work, this Distribution and/or Communication will be done under the terms of this Licence or of a later version of this Licence unless the Original Work is expressly distributed only under this version of the Licence. The Licensee (becoming Licensor) cannot offer or impose any additional terms or conditions on the Work or Derivative Work that alter or restrict the terms of the Licence.
- +
- +Compatibility clause: If the Licensee Distributes and/or Communicates Derivative Works or copies thereof based upon both the Original Work and another work licensed under a Compatible Licence, this Distribution and/or Communication can be done under the terms of this Compatible Licence. For the sake of this clause, "Compatible Licence" refers to the licences listed in the appendix attached to this Licence. Should the Licensee’s obligations under the Compatible Licence conflict with his/her obligations under this Licence, the obligations of the Compatible Licence shall prevail.
- +
- +Provision of Source Code: When distributing and/or communicating copies of the Work, the Licensee will provide a machine-readable copy of the Source Code or indicate a repository where this Source will be easily and freely available for as long as the Licensee continues to distribute and/or communicate the Work.
- +
- +Legal Protection: This Licence does not grant permission to use the trade names, trademarks, service marks, or names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the copyright notice.
- +
- +6. Chain of Authorship
- +
- +The original Licensor warrants that the copyright in the Original Work granted hereunder is owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence.
- +
- +Each Contributor warrants that the copyright in the modifications he/she brings to the Work are owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence.
- +
- +Each time You accept the Licence, the original Licensor and subsequent Contributors grant You a licence to their contributions to the Work, under the terms of this Licence.
- +
- +7. Disclaimer of Warranty
- +
- +The Work is a work in progress, which is continuously improved by numerous contributors. It is not a finished work and may therefore contain defects or "bugs" inherent to this type of software development.
- +
- +For the above reason, the Work is provided under the Licence on an "as is" basis and without warranties of any kind concerning the Work, including without limitation merchantability, fitness for a particular purpose, absence of defects or errors, accuracy, non-infringement of intellectual property rights other than copyright as stated in Article 6 of this Licence.
- +
- +This disclaimer of warranty is an essential part of the Licence and a condition for the grant of any rights to the Work.
- +
- +8. Disclaimer of Liability
- +
- +Except in the cases of wilful misconduct or damages directly caused to natural persons, the Licensor will in no event be liable for any direct or indirect, material or moral, damages of any kind, arising out of the Licence or of the use of the Work, including without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, loss of data or any commercial damage, even if the Licensor has been advised of the possibility of such damage. However, the Licensor will be liable under statutory product liability laws as far such laws apply to the Work.
- +
- +9. Additional agreements
- +
- +While distributing the Original Work or Derivative Works, You may choose to conclude an additional agreement to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or services consistent with this Licence. However, in accepting such obligations, You may act only on your own behalf and on your sole responsibility, not on behalf of the original Licensor or any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against such Contributor by the fact You have accepted any such warranty or additional liability.
- +
- +10. Acceptance of the Licence
- +
- +The provisions of this Licence can be accepted by clicking on an icon "I agree" placed under the bottom of a window displaying the text of this Licence or by affirming consent in any other similar way, in accordance with the rules of applicable law. Clicking on that icon indicates your clear and irrevocable acceptance of this Licence and all of its terms and conditions.
- +
- +Similarly, you irrevocably accept this Licence and all of its terms and conditions by exercising any rights granted to You by Article 2 of this Licence, such as the use of the Work, the creation by You of a Derivative Work or the Distribution and/or Communication by You of the Work or copies thereof.
- +
- +11. Information to the public
- +
- +In case of any Distribution and/or Communication of the Work by means of electronic communication by You (for example, by offering to download the Work from a remote location) the distribution channel or media (for example, a website) must at least provide to the public the information requested by the applicable law regarding the Licensor, the Licence and the way it may be accessible, concluded, stored and reproduced by the Licensee.
- +
- +12. Termination of the Licence
- +
- +The Licence and the rights granted hereunder will terminate automatically upon any breach by the Licensee of the terms of the Licence.
- +
- +Such a termination will not terminate the licences of any person who has received the Work from the Licensee under the Licence, provided such persons remain in full compliance with the Licence.
- +
- +13. Miscellaneous
- +
- +Without prejudice of Article 9 above, the Licence represents the complete agreement between the Parties as to the Work licensed hereunder.
- +
- +If any provision of the Licence is invalid or unenforceable under applicable law, this will not affect the validity or enforceability of the Licence as a whole. Such provision will be construed and/or reformed so as necessary to make it valid and enforceable.
- +
- +The European Commission may publish other linguistic versions and/or new versions of this Licence, so far this is required and reasonable, without reducing the scope of the rights granted by the Licence. New versions of the Licence will be published with a unique version number.
- +
- +All linguistic versions of this Licence, approved by the European Commission, have identical value. Parties can take advantage of the linguistic version of their choice.
- +
- +14. Jurisdiction
- +
- +Any litigation resulting from the interpretation of this License, arising between the European Commission, as a Licensor, and any Licensee, will be subject to the jurisdiction of the Court of Justice of the European Communities, as laid down in article 238 of the Treaty establishing the European Community.
- +
- +Any litigation arising between Parties, other than the European Commission, and resulting from the interpretation of this License, will be subject to the exclusive jurisdiction of the competent court where the Licensor resides or conducts its primary business.
- +
- +15. Applicable Law
- +
- +This Licence shall be governed by the law of the European Union country where the Licensor resides or has his registered office.
- +
- +This licence shall be governed by the Belgian law if:
- +
- +- a litigation arises between the European Commission, as a Licensor, and any Licensee;
- +- the Licensor, other than the European Commission, has no residence or registered office inside a European Union country.
- +
- +
- +===
- +Appendix
- +
- +"Compatible Licences" according to article 5 EUPL are:
- +- GNU General Public License (GNU GPL) v. 2
- +- Open Software License (OSL) v. 2.1, v. 3.0
- +- Common Public License v. 1.0
- +- Eclipse Public License v. 1.0
- +- Cecill v. 2.0
- diff --git a/README.md b/README.md
- new file mode 100644
- index 0000000..1276987
- --- /dev/null
- +++ b/README.md
- @@ -0,0 +1,30 @@
- +Pi-hole Admin Dashboard
- +============
- +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/938b4d9e61b7487da77cf63ba05c683d)](https://www.codacy.com/app/Pi-hole/AdminLTE?utm_source=github.com&utm_medium=referral&utm_content=pi-hole/AdminLTE&utm_campaign=badger)
- +[![Join the chat at https://gitter.im/pi-hole/AdminLTE](https://badges.gitter.im/pi-hole/AdminLTE.svg)](https://gitter.im/pi-hole/AdminLTE?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
- +
- +[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif "AdminLTE Presentation")](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY "Donate")
- +
- +Using **[AdminLTE](https://almsaeedstudio.com)**, this project will create a Web interface for the ad-blocking Pi-hole: **a black hole for Internet advertisements**.
- +
- +From this interface, you will be able to see stats on how well your Pi-hole is performing. You will also be able to update the lists used to block ads.
- +
- +![Pi-hole Web interface](http://i.imgur.com/EgGZXbT.png)
- +
- +## API
- +A read-only API can be accessed at `/admin/api.php`. With either no parameters or `api.php?summary` it returns the following JSON:
- +```JSON
- +{
- + "domains_being_blocked": "136,708",
- + "dns_queries_today": "18,108",
- + "ads_blocked_today": "14,648",
- + "ads_percentage_today": "80.9"
- +}
- +```
- +
- +There are many more parameters, such as `summaryRaw`, `overTimeData10mins`, ` topClients` or `getQuerySources`, `getQueryTypes`, `getForwardDestinations`, and `getAllQueries`.
- +Together with a token it is also possible to enable and disable (also with a set timeout) blocking via the API.
- +
- +<hr>
- +<img src="https://assets.pi-hole.net/static/BStackLogo.png" height="80"><br>
- +We use BrowserStack for multi-platform multi-browser testing.
- diff --git a/api.php b/api.php
- new file mode 100644
- index 0000000..e8703cc
- --- /dev/null
- +++ b/api.php
- @@ -0,0 +1,151 @@
- +<?php
- +/* Pi-hole: A black hole for Internet advertisements
- +* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +* Network-wide ad blocking via your own hardware.
- +*
- +* This file is copyright under the latest version of the EUPL.
- +* Please see LICENSE file for your rights under this license. */
- +
- + $api = true;
- + require "scripts/pi-hole/php/password.php";
- + require "scripts/pi-hole/php/auth.php";
- +
- + check_cors();
- +
- + include('scripts/pi-hole/php/data.php');
- + header('Content-type: application/json');
- +
- + $data = array();
- +
- + // Non-Auth
- +
- + if (isset($_GET['type'])) {
- + $data["type"] = "PHP";
- + }
- +
- + if (isset($_GET['version'])) {
- + $data["version"] = 2;
- + }
- +
- + if (isset($_GET['summaryRaw'])) {
- + $data = array_merge($data, getSummaryData());
- + }
- +
- + if (isset($_GET['summary']) || !count($_GET)) {
- + $sum = getSummaryData();
- + $sum['ads_blocked_today'] = number_format( $sum['ads_blocked_today']);
- + $sum['dns_queries_today'] = number_format( $sum['dns_queries_today']);
- + $sum['ads_percentage_today'] = number_format( $sum['ads_percentage_today'], 1, '.', '');
- + $sum['domains_being_blocked'] = number_format( $sum['domains_being_blocked']);
- + $data = array_merge($data, $sum);
- + }
- +
- + if (isset($_GET['overTimeData'])) {
- + $data = array_merge($data, getOverTimeData());
- + }
- +
- + if (isset($_GET['overTimeData10mins'])) {
- + $data = array_merge($data, getOverTimeData10mins());
- + }
- +
- + // Auth Required
- +
- + if (isset($_GET['topItems']) && $auth) {
- + $data = array_merge($data, getTopItems($_GET['topItems']));
- + }
- +
- + if (isset($_GET['recentItems']) && $auth) {
- + if (is_numeric($_GET['recentItems'])) {
- + $data = array_merge($data, getRecentItems($_GET['recentItems']));
- + }
- + }
- +
- + if (isset($_GET['getQueryTypes']) && $auth) {
- + $data = array_merge($data, getIpvType());
- + }
- +
- + if (isset($_GET['getForwardDestinations']) && $auth) {
- + $data = array_merge($data, getForwardDestinations());
- + }
- +
- + if (isset($_GET['getQuerySources']) && $auth) {
- + $data = array_merge($data, getQuerySources());
- + }
- +
- + if (isset($_GET['getAllQueries']) && $auth) {
- + $data = array_merge($data, getAllQueries($_GET['getAllQueries']));
- + }
- +
- + if (isset($_GET['enable']) && $auth) {
- + if(isset($_GET["auth"]))
- + {
- + if($_GET["auth"] !== $pwhash)
- + die("Not authorized!");
- + }
- + else
- + {
- + // Skip token validation if explicit auth string is given
- + check_csrf($_GET['token']);
- + }
- + exec('sudo pihole enable');
- + $data = array_merge($data, array("status" => "enabled"));
- + unlink("../custom_disable_timer");
- + }
- + elseif (isset($_GET['disable']) && $auth) {
- + if(isset($_GET["auth"]))
- + {
- + if($_GET["auth"] !== $pwhash)
- + die("Not authorized!");
- + }
- + else
- + {
- + // Skip token validation if explicit auth string is given
- + check_csrf($_GET['token']);
- + }
- + $disable = intval($_GET['disable']);
- + // intval returns the integer value on success, or 0 on failure
- + if($disable > 0)
- + {
- + $timestamp = time();
- + exec("sudo pihole disable ".$disable."s");
- + file_put_contents("../custom_disable_timer",($timestamp+$disable)*1000);
- + }
- + else
- + {
- + exec('sudo pihole disable');
- + unlink("../custom_disable_timer");
- + }
- + $data = array_merge($data, array("status" => "disabled"));
- + }
- +
- + if (isset($_GET['getGravityDomains'])) {
- + $data = array_merge($data, getGravity());
- + }
- +
- + if (isset($_GET['tailLog']) && $auth) {
- + $data = array_merge($data, tailPiholeLog($_GET['tailLog']));
- + }
- +
- + function filterArray(&$inArray) {
- + $outArray = array();
- + foreach ($inArray as $key=>$value) {
- + if (is_array($value)) {
- + $outArray[htmlspecialchars($key)] = filterArray($value);
- + } else {
- + $outArray[htmlspecialchars($key)] = !is_numeric($value) ? htmlspecialchars($value) : $value;
- + }
- + }
- + return $outArray;
- + }
- +
- + $data = filterArray($data);
- +
- + if(isset($_GET["jsonForceObject"]))
- + {
- + echo json_encode($data, JSON_FORCE_OBJECT);
- + }
- + else
- + {
- + echo json_encode($data);
- + }
- +?>
- diff --git a/debug.php b/debug.php
- new file mode 100644
- index 0000000..84416cf
- --- /dev/null
- +++ b/debug.php
- @@ -0,0 +1,19 @@
- +<?php
- + require "scripts/pi-hole/php/header.php";
- +?>
- +<!-- Title -->
- +<div class="page-header">
- + <h1>Generate debug log</h1>
- +</div>
- +
- +<p><input type="checkbox" id="upload" checked> Upload debug log and provide token once finished</p>
- +<p>Once you click this button a debug log will be generated and can automatically be uploaded if we detect a working internet connection.</p>
- +<button class="btn btn-lg btn-primary btn-block" id="debugBtn">Generate debug log</button>
- +<pre id="output" style="width: 100%; height: 100%;" hidden="true"></pre>
- +
- +<?php
- + require "scripts/pi-hole/php/footer.php";
- +?>
- +
- +
- +<script src="scripts/pi-hole/js/debug.js"></script>
- diff --git a/gravity.php b/gravity.php
- new file mode 100644
- index 0000000..15f6e60
- --- /dev/null
- +++ b/gravity.php
- @@ -0,0 +1,33 @@
- +<!-- Pi-hole: A black hole for Internet advertisements
- +* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +* Network-wide ad blocking via your own hardware.
- +*
- +* This file is copyright under the latest version of the EUPL.
- +* Please see LICENSE file for your rights under this license. -->
- +<?php
- + require "scripts/pi-hole/php/header.php";
- +?>
- +<!-- Title -->
- +<div class="page-header">
- + <h1>Update list of ad-serving domains</h1>
- +</div>
- +
- +<!-- Alerts -->
- +<div id="alInfo" class="alert alert-info alert-dismissible fade in" role="alert" hidden="true">
- + <button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- + Updating...
- +</div>
- +<div id="alSuccess" class="alert alert-success alert-dismissible fade in" role="alert" hidden="true">
- + <button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- + Success!
- +</div>
- +
- +<button class="btn btn-lg btn-primary btn-block" id="gravityBtn">Update Lists</button>
- +<pre id="output" style="width: 100%; height: 100%;" hidden="true"></pre>
- +
- +<?php
- + require "scripts/pi-hole/php/footer.php";
- +?>
- +
- +
- +<script src="scripts/pi-hole/js/gravity.js"></script>
- diff --git a/help.php b/help.php
- new file mode 100644
- index 0000000..66818b1
- --- /dev/null
- +++ b/help.php
- @@ -0,0 +1,164 @@
- +<!-- Pi-hole: A black hole for Internet advertisements
- +* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +* Network-wide ad blocking via your own hardware.
- +*
- +* This file is copyright under the latest version of the EUPL.
- +* Please see LICENSE file for your rights under this license. -->
- +<?php
- + require "scripts/pi-hole/php/header.php";
- +
- + if(strlen($pwhash) > 0)
- + {
- + $authenticationsystem = true;
- + }
- + else
- + {
- + $authenticationsystem = false;
- + }
- +?>
- +
- +<div class="row">
- + <div class="col-md-12">
- + <h1>Help center</h1>
- + <h2>Header</h2>
- + <h4>Top left: Status display</h4>
- + <p>Shows different status messages:</p>
- + <ul>
- + <li>Status: Current status of the Pi-hole - Active (<i class="fa fa-circle" style="color:#7FFF00"></i>), Offline (<i class="fa fa-circle" style="color:#FF0000"></i>), or Starting (<i class="fa fa-circle" style="color:#ff9900"></i>)</li>
- + <li>Temp: Current CPU temperature</li>
- + <li>Load: load averages for the last minute, 5 minutes and 15 minutes, respectively. A load average of 1 reflects the full workload of a single processor on the system. We show a red icon if the current load exceeds the number of available processors on this machine (which is <?php echo $nproc; ?>)</li>
- + <li>Memory usage: Shows the percentage of memory actually blocked by applications. We show a red icon if the memory usage exceeds 75%</li>
- + </ul>
- + <h4>Top right: About</h4>
- + <ul>
- + <li>GitHub: Link to the Pi-hole repository</li>
- + <li>Details: Link to Jacob Salmela's blog with some more details, describing also the concept of the Pi-hole</li>
- + <li>Updates: Link to list of releases</li>
- + <li>Update notifications: If updates are available, a link will be shown here.</li>
- + <?php if($authenticationsystem){ ?>
- + <li>Session timer: Shows the time remaining until the current login session expires.</li>
- + <?php } ?>
- + </ul>
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Dashboard</h2>
- + <p>On the dashboard, you can see various Pi-hole statistics:</p>
- + <ul>
- + <li>Summary: A summary of statistics showing how many total DNS queries have been blocked today, what percentage of DNS queries have been blocked, and how many domains are in the compiled ad list. This summary is updated every 10 seconds.</li>
- + <li>Queries over time: Graph showing DNS queries (total and blocked) over 10 minute time intervals. More information can be acquired by hovering over the lines. This graph is updated every 10 minutes.</li>
- + <li>Query Types: Identifies the types of processed queries:
- + <ul>
- + <li>A: address lookup (most commonly used to map hostnames to an IPv4 address of the host)</li>
- + <li>AAAA: address lookup (most commonly used to map hostnames to an IPv6 address of the host)</li>
- + <li>PTR: most common use is for implementing reverse DNS lookups</li>
- + <li>SRV: Service locator (often used by XMPP, SIP, and LDAP)</li>
- + <li>and others</li>
- + </ul>
- + </li>
- + <li>Forward Destinations: Shows to which upstream DNS the permitted requests have been forwarded to.</li>
- + <li>Top Domains: Ranking of requested sites by number of DNS lookups.</li>
- + <li>Top Advertisers: Ranking of requested advertisements by number of DNS lookups.</li>
- + <li>Top Clients: Ranking of how many DNS requests each client has made on the local network.</li>
- + </ul>
- + <?php if($authenticationsystem){ ?>
- + <p>Note that the login session does <em>not</em> expire on the dashboard, as the summary is updated every 10 seconds which refreshes the session.</p>
- + <?php } ?>
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Query Log</h2>
- + <p>Shows the recent queries by parsing Pi-hole's log. It is possible to search through the whole list by using the "Search" input field. If the status is reported as "OK", then the DNS request has been permitted. Otherwise ("Pi-holed") it has been blocked. By clicking on the buttons under "Action" the corresponding domains can quickly be added to the white-/blacklist. The status of the action will be reported on this page.</p>
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>White- / Blacklist</h2>
- + <p>Add or remove domains (or subdomains) from the white-/blacklist. If a domain is added to e.g. the whitelist, any possible entry of the same domain will be automatically removed from the blacklist and vice versa.</p>
- + <p>Wildcard blacklisting is supported (entering <tt>something.de</tt> will block this domain including all subdomains like <tt>a.bb.c.999.something.de</tt>). Note that wildcard whitelisting is <em>not</em> supported.</p>
- + <p>You can white-/blacklist multiple entries at a time if you separate the domains by spaces.</p>
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Disable / Enable</h2>
- + Disables/enables Pi-Hole blocking completely. You may have to wait a few minutes for the changes to reach all of your devices. The change will be reflected by a changed status (top left)
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Tools → Update Lists</h2>
- + <p>Will download any updates from the third-party ad-serving domain lists that we source. By default, this command runs once a week via cron (Sunday at 01:59).</p>
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Tools → Query adlists</h2>
- + This function is useful to find out what list a domain appears on. Since we don't control what the third-parties put on the block lists, you may find that a domain you normally visit stops working. If this is the case, you could run this command to scan for strings in the list of blocked domains and it will return the list the domain is found on. This proved useful a while back when the Mahakala list was adding <tt>apple.com</tt> and <tt>microsoft.com</tt> to their block list.</p>
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Tools → Tail pihole.log</h2>
- + Live tailing of the raw Pi-hole log.</p>
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Settings</h2>
- + Change settings for the Pi-Hole
- + <h4>Networking</h4>
- + Displays information about the interfaces of the Pi-Hole. No changes possible.
- + <h4>Pi-Hole DHCP Server</h4>
- + Using this setting you can enable/disable the DHCP server of the Pi-Hole. Note that you should disable any other DHCP server on your network to avoid IP addresses being used more than once. You have to give the range of IPs that DHCP will serve and the IP of the local router (gateway). If the DHCP server is active, the current leases are shown on the settings page. IPv4 DHCP will always be activated, IPv6 (stateless + statefull) can be enabled.
- + <h4>Upstream DNS Servers</h4>
- + Customize used upstream DNS servers + advanced settings for DNS servers. Note that any number of DNS servers may be enabled at a time.
- + <h4>Query Logging</h4>
- + Enabled/disable query logging on your Pi-hole + provide option to flush the log
- + <h4>API</h4>
- + Change settings which apply to the API as well as the web UI<br>
- + Note that Top Clients have to be given as IP addresses
- + <h4>Web User Interface</h4>
- + Other settings which affect the webUI but not the API of Pi-hole
- + <h4>System Administration</h4>
- + Apply system-wide actions like restarting of the server
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Authentication system (currently <?php if($authenticationsystem) { ?>enabled<?php } else { ?>disabled<?php } ?>)</h2>
- + <p>Using the command<pre>sudo pihole -a -p pa22w0rd</pre> where <em>pa22w0rd</em> is the password to be set in this example, one can enable the authentication system of this web interface. Thereafter, a login is required for most pages (the dashboard will show a limited amount of statistics). Note that the authentication system may be disabled again, by setting an empty password using the command shown above. The Help center will show more details concerning the authentication system only if it is enabled</p>
- + </div>
- +</div>
- +<?php if($authenticationsystem) { ?>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Login / Logout</h2>
- + <p>Using the Login / Logout function, a user can initiate / terminate a login session. The login page will also always be shown if a user tries to access a protected page directly without having a valid login session</p>
- + </div>
- +</div>
- +<?php } ?>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Donate</h2>
- + Keep in mind that Pi-hole is free. If you like Pi-hole, please consider a small donation to help support its development
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Help (this page)</h2>
- + Shows information about what is happening behind the scenes and what can be done with this web user interface (web UI). The Help center will show details concerning the authentication system only if it is enabled
- + </div>
- +</div>
- +<div class="row">
- + <div class="col-md-12">
- + <h2>Footer</h2>
- + Shows the currently installed Pi-hole and Web Interface version. If an update is available, this will be indicated here
- + </div>
- +</div>
- +
- +<?php
- + require "scripts/pi-hole/php/footer.php";
- +?>
- diff --git a/img/boxed-bg.jpg b/img/boxed-bg.jpg
- new file mode 100644
- index 0000000..e47586a
- Binary files /dev/null and b/img/boxed-bg.jpg differ
- diff --git a/img/donate.gif b/img/donate.gif
- new file mode 100644
- index 0000000..4700ced
- Binary files /dev/null and b/img/donate.gif differ
- diff --git a/img/favicon.png b/img/favicon.png
- new file mode 100644
- index 0000000..35dd8c9
- Binary files /dev/null and b/img/favicon.png differ
- diff --git a/img/logo.svg b/img/logo.svg
- new file mode 100644
- index 0000000..eeeec32
- --- /dev/null
- +++ b/img/logo.svg
- @@ -0,0 +1 @@
- +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 88.32 129.93"><defs><style>.cls-1{fill:url(#New_Gradient_Swatch_1);}.cls-2{fill:#980200;}.cls-3{fill:red;}</style><linearGradient id="New_Gradient_Swatch_1" x1="2.71" y1="20.04" x2="69.77" y2="20.04" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#12b212"/><stop offset="1" stop-color="lime"/></linearGradient></defs><title>NewVortex</title><g id="Layer_2" data-name="Layer 2"><g id="RedBerry"><path id="Leaf_Path" data-name="Leaf Path" class="cls-1" d="M36.56,39.93m0,0C20.34,38.2,4,25.94,2.71,0,27.88,0,41.34,14.9,42.64,38.51c4.76-28.32,27.07-25,27.07-25,1.06,16.05-12.12,25.78-27.07,26.59C38.44,31.25,13.28,9.54,13.28,9.54a.07.07,0,0,0-.11.08S37.45,30.77,36.56,39.93"/><path id="LeftBerry" class="cls-2" d="M44.16,129.93c-1.57-.09-16.22-.65-17.11-17.11-.72-10,7.18-17.37,7.18-27.08C32.44,61.53,0,64.53,0,85.74H0A19.94,19.94,0,0,0,5.83,99.88L30,124.06a19.94,19.94,0,0,0,14.14,5.83"/><path id="BottomBerry" class="cls-3" d="M88.32,85.75c-.09,1.57-.65,16.22-17.11,17.11-10,.72-17.38-7.18-27.08-7.18-24.21,1.79-21.21,34.22,0,34.22h0a19.94,19.94,0,0,0,14.14-5.83L82.46,99.9a19.94,19.94,0,0,0,5.83-14.14"/><path id="RightBerry" class="cls-2" d="M44.16,41.59c1.57.09,16.22.65,17.11,17.11.72,10-7.18,17.37-7.18,27.08,1.79,24.21,34.22,21.21,34.22,0h0a19.94,19.94,0,0,0-5.83-14.14L58.3,47.45a19.94,19.94,0,0,0-14.14-5.83"/><path id="TopBerry" class="cls-3" d="M.08,85.75c.09-1.57.65-16.22,17.11-17.11,10-.72,17.38,7.18,27.08,7.18C68.48,74,65.48,41.6,44.27,41.6h0a19.94,19.94,0,0,0-14.14,5.83L5.94,71.61A19.94,19.94,0,0,0,.11,85.75"/></g></g></svg>
- \ No newline at end of file
- diff --git a/index.php b/index.php
- new file mode 100644
- index 0000000..659a868
- --- /dev/null
- +++ b/index.php
- @@ -0,0 +1,225 @@
- +<!-- Pi-hole: A black hole for Internet advertisements
- +* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +* Network-wide ad blocking via your own hardware.
- +*
- +* This file is copyright under the latest version of the EUPL.
- +* Please see LICENSE file for your rights under this license. -->
- +<?php
- + $indexpage = true;
- + require "scripts/pi-hole/php/header.php";
- +?>
- +<!-- Small boxes (Stat box) -->
- +<div class="row">
- + <div class="col-lg-3 col-xs-12">
- + <!-- small box -->
- + <div class="small-box bg-aqua">
- + <div class="inner">
- + <h3 class="statistic" id="ads_blocked_today">---</h3>
- + <p>DNS Queries Blocked Today</p>
- + </div>
- + <div class="icon">
- + <i class="ion ion-android-hand"></i>
- + </div>
- + </div>
- + </div>
- + <!-- ./col -->
- + <div class="col-lg-3 col-xs-12">
- + <!-- small box -->
- + <div class="small-box bg-green">
- + <div class="inner">
- + <h3 class="statistic" id="dns_queries_today">---</h3>
- + <p>DNS Queries Today</p>
- + </div>
- + <div class="icon">
- + <i class="ion ion-earth"></i>
- + </div>
- + </div>
- + </div>
- + <!-- ./col -->
- + <div class="col-lg-3 col-xs-12">
- + <!-- small box -->
- + <div class="small-box bg-yellow">
- + <div class="inner">
- + <h3 class="statistic" id="ads_percentage_today">---</h3>
- + <p>Of Today's Queries Were Blocked</p>
- + </div>
- + <div class="icon">
- + <i class="ion ion-pie-graph"></i>
- + </div>
- + </div>
- + </div>
- + <!-- ./col -->
- + <div class="col-lg-3 col-xs-12">
- + <!-- small box -->
- + <div class="small-box bg-red">
- + <div class="inner">
- + <h3 class="statistic" id="domains_being_blocked">---</h3>
- + <p>Domains Being Blocked</p>
- + </div>
- + <div class="icon">
- + <i class="ion ion-ios-list"></i>
- + </div>
- + </div>
- + </div>
- + <!-- ./col -->
- +</div>
- +
- +<div class="row">
- + <div class="col-md-12">
- + <div class="box" id="queries-over-time">
- + <div class="box-header with-border">
- + <h3 class="box-title">Queries over time</h3>
- + </div>
- + <div class="box-body">
- + <div class="chart">
- + <canvas id="queryOverTimeChart" width="800" height="250"></canvas>
- + </div>
- + </div>
- + <div class="overlay">
- + <i class="fa fa-refresh fa-spin"></i>
- + </div>
- + <!-- /.box-body -->
- + </div>
- + </div>
- +</div>
- +<?php
- + // If the user is logged in, then we show the more detailed index page.
- + // Even if we would include them here anyhow, there would be nothing to
- + // show since the API will respect the privacy of the user if he defines
- + // a password
- + if($auth){ ?>
- +<div class="row">
- + <div class="col-md-6">
- + <div class="box" id="query-types">
- + <div class="box-header with-border">
- + <h3 class="box-title">Query Types</h3>
- + </div>
- + <div class="box-body">
- + <div class="chart">
- + <canvas id="queryTypeChart" width="400" height="200"></canvas>
- + </div>
- + </div>
- + <div class="overlay">
- + <i class="fa fa-refresh fa-spin"></i>
- + </div>
- + <!-- /.box-body -->
- + </div>
- + </div>
- + <div class="col-md-6">
- + <div class="box" id="forward-destinations">
- + <div class="box-header with-border">
- + <h3 class="box-title">Forward Destinations</h3>
- + </div>
- + <div class="box-body">
- + <div class="chart">
- + <canvas id="forwardDestinationChart" width="400" height="200"></canvas>
- + </div>
- + </div>
- + <div class="overlay">
- + <i class="fa fa-refresh fa-spin"></i>
- + </div>
- + <!-- /.box-body -->
- + </div>
- + </div>
- +</div>
- +
- +<?php
- +if($boxedlayout)
- +{
- + $tablelayout = "col-md-6";
- +}
- +else
- +{
- + $tablelayout = "col-md-6 col-lg-4";
- +}
- +?>
- +<div class="row">
- + <div class="<?php echo $tablelayout; ?>">
- + <div class="box" id="domain-frequency">
- + <div class="box-header with-border">
- + <h3 class="box-title">Top Domains</h3>
- + </div>
- + <!-- /.box-header -->
- + <div class="box-body">
- + <div class="table-responsive">
- + <table class="table table-bordered">
- + <tbody>
- + <tr>
- + <th>Domain</th>
- + <th>Hits</th>
- + <th>Frequency</th>
- + </tr>
- + </tbody>
- + </table>
- + </div>
- + </div>
- + <div class="overlay">
- + <i class="fa fa-refresh fa-spin"></i>
- + </div>
- + <!-- /.box-body -->
- + </div>
- + <!-- /.box -->
- + </div>
- + <!-- /.col -->
- + <div class="<?php echo $tablelayout; ?>">
- + <div class="box" id="ad-frequency">
- + <div class="box-header with-border">
- + <h3 class="box-title">Top Advertisers</h3>
- + </div>
- + <!-- /.box-header -->
- + <div class="box-body">
- + <div class="table-responsive">
- + <table class="table table-bordered">
- + <tbody>
- + <tr>
- + <th>Domain</th>
- + <th>Hits</th>
- + <th>Frequency</th>
- + </tr>
- + </tbody>
- + </table>
- + </div>
- + </div>
- + <div class="overlay">
- + <i class="fa fa-refresh fa-spin"></i>
- + </div>
- + <!-- /.box-body -->
- + </div>
- + <!-- /.box -->
- + </div>
- + <!-- /.col -->
- + <div class="<?php echo $tablelayout; ?>">
- + <div class="box" id="client-frequency">
- + <div class="box-header with-border">
- + <h3 class="box-title">Top Clients</h3>
- + </div>
- + <!-- /.box-header -->
- + <div class="box-body">
- + <div class="table-responsive">
- + <table class="table table-bordered">
- + <tbody>
- + <tr>
- + <th>Client</th>
- + <th>Requests</th>
- + <th>Frequency</th>
- + </tr>
- + </tbody>
- + </table>
- + </div>
- + </div>
- + <div class="overlay">
- + <i class="fa fa-refresh fa-spin"></i>
- + </div>
- + <!-- /.box-body -->
- + </div>
- + <!-- /.box -->
- + </div>
- + <!-- /.col -->
- +</div>
- +<!-- /.row -->
- +<?php } ?>
- +<?php
- + require "scripts/pi-hole/php/footer.php";
- +?>
- +
- +<script src="scripts/pi-hole/js/index.js"></script>
- diff --git a/list.php b/list.php
- new file mode 100644
- index 0000000..9edbdbc
- --- /dev/null
- +++ b/list.php
- @@ -0,0 +1,79 @@
- +<!-- Pi-hole: A black hole for Internet advertisements
- +* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +* Network-wide ad blocking via your own hardware.
- +*
- +* This file is copyright under the latest version of the EUPL.
- +* Please see LICENSE file for your rights under this license. -->
- +<?php
- +require "scripts/pi-hole/php/header.php";
- +
- +$list = $_GET['l'];
- +
- +if($list !== "white" && $list !== "black"){
- + echo "Invalid list parameter";
- + require "footer.php";
- + die();
- +}
- +
- +function getFullName() {
- + global $list;
- + if($list == "white")
- + echo "Whitelist";
- + else
- + echo "Blacklist";
- +}
- +?>
- +<!-- Send list type to JS -->
- +<div id="list-type" hidden><?php echo $list ?></div>
- +
- +<!-- Title -->
- +<div class="page-header">
- + <h1><?php getFullName(); ?></h1>
- +</div>
- +
- +<!-- Domain Input -->
- +<div class="form-group input-group">
- + <input id="domain" type="text" class="form-control" placeholder="Add a domain (example.com or sub.example.com)">
- + <span class="input-group-btn">
- + <?php if($list === "black") { ?>
- + <button id="btnAdd" class="btn btn-default" type="button">Add (exact)</button>
- + <button id="btnAddWildcard" class="btn btn-default" type="button">Add (wildcard)</button>
- + <?php }else{ ?>
- + <button id="btnAdd" class="btn btn-default" type="button">Add</button>
- + <?php } ?>
- + <button id="btnRefresh" class="btn btn-default" type="button"><i class="fa fa-refresh"></i></button>
- + </span>
- +</div>
- +<?php if($list === "white") { ?>
- + <p>Note: Whitelisting a subdomain of a wildcard blocked domain is not possible.</p>
- +<?php } ?>
- +
- +<!-- Alerts -->
- +<div id="alInfo" class="alert alert-info alert-dismissible fade in" role="alert" hidden="true">
- + <button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- + Adding to the <?php getFullName(); ?>...
- +</div>
- +<div id="alSuccess" class="alert alert-success alert-dismissible fade in" role="alert" hidden="true">
- + <button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- + Success! The list will refresh.
- +</div>
- +<div id="alFailure" class="alert alert-danger alert-dismissible fade in" role="alert" hidden="true">
- + <button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- + Failure! Something went wrong.<br/><span id="err"></span>
- +</div>
- +
- +<!-- Domain List -->
- +<?php if($list === "black") { ?>
- +<h3>Exact blocking</h3>
- +<?php } ?>
- +<ul class="list-group" id="list"></ul>
- +<?php if($list === "black") { ?>
- +<h3>Wildcard blocking</h3>
- +<ul class="list-group" id="list-wildcard"></ul>
- +<?php } ?>
- +
- +<?php
- +require "scripts/pi-hole/php/footer.php";
- +?>
- +
- +<script src="scripts/pi-hole/js/list.js"></script>
- diff --git a/queries.php b/queries.php
- new file mode 100644
- index 0000000..61e2430
- --- /dev/null
- +++ b/queries.php
- @@ -0,0 +1,119 @@
- +<!-- Pi-hole: A black hole for Internet advertisements
- +* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +* Network-wide ad blocking via your own hardware.
- +*
- +* This file is copyright under the latest version of the EUPL.
- +* Please see LICENSE file for your rights under this license. -->
- +<?php
- + require "scripts/pi-hole/php/header.php";
- +
- +// Generate CSRF token
- +if(empty($_SESSION['token'])) {
- + $_SESSION['token'] = base64_encode(openssl_random_pseudo_bytes(32));
- +}
- +$token = $_SESSION['token'];
- +
- +$showing = "";
- +
- +if(isset($setupVars["API_QUERY_LOG_SHOW"]))
- +{
- + if($setupVars["API_QUERY_LOG_SHOW"] === "all")
- + {
- + $showing = "(showing all queries)";
- + }
- + elseif($setupVars["API_QUERY_LOG_SHOW"] === "permittedonly")
- + {
- + $showing = "(showing permitted queries only)";
- + }
- + elseif($setupVars["API_QUERY_LOG_SHOW"] === "blockedonly")
- + {
- + $showing = "(showing blocked queries only)";
- + }
- + elseif($setupVars["API_QUERY_LOG_SHOW"] === "nothing")
- + {
- + $showing = "(showing no queries at all)";
- + }
- +}
- +
- +if(isset($setupVars["API_PRIVACY_MODE"]))
- +{
- + if($setupVars["API_PRIVACY_MODE"])
- + {
- + // Overwrite string from above
- + $showing = "(privacy mode enabled)";
- + }
- +}
- +?>
- +<!-- Send PHP info to JS -->
- +<div id="token" hidden><?php echo $token ?></div>
- +
- +
- +<!--
- +<div class="row">
- + <div class="col-md-12">
- + <button class="btn btn-info margin-bottom pull-right">Refresh Data</button>
- + </div>
- +</div>
- +-->
- +
- +<!-- Alerts -->
- +<div id="alInfo" class="alert alert-info alert-dismissible fade in" role="alert" hidden="true">
- + <button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- + Adding <span id="alDomain"></span> to the <span id="alList"></span>...
- +</div>
- +<div id="alSuccess" class="alert alert-success alert-dismissible fade in" role="alert" hidden="true">
- + <button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- + Success!
- +</div>
- +<div id="alFailure" class="alert alert-danger alert-dismissible fade in" role="alert" hidden="true">
- + <button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- + Failure! Something went wrong.<span id="err"></span>
- +</div>
- +
- +<div class="row">
- + <div class="col-md-12">
- + <div class="box" id="recent-queries">
- + <div class="box-header with-border">
- + <h3 class="box-title">Recent Queries <?php echo $showing; ?></h3>
- + </div>
- + <!-- /.box-header -->
- + <div class="box-body">
- + <div class="table-responsive">
- + <table id="all-queries" class="display table table-striped table-bordered" cellspacing="0" width="100%">
- + <thead>
- + <tr>
- + <th>Time</th>
- + <th>Type</th>
- + <th>Domain</th>
- + <th>Client</th>
- + <th>Status</th>
- + <th>Action</th>
- + </tr>
- + </thead>
- + <tfoot>
- + <tr>
- + <th>Time</th>
- + <th>Type</th>
- + <th>Domain</th>
- + <th>Client</th>
- + <th>Status</th>
- + <th>Action</th>
- + </tr>
- + </tfoot>
- + </table>
- + </div>
- + </div>
- + <!-- /.box-body -->
- + </div>
- + <!-- /.box -->
- + </div>
- +</div>
- +<!-- /.row -->
- +
- +<?php
- + require "scripts/pi-hole/php/footer.php";
- +?>
- +
- +<script src="scripts/pi-hole/js/queries.js"></script>
- +<script src="scripts/vendor/moment.min.js"></script>
- +<script src="scripts/vendor/datetime-moment.js"></script>
- diff --git a/queryads.php b/queryads.php
- new file mode 100644
- index 0000000..272fe34
- --- /dev/null
- +++ b/queryads.php
- @@ -0,0 +1,31 @@
- +<!-- Pi-hole: A black hole for Internet advertisements
- +* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +* Network-wide ad blocking via your own hardware.
- +*
- +* This file is copyright under the latest version of the EUPL.
- +* Please see LICENSE file for your rights under this license. -->
- +<?php
- + require "scripts/pi-hole/php/header.php";
- +?>
- +<!-- Title -->
- +<div class="page-header">
- + <h1>Find Ad Domain In Lists</h1>
- +</div>
- +<!-- Domain Input -->
- +<div class="form-group input-group">
- + <input id="domain" type="text" class="form-control" placeholder="Domain to look for (example.com or sub.example.com)">
- + <input id="quiet" type="hidden" value="no">
- + <span class="input-group-btn">
- + <button id="btnSearch" class="btn btn-default" type="button">Search partial match</button>
- + <button id="btnSearchExact" class="btn btn-default" type="button">Search exact match</button>
- + </span>
- +</div>
- +
- +<pre id="output" style="width: 100%; height: 100%;" hidden="true"></pre>
- +
- +<?php
- + require "scripts/pi-hole/php/footer.php";
- +?>
- +
- +
- +<script src="scripts/pi-hole/js/queryads.js"></script>
- diff --git a/scripts/pi-hole/js/debug.js b/scripts/pi-hole/js/debug.js
- new file mode 100644
- index 0000000..c0db2ce
- --- /dev/null
- +++ b/scripts/pi-hole/js/debug.js
- @@ -0,0 +1,65 @@
- +// Credit: http://stackoverflow.com/a/10642418/2087442
- +function httpGet(ta,theUrl)
- +{
- + var xmlhttp;
- + if (window.XMLHttpRequest)
- + {
- + // code for IE7+
- + xmlhttp = new XMLHttpRequest();
- + }
- + else
- + {
- + // code for IE6, IE5
- + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- + }
- + xmlhttp.onreadystatechange=function()
- + {
- + if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
- + {
- + ta.show();
- + ta.empty();
- + ta.append(xmlhttp.responseText);
- + }
- + };
- + xmlhttp.open("GET", theUrl, false);
- + xmlhttp.send();
- +}
- +
- +function eventsource() {
- + var ta = $("#output");
- + var upload = $( "#upload" );
- + var checked = "";
- +
- + if(upload.prop("checked"))
- + {
- + checked = "upload";
- + }
- +
- + // IE does not support EventSource - load whole content at once
- + if (typeof EventSource !== "function") {
- + httpGet(ta,"/admin/scripts/pi-hole/php/debug.php?IE&"+checked);
- + return;
- + }
- +
- + var host = window.location.host;
- + var source = new EventSource("/admin/scripts/pi-hole/php/debug.php?"+checked);
- +
- + // Reset and show field
- + ta.empty();
- + ta.show();
- +
- + source.addEventListener("message", function(e) {
- + ta.append(e.data);
- + }, false);
- +
- + // Will be called when script has finished
- + source.addEventListener("error", function(e) {
- + source.close();
- + }, false);
- +}
- +
- +$("#debugBtn").on("click", function(){
- + $("#debugBtn").attr("disabled", true);
- + $("#upload").attr("disabled", true);
- + eventsource();
- +});
- diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js
- new file mode 100644
- index 0000000..20866b8
- --- /dev/null
- +++ b/scripts/pi-hole/js/footer.js
- @@ -0,0 +1,286 @@
- +/* Pi-hole: A black hole for Internet advertisements
- +* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +* Network-wide ad blocking via your own hardware.
- +*
- +* This file is copyright under the latest version of the EUPL.
- +* Please see LICENSE file for your rights under this license. */
- +// User menu toggle
- +$("#dropdown-menu a").on("click", function(event) {
- + $(this).parent().toggleClass("open");
- +});
- +$("body").on("click", function(event) {
- + if(!$("#dropdown-menu").is(event.target) && $("#dropdown-menu").has(event.t+$("#debugBtn").on("click", function(){
- + $("#debugBtn").attr("disabled", true);
- + $("#upload").attr("disabled", true);
- + eventsource();
- +});
- diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js
- new file mode 100644
- index 0000000..20866b8
- --- /dev/null
- +++ b/scripts/pi-hole/js/footer.js
- @@ -0,0 +1,286 @@
- +/* Pi-hole: A black hole for Internet advertisements
- +* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +* Network-wide ad blocking via your own hardware.
- +*
- +* This file is copyright under the latest version of the EUPL.
- +* Please see LICENSE file for your rights under this license. */
- +// User menu toggle
- +$("#dropdown-menu a").on("click", function(event) {
- + $(this).parent().toggleClass("open");
- +});
- +$("body").on("click", function(event) {
- + if(!$("#dropdown-menu").is(event.target) && $("#dropdown-menu").has(event.t
- arget).length === 0) {
- + $("#dropdown-menu").removeClass("open");
- + }
- +});
- +
- +//The following functions allow us to display time until pi-hole is enabled after disabling.
- +//Works between all pages
- +
- +function secondsTimeSpanToHMS(s) {
- + var h = Math.floor(s/3600); //Get whole hours
- + s -= h*3600;
- + var m = Math.floor(s/60); //Get remaining minutes
- + s -= m*60;
- + return h+":"+(m < 10 ? "0"+m : m)+":"+(s < 10 ? "0"+s : s); //zero padding on minutes and seconds
- +}
- +
- +function countDown(){
- + var ena = $("#enableLabel");
- + var enaT = $("#enableTimer");
- + var target = new Date(parseInt(enaT.html()));
- + var seconds = Math.round((target.getTime() - new Date().getTime()) / 1000)
- (END)
Add Comment
Please, Sign In to add comment