Commit graph

149 commits

Author SHA1 Message Date
Jesse Becker
a5f2305947 Check if files are readible, not just present 2015-09-12 00:05:19 -04:00
Jesse Becker
1e7f843993 Simplify (and speed up slightly) awk/sed domain name extraction 2015-09-12 00:03:56 -04:00
Jesse Becker
47abe65090 Store block lists in temp file, intead of RAM.
Storing the output from 'curl' commands directly as shell variables is
very inefficent, and requires much more RAM gravity.sh any time there is
an update to the block lists (and especially on the first run).  Store
the raw blocklists in a temporary file on disk, and process those.
2015-09-11 23:26:25 -04:00
Jacob Salmela
23713d82a0 1.6 million instead of 900,000
Updating to reflect the latest amount of domains the Pi-hole blocks.
2015-09-06 10:16:11 -05:00
Jacob Salmela
e19a6c3624 Merge pull request #38 from korhadris/master
Fixes #32 and fixes #35
2015-09-06 10:11:39 -05:00
jacobsalmela
2792238472 Merge remote-tracking branch 'origin/development' 2015-08-26 18:08:19 -05:00
jacobsalmela
fa77b7b69d increase swap to fix #37 memory error
This will increase the swap file to 500MB before downloading the lists.
 Most of the issue comes from the mahakala list, which is so large.  If
no swap file is found, one is created.
2015-08-25 18:01:54 -05:00
jacobsalmela
d68c262b96 swap file to eliminate memory allocation error 2015-08-24 16:30:00 -05:00
korhadris
98c94912e1 Replace use of grep -w with grep -x.
Prepend "^" to start of latentWhitelist.txt lines.

The -x switch requires a full line match of the regexp, where as -w
will try to find the match somewhere in the line, looking for work
breaks. Combined with turning the whitelist lines into full regexps,
this results in significantly faster parsing.

Having "^" prepended to the lines also keeps false whitelisting from
occuring, such as the following example:

If whitelist.txt contains "google.com" it would whitelist many other
sites that end in "google.com" as long as there is a non-word
character preceeding the google (such as "-", or ".").
2015-08-22 23:37:01 -07:00
korhadris
a26377d229 Append ad list sources to latentWhitelist.txt to prevent them from being filtered.
Additional fixes for #35. This will prevent our own sources from being
filtered out by competing source lists.
2015-08-22 21:44:41 -07:00
korhadris
e464c04490 Ignore domains in ad lists that do not contain . characters.
This will skip entries such as `localhost`, `android`, `debian` and
empty lines as listed in #35.
2015-08-22 17:47:22 -07:00
korhadris
bb7db11214 Changing printouts when updating sources to tell what is going on when
manually running gravity.sh

This will print "Getting $domain list... " for each domain, followed
by either "Done" if data was received and validated, or "Skipping
list because it does not have any new entries" if no updates were
needed.
2015-08-22 17:33:30 -07:00
korhadris
1f29d01694 Remove leading and trailing whitespace and . characters and
duplicate `.` characters as each list is stored.

Should fix #32.
2015-08-22 17:05:19 -07:00
korhadris
d6d192cb0a Use url variable to store ${sources[$i]} value to improve readability.
I also wanted to replace the for loop iterating over indices with
something like:

`for url in $sources[@]}`

It made the use of `$i` in the save location more annoying though.
2015-08-22 16:22:07 -07:00
korhadris
0ec6eab683 Appending ".$justDomainsExtension" to $saveLocation variable.
Every use of $saveLocation was adding this and making lines
longer.
2015-08-22 16:04:54 -07:00
korhadris
159b29b80b Replace spaces with tabs to make indentation consistent within the file. 2015-08-22 15:56:32 -07:00
Jacob Salmela
77a3c5f8b3 Merge pull request #33 from mathiasschopmans/patch-1
Fix URL of chronometer.sh
2015-08-10 15:53:15 -05:00
Mathias
46bda342a9 Fix URL of chronometer.sh
Github URLs seems to be case-sensitive. Now the chronometer.sh souldn't contain "Not Found" anymore. ;)
2015-08-10 22:50:06 +02:00
Jacob Salmela
5ed08b44a5 Merge pull request #29 from Fourdee/master
Patch 3 - Dont use /etc/hosts
2015-07-30 18:49:54 -05:00
Fourdee
52ef76d717 missed a few more /etc/host changes 2015-07-30 18:10:26 +01:00
Dan
024395b73b Update chronometer.sh
Missed a change todaysAdsEliminated to /\/etc\/pihole\/gravity.list/
2015-07-30 18:01:10 +01:00
Fourdee
9d99a4ef36 Patch 3 - Dont use /etc/hosts
/etc/pihole/gravity.list now stores the block list. Ensures the
/etc/hosts file is left untouched.
2015-07-30 17:24:24 +01:00
Jacob Salmela
2d96f005e6 Merge pull request #28 from Fourdee/patch-2
Adjusting chronomiter.sh to use the new /var/log/pihole.log
2015-07-29 18:02:29 -05:00
Jacob Salmela
1a57e6f5b0 Merge pull request #27 from Fourdee/patch-1
Log Pi-hole DNS stats to /var/log/pihole.log instead of the shared /var/log/daemon.log
2015-07-29 18:01:24 -05:00
Dan
9627b27f15 pihole logfile changes
https://github.com/jacobsalmela/pi-hole/pull/27
2015-07-29 12:22:28 +01:00
Dan
9230be63d5 .log extension 2015-07-29 12:20:39 +01:00
Dan
e20f948e49 Log PiHole dns stats to /var/log/pihole
Log PiHole dns stats to /var/log/pihole
Removes the requirement for rsyslog and reading the shared logfile /var/log/daemon.log
2015-07-28 19:34:36 +01:00
jacobsalmela
1ee2d08703 donate buttons and link to Web interface 2015-07-26 18:36:01 -05:00
jacobsalmela
11614263b8 better version of LCD display stats 2015-07-25 13:05:13 -05:00
jacobsalmela
9a2862de62 closes #24 whitelist without running gravity.sh
It's pretty slow because /etc/hosts is so large, but it works.  You can
add any number of domains as arguments and it will search for and
remove each one.

Maybe someone smarter knows how to make it faster...
2015-07-18 09:39:18 -05:00
jacobsalmela
563db80b6d resolves #25
Will not count blank lines if they happen to exist.
2015-07-17 20:49:03 -05:00
jacobsalmela
8f961c1aaa resolves #22
This lets dnsmasq re-read the hosts file without disturbing the daemon.
 So any new entries can be used as soon as gravity.sh is finished
running
2015-07-17 13:05:38 -05:00
Jacob Salmela
bfd536402c Merge pull request #23 from rmceoin/master
Parses host only file formats now.
2015-07-16 21:44:41 -05:00
rmceoin
f6ccb4b658 Merge remote-tracking branch 'upstream/master' 2015-07-13 09:55:53 -07:00
rmceoin
37e926ce84 Parses host only file formats now. Previously only handled hosts file format.
Specifically, it can now handle the following list:
'http://mirror1.malwaredomains.com/files/justdomains'
2015-07-13 09:28:45 -07:00
jacobsalmela
5c4bfb84b0 uses a variable for hostname instead of raspberrypi
Some people use a hostname other than raspberrypi, so their hostname
did not resolve to 127.0.0.1.  I replaced that hardcoded value with a
variable so that does not happen.

I also added a few comments and minor formatting adjustments,.
2015-07-13 06:59:22 -05:00
Jacob Salmela
a908dfdd28 Merge pull request #21 from rmceoin/master
Strip carriage returns on matter so that whitelists work correctly.
2015-06-22 16:45:30 -05:00
rmceoin
552f980430 blacklist was being concatenated with wrong matter 2015-06-22 13:33:02 -07:00
rmceoin
66bb0e7bb3 Strip carriage returns on matter so that whitelists work correctly. Lines that had \r would not match. 2015-06-22 13:03:15 -07:00
jacobsalmela
6953c02402 detect original pihole and backup
Detects if the Pi had an original Pi-hole by looking for adList.conf.
If it exists, it backs up all the files to /etc/pihole/original.  Then,
the script continues as normal and creates the new files.  This helps
ensure that /etc/hosts and /etc/dnsmasq.d/adList.conf are not being
used simultaneously.
2015-06-21 07:53:29 -05:00
jacobsalmela
9d700d75b6 Update to reflect #20
You can add your own config file to permanently set variables used in
the gravity script.  If the file exists, gravity.sh will detect it and
apply your custom variables.  This is useful so when there is an update
to the gravity script, you do not need to adjust the variables every
time.
2015-06-21 07:53:29 -05:00
Jacob Salmela
019e1228ab Merge pull request #20 from rmceoin/master
If exists, import a config file to allow for overriding script variables.
2015-06-19 20:07:33 -05:00
rmceoin
e9324f8316 Use double brackets for the test. 2015-06-19 17:54:12 -07:00
rmceoin
b7e2c8053b Add local-ttl to dnsmasq config so that queries are cached by the requesting device. 2015-06-19 14:10:48 -07:00
rmceoin
67aba8c496 If exists, import a config file to allow for overriding script variables. 2015-06-19 13:31:51 -07:00
jacobsalmela
a2350ba880 misspelled "install" 2015-06-16 17:23:48 -05:00
jacobsalmela
9855041a57 Merge branch 'hostsformat' 2015-06-16 17:01:55 -05:00
jacobsalmela
fd2b24f2a0 preparing files for merge and for testing automated install
I haven't merged anything before, so hopefully, I won't mess it up too
bad!
2015-06-16 11:15:15 -05:00
jacobsalmela
655a584941 Updated README to reflect changes 2015-06-13 22:26:19 -05:00
jacobsalmela
e8b33ec8ee Automated installer test 2015-06-13 22:14:21 -05:00