Commit graph

291 commits

Author SHA1 Message Date
WaLLy3K
54a85d3a63 Fix invalid option case
* Ensure `pihole -q doubleclick.com asd` exits with error
2017-09-18 00:58:56 +10:00
WaLLy3K
c2d3e99ddd Slow query fix & queryFunc optimisation
* Validate modified code using Shellcheck & Strict Bash
* Added and/or elaborated more comments

* scanlist() should exit if /etc/pihole is not available
* Add `export LC_CTYPE=C` to prevent extreme grep slowdown
* Consider "domain.com#comment" an exact match
* Add specialised wildcard searching grep

* Optimise and simplify queryFunc() for readability
* Replace IDN `python` parsing with `idn2`, as `python` is not guaranteed to be available
* Use ${COL_BOLD} when printing filenames
2017-09-18 00:41:26 +10:00
WaLLy3K
4d39ab9753 Allow force-reload to be used when restarting DNS
* Remove duplicate coltable variable definition and source
* Minor comment modifications
* Add "$2" to restartdns
2017-09-14 16:39:25 +10:00
WaLLy3K
56b8c4bfdb Merge branch 'development' into tweak/gravity 2017-09-01 10:01:41 +10:00
WaLLy3K
15a5f425bf Replace nc with psuedo-device
* Also fix minor conditional style issue
2017-08-31 20:32:02 +10:00
WaLLy3K
3125d24ded Replace superseded netstat command
* Make colfile readonly, and use path of PI_HOLE_SCRIPT_DIR
* Rename piholeStatus function to statusFunc for function name consistency
* Replace superseded netstat command with nc
* Perform addn-hosts check using a single grep subshell
2017-08-31 17:39:41 +10:00
WaLLy3K
cc4ada99d8 Use SIGHUP instead of force-reload 2017-08-01 20:48:43 +10:00
Adam Warner
18b41adbf6 Merge branch 'development' into tweak/gravity 2017-07-29 17:14:39 +01:00
WaLLy3K
e0eb5eb2b1 Fix queryFunc if adlists URLs have been removed (#1618)
* Fix queryFunc if adlists URLs have been removed

* Allow for -adlists command line switch (where the "s" is a typo)
* Add error message when unable to find associated adlists URL

* Provide PR fix on current dev version

* Add blResult variable for white/black match

* Supporting Block Page queryFunc fixes

* Re-add unmerged lines
2017-07-25 23:07:06 +01:00
WaLLy3K
a2825be819 Add dnsmasq "force-reload" option
* Made use of $PI_HOLE_SCRIPT_DIR
* Fix #1610 & #1624
* Add "$2" to restartDNS options

Signed-off-by: WaLLy3K <wally3k@pi-hole.net>
2017-07-24 21:25:04 +10:00
Adam Warner
f2e9d585f7
* Add helptext for pihole checkout ftl
* Only attempt to install FTL if branch was found
* ~~corebranches~~ webbranches (web branches now actually listed)

Signed-off-by: Adam Warner <adamw@rner.email>
2017-07-16 13:33:00 +01:00
WaLLy3K
3a50b91722 User-friendly queryFunc() output (#1483)
* User-friendly queryFunc() output

* Silence grep errors
* Provide 'pihole -q -h' help output
* Rewrite option handling
* Loop through grep stdout to make query output user friendly
* Add -adlist option to show block list URL instead of internal file name
* Limit general searches to 10 matches per block list
* Add -all option to override 10 match limit
* Fixed 'pihole -h' wording

* Further query optimisations

* Optimised scanList() output by switching folder
* Re-added processWildcards() function
* Added "-bp" exact matching option for use with block page
* Standardised query output
* Separated wildcard search from blacklist/whitelist search
* Optimised sorting by sorting glob output and not scanList() output

* Fixed result skipping

* Add text for wildcard result on exact query

* Fix wildcard result output

* Multiple wildcard matches on exact query could cause unexpected output

* Remove unnecessary replacement

* Make grep only output matching text

* HOSTS format lists will also output the IP address
* That substitution was necessary

* Remove IP address from HOSTS format lists

* Filter unwanted content

* Add /dev/null to grep, to always print file name (even when searching only one block list)
* Use three seds to remove unwanted content from block lists

* Merge with development

* Simplify queryFunc code
2017-07-15 11:56:40 +01:00
WaLLy3K
3631d1349e Prevent Web Admin from printing restartdns colour codes (#1575)
* Prevent Web Admin from printing unnecessary msgs

* Make DNS restart behaviour consistent
2017-07-15 11:11:06 +01:00
WaLLy3K
209fbf82c4 Colourise tailFunc (#1550)
* Colourise tailFunc

* Strip month, day number and dnsmasq[PID]
* Blocked domains show as light red
* Queries show as standard colour
* Everything else as dark gray

* Change tailFunc highlighted lines

* Highlight Blocked/Blacklist/Wildcard lines as red
* Make DHCP lines default colour

* Make sure tailFunc doesn't match on domain names
2017-07-02 15:21:00 +02:00
Adam Warner
536585b846 Colourise Core Output Text (#1471)
* Define colours within COL_TABLE
* Do not output colours for non-terminal instances
* Removed ":::"
* Fixed indenting & spacing
* Made output consistent throughout project
* Reworded text to fit on standard 80 char wide Terminal screen
* Made 'sudo raspi-config' warning (insufficient disk space) only show on RPi
* Make "Installation/Update Complete" the final msg
* Remove redundant messages
* Simplify update available message
* Confirm user would like to begin uninstall
* If "git pull" string says "Already up-to-date.", place [i] before it
* Colour Temp/Interface output
* Made `pihole disable 5z` invalid
* Added error fallback if invalid argument (not s/m) is detected
* Quoted "$2" for consistency
* Updated help text
* L185/286: Replaced echo with redirect
* User agents for adblock.mahakala.is/adaway.org unnecessary 
* Print newline on confirmation of repository reset
* Add output to admin-related dnsmasq restarts
* Return error message for "pihole -q"
* Imply default checkout behaviour with y/N
* Fix uninstall failing to remove pihole user
* Print checkout 'git remote show origin' STDERR on new line
* Replaced checkout "AdminLTE" wording with "Web Admin"
2017-06-21 21:49:05 +10:00
DL6ER
e4cc5b3847
Disable black.list on "pihole disable" 2017-06-17 14:49:02 +02:00
WaLLy3K
6823a62644 Add tricorderFunc back as usable function (#1515)
As per #1464
2017-06-03 19:13:40 +02:00
WaLLy3K
2b8a8b03a8 Roll back merge #1417 (#1494) 2017-05-27 22:42:44 +02:00
DL6ER
d913534793 Move wildcards file if blocking is disabled (#1495)
* Move wildcards file if blocking is diabled

* Delete newline
2017-05-27 17:51:41 +02:00
WaLLy3K
2f2825f15e Tricorder: Insecure Opt-out 2017-05-20 10:45:26 +10:00
WaLLy3K
a620a5c430 Formatting consistency 2017-05-18 12:53:32 +10:00
WaLLy3K
1f3db8b602 Confirm Tricorder is online
* Scan port 9998 to confirm the availability of "tricorder.pi-hole.net"
* Exit codes for upload process
2017-05-18 12:43:17 +10:00
DL6ER
4e2c6a7b8e
Fix logrotation: manual flushing should be done twice, but automated rotation at midnight should only be done *once*! 2017-05-17 12:44:35 +02:00
WaLLy3K
075f00cecd Merge branch 'development' into tc-insecure-optout 2017-05-16 09:49:42 +10:00
WaLLy3K
b9f2ba0717 Wording changes and bug fix 2017-05-16 09:48:46 +10:00
Adam Warner
bc8a5916d8
fix merge conflicts 2017-05-14 16:17:04 +01:00
WaLLy3K
da9ff0cc66 Tricorder: Insecure Opt-out
* Check to see if Tricorder is being called directly
* Provide opt-out for insecure transmission of debug log
* Remove mention of internal function from help menu
2017-05-14 19:27:14 +10:00
WaLLy3K
39b74ebfd4 Show help for "pihole checkout --help" 2017-05-14 12:22:19 +10:00
WaLLy3K
4eb7d2868c Fix "pihole disable --help" and "pihole -l --help" 2017-05-14 11:53:40 +10:00
WaLLy3K
b721ed49ab Update Help Output (#1467)
* File consistency

* Tabs to 2 spaces
* Corrected indenting
* Double braced conditionals
* Quoted variables within conditionals

* Standardise core help text

* Added help text for disable command
* Added help text for logging command

* Clean up

* Fixed certain new lines and spaces

* Sync with development branch

* Formatting consistency

* Tabs to 2 spaces
* Corrected indenting
* Double braced conditionals
* Quoted variables within conditionals
* Fixed certain newlines and spaces

* Admin help text

* Added help text for interface command

* Sync with development branch

* Formatting consistency

* Tabs to 2 spaces
* Fixed some wording
* Fixed certain spaces

* Formatting consistency

* Minor wording changes
* Tabs to 2 spaces
* Corrected indenting
* Double braced conditionals
* Quoted variables within conditionals
* Fixed certain newlines and spaces

* Blacklist help text

* Formatting consistency

* Tabs to 2 spaces
* Corrected indenting

* Cronometer help text

* Formatting consistency

* Fixed certain newlines and spaces
* Corrected indenting

* Checkout warning alteration

* Add checkout help text

* Corrected help output
2017-05-14 11:11:44 +10:00
DL6ER
7abf349730
Use echo "ABC" | pihole tricorder to upload to Pi-hole's medical tricorder. Uses SSL if available. 2017-05-13 21:08:21 +02:00
WaLLy3K
c35c7b2cea Wrap in double brackets 2017-05-11 20:21:23 +10:00
WaLLy3K
58353e2839 Update queryFunc() to search Whitelist
If there is a match in Whitelist/Blacklist/Wildcards, `[ ! -t 1 ]` will cause the search to end if the terminal is closed when the script is called. This has the intended effect of allowing a user to search for a W/B/W domain (as well as all the adlists it's found in) using `pihole -q` via Terminal, but the script will stop searching after a W/B/W match when called by the block page.
2017-05-11 19:58:35 +10:00
WaLLy3K
3081c151bd Perform EXACT searches on HOSTS lists correctly
`\s` on the end may be overkill, but it is the existing scanList() behaviour.
2017-05-11 09:13:32 +10:00
WaLLy3K
a0603ad3b7 Update queryFunc()
* Allow scanList() to search files using a wildcard by removing quotes wrapped around `${list}`
* scanList() will not provide a domain ouput on each string if exact is specified (`grep -l`)
* Remove unused processWildcards() function
* Return a message if no domain is specified
* IDN domains are converted to punycode when running a `pihole -q` search if the `python` package is available, otherwise will revert to current behaviour
* Scan Blacklist & Wildcards first, exiting from search if a match is found (Fixes #1330)
* Use one `grep` subshell to search for all "*.domains" lists at once (opposed to looping to get every matching file name, and then spawning a `grep` instance for every matching file)
* queryFunc() will not return "(0 results)" output from files where no match is found
* Sort results based off list number
* Return a message if no results are found
2017-05-02 17:13:55 +10:00
Anthony Giorgio
fd584dd03b Formatting cleanup.
Convert backticks to quotes to fix error message.
Make Pi-hole capitalization consistent.
 Make Pi-hole capitalization consistent.
2017-03-18 20:47:13 -04:00
Mcat12
c4b43f92ce Fix help text bug
Fixes #1325
2017-03-14 13:19:43 -04:00
Dan Schaper
b8f1eadb7f
Shift off checkout from being passed to script from pihole
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-03-08 14:17:56 -08:00
DL6ER
8a14a63d5d
Pi-hole checkout feature 2017-03-08 13:16:40 +01:00
DL6ER
dce3e50a00
Check for existence of wildcard blocking list before trying to acces it 2017-03-06 16:44:56 +01:00
Dan Schaper
17b0db6515
Fix for calling -w without -a.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-27 11:40:20 -08:00
Dan Schaper
83b0600863
Carriage return or newline based webcalls.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-27 11:03:57 -08:00
Dan Schaper
38961fb31b
Help text clarification and addition of the automated debuggin flag.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-27 10:49:25 -08:00
Dan Schaper
ba5bbf3523
Modify pihole for -d -a arguments. 2017-02-26 15:36:53 -08:00
Jacob Salmela
7a1a2dec67
update license to EUPL on core files 2017-02-22 11:55:20 -06:00
Markus Napp
19e30b829a Add wildcard description to help text, improve other help texts 2017-02-08 12:42:14 +01:00
Jacob Salmela
51acdfa633
remove pihole -s flag 2017-01-27 10:12:51 -06:00
DL6ER
2935275227
Merge branch 'development' into wildcardblacklisting 2017-01-09 14:53:01 +01:00
Adam Warner
12bec1df68 Merge pull request #1048 from pi-hole/tweak/simplify_webpage.sh
Major simplification of webpage.sh + extend DHCP to IPv6
2017-01-02 14:28:26 +00:00
DL6ER
2b778695b1
Implement querying ad lists support for wildcards (what hell of a bash experience) 2017-01-02 14:27:13 +01:00
DL6ER
40798da6b1 Add blacklisting wildcard support 2016-12-31 12:49:04 +00:00
DL6ER
d0cd39a25f Added space behind :53 to only match port 53 2016-12-28 20:32:56 +01:00
DL6ER
1e627c7e8f Make webpage.sh fully library style 2016-12-28 16:25:14 +00:00
DL6ER
9170488b0a Test if DNS service is listening on local port 53 2016-12-28 15:58:48 +00:00
DL6ER
c674a175ee
Make grep case insensitive 2016-12-23 17:02:56 +01:00
Promofaux
906a1753be specifically comment out gravity.list addn-host 2016-12-14 19:42:20 +00:00
Adam Warner
bebb569c43 Merge pull request #964 from pi-hole/queryadsonlyexactmatches
pihole -q: Add option to show all partial or only exact matches
2016-12-09 23:25:15 +00:00
Mcat12
74e33bb1a0 Merge pull request #973 from pi-hole/taillog
Add tail argument to automatically "tail -f" pihole.log
2016-12-08 16:40:17 -05:00
Mcat12
b591df55b0 Tell user how to exit tail command 2016-12-08 16:35:50 -05:00
Mcat12
b9e0e88fe9 Update pihole 2016-12-08 15:47:30 -05:00
DL6ER
5120d9ec33 Add tail option 2016-12-08 21:15:03 +01:00
DL6ER
c0886cb5c6 pihole -q <domain> is partial matching (as before), pihole -q <domain> -exact is exact matching (new behavior) 2016-12-06 13:18:01 +01:00
DL6ER
294df8690c Do only one grep on each of the lists and count the number of non-empty lines in the result. Improves speed by factor of 2x 2016-12-06 09:55:17 +01:00
DL6ER
fb72ac9904 Show only exact matches for pihole -q 2016-12-06 08:18:49 +01:00
DL6ER
74cb79252c Only looking for blocking entries (do not scan whitelist.txt) 2016-12-05 17:12:28 +01:00
DL6ER
6cd3c93472 Also query white- and blacklist 2016-12-05 17:09:49 +01:00
DL6ER
eb63e75379 No need for pipe here 2016-12-05 17:06:20 +01:00
Dan Schaper
2ec4acfe52
Begin fixing exit values.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2016-12-01 12:21:08 -08:00
Mcat12
3ba7d7640f Merge pull request #933 from DL6ER/delayedreactivation
Add possiblity for delayed reactivation of blocking
2016-11-21 08:26:26 -05:00
DL6ER
7bf0985a57 Extended help text of main pihole command 2016-11-21 11:30:34 +01:00
DL6ER
f50cbe74cb Changed -web (webpage) to -a (admin) 2016-11-20 15:15:27 +01:00
DL6ER
291ca0874a Fixed two more typos 2016-11-18 12:16:26 +01:00
DL6ER
96f2aa1803 fixed typo 2016-11-17 23:36:53 +01:00
DL6ER
c6857501aa Removed check for availability of nohup 2016-11-17 23:31:11 +01:00
DL6ER
3aba1607b2 Removed debug echos 2016-11-17 23:04:46 +01:00
DL6ER
f667298b64 Added possiblity for delayed reactivation of blocking 2016-11-17 22:58:00 +01:00
DL6ER
db278d81e4 Added webpage.sh 2016-11-16 21:34:43 +01:00
Dan Schaper
1d64ad1ccd Stash all changed files, clean directory and pull updates. 2016-11-02 10:39:27 -07:00
Dan Schaper
dfb4ac0365 Keep .yml's from going to user local repos. 2016-11-02 09:52:15 -07:00
Dan Schaper
0ef8832b04 whitespace 2016-11-02 09:36:30 -07:00
Dan Schaper
e42a037b7d Grep -i instead of cat. 2016-11-02 09:28:00 -07:00
Dan Schaper
fe18d69b65 Grep should start at the beginning of line to make sure it doesn't fire on # beginning lines. 2016-11-02 09:25:32 -07:00
Adam Warner
f36e4ba336 Cherry picking 3f049fa79, conflict fix 2016-11-02 04:34:02 -07:00
Adam Warner
c47c5e466f consistency 2016-11-02 04:18:52 -07:00
Promofaux
1d21b0da9a enable or disable logging from pihole command 2016-11-02 04:10:43 -07:00
Adam Warner
469ff45f01 create list.sh. Combines whitelist and blacklist scripts in an effort to reduce code duplication.
update pihole script to reflect new white/blacklist command.
2016-10-26 09:36:02 +01:00
Promofaux
8ee98f0a4a remove a space 2016-10-23 19:47:31 +01:00
Promofaux
82e78fb651 Add output to pihole disable and pihole enable 2016-10-23 19:44:40 +01:00
Promofaux
d0826b2c33 Merge branch 'development' of https://github.com/airencracken/pi-hole into airencracken-dev 2016-10-23 19:33:28 +01:00
Marcus Hildum
640398ced4 Consistency
We went with tabs earlier, may as well make that the "standard".
Easy enough to switch to spaces too if that's desired with expand(1)
2016-10-21 23:17:14 -07:00
Marcus Hildum
5ebfa5ecf7 heredoc for helpfunc in pihole 2016-10-21 22:53:04 -07:00
tuplink
e199f6db87 spelling updates 2016-10-20 21:15:11 -04:00
tuplink
c83dd3ccd7 change spacing 2016-10-20 18:45:27 -04:00
tuplink
78fbafa1cd test out new status logic 2016-10-20 18:40:03 -04:00
Tommy Huff
685b775b68 rework status if statments 2016-10-20 11:24:34 -04:00
Tommy Huff
9056a5a7b6 fix spelling / replace tabs with spaces in help 2016-10-20 11:05:49 -04:00
Tommy Huff
3ca3eaa62c change restartdnsmasq to restartdns 2016-10-20 09:40:45 -04:00
Tommy Huff
aaee895b2b add pihole status web option to return 1 or 0 for easy use with php 2016-10-20 08:58:36 -04:00
Tommy Huff
7d7e17b351 add toggle to enable or disable pi-hole 2016-10-20 08:45:20 -04:00
Adam Warner
b66f23cfd0 account for new update script 2016-10-18 14:19:44 +01:00
Adam Warner
ce46c4dec4 remove prematurely added code 2016-10-18 12:11:02 +01:00
Adam Warner
77e8be09a1 handle passing arguments to version script 2016-10-18 12:07:42 +01:00
Adam Warner
29ad2496b6 don't output "elevating with sudo" in pihole script, just do it. 2016-10-18 12:05:48 +01:00
Promofaux
a43577fa26 add reconfigure flag to -r command 2016-10-15 20:43:03 +01:00
Promofaux
090fbd04af Remove ${SUDO} usages and root checks from scripts called by pihole command as they should not be called directly. 2016-10-15 17:54:04 +01:00
Promofaux
461de48625 function declarations as per basic-install.sh 2016-10-15 17:25:17 +01:00
Promofaux
9352ba6e4a about time we exit 0'd 2016-10-15 17:16:44 +01:00
Promofaux
5e883239f9 remove calls for ${SUDO} as per basic-install.sh. 2016-10-15 17:15:59 +01:00
Promofaux
5ea08a2120 add -r to reconfigure pihole (basically runs basic-install.sh from /etc/.pihole) 2016-10-15 17:07:08 +01:00
Promofaux
1a83988e26 Add check at the beginning of update script to check for existence of local repos. If not, redirect user to run install command again. 2016-10-01 16:56:03 +01:00
Promofaux
ec0c68621c add blank line after Current version display 2016-09-12 19:40:34 +01:00
Promofaux
d58f7c6ec9 Remove references to dashboard update Script 2016-09-12 19:08:33 +01:00
Promofaux
d124c2c12e Expand to check web admin versions 2016-09-12 18:57:19 +01:00
Promofaux
0229f70761 Make updatePiholeFunc a bit smarter. Only run update if version is not the latest. 2016-09-12 18:29:04 +01:00
Promofaux
dde9281139 Only pull master branch, the rest aren't needed! 2016-09-12 18:12:31 +01:00
Promofaux
4ec01769cb Appease Jacob. 2016-09-06 19:21:56 +01:00
Promofaux
19b656132d Make the output of pihole -q a bit clearer. Bye Bye nifty one-liner! 2016-09-06 19:16:04 +01:00
Promofaux
01a9534729 Merge branch 'development' into UpdateMethod
# Conflicts:
#	automated install/basic-install.sh
2016-08-30 19:32:40 +01:00
Promofaux
d938f73207 Fix line endings 2016-08-26 23:10:22 +01:00
Promofaux
344e63c2dc Add undocumented argument to install script ("pihole") which allows the pihole command to run the update script without prompting the user. Useful for update automation 2016-08-26 23:06:35 +01:00
Promofaux
681144b2a3 Change the switched for updateDashboard and updatePihole(was updateMain) 2016-08-26 22:52:44 +01:00
Adam Warner
77135ca3c7 Actually pass through the argument to the function 2016-08-26 10:09:39 +01:00
Adam Warner
29b548f07c Add queryfunc 2016-08-26 09:39:27 +01:00
Dan Schaper
af666e2209 Escape space in updateMainFunc
Legacy space in path strikes again!
2016-08-20 18:37:35 -07:00
Promofaux
2f2e746e56 Add update function to pihole script 2016-08-21 02:23:11 +01:00
Promofaux
c0430a2248 It wouldn't be me if there weren't loads of commits for simple mistakes. 2016-08-19 23:10:56 +01:00
Promofaux
6796b8bdad pass argument from pihole command to gravity for -f check 2016-08-19 23:06:56 +01:00
Promofaux
2bc364023a Remove erroneous space in chmod command
Fix spacing in help function
2016-08-02 23:51:53 +01:00
Promofaux
6a17a3eeec Add command to pihole script 2016-08-02 19:44:11 +01:00
bcambl
27a9642090 check for sudo via 'command -v' instead of dkpg-query 2016-06-11 15:58:49 -06:00
Promofaux
b6e1b3bff0 Last one, promise! tabs are behaving strangely here... 2016-04-10 21:43:12 +01:00
Promofaux
1ce888e828 more whitespace fixes...... 2016-04-10 21:41:46 +01:00
Promofaux
1c10a801dc Fix whitespace... 2016-04-10 21:39:44 +01:00
Promofaux
48fa83c9ac Fix whitespace 2016-04-10 21:36:33 +01:00
Promofaux
05e0003555 Fixes issue #453 2016-04-10 21:17:58 +01:00
Adam Warner
0b480c2d3f remove redundant else, add ! to if logic. 2016-04-06 09:36:41 +01:00
Adam Warner
96f3f863e5 Clean up output. Commented out un-needed root/sudo notification 2016-04-06 09:28:24 +01:00
Adam Warner
3877f6fd94 Fix arguments not being passed through to chronometer.sh 2016-04-06 09:27:46 +01:00
Promofaux
5976b20aec Fix spelling mistake, remove unaccessed function. 2016-04-03 18:25:39 +01:00
nate
1a2046a7eb Added uninstall option to pihole command. Minor fixes 2016-04-02 19:20:54 -05:00
nate
d47fbbbe96 Mcat12 requests. Added bash-completion support 2016-04-02 17:58:10 -05:00
Renamed from pihole.sh (Browse further)