Steven Black
d39ad733dc
‘hostsFile’ is a better variable name here than ‘dataFile’.
2016-12-18 18:34:41 -05:00
Steven Black
ad2100aaf2
‘hostsfilename’ is a better variable name than ‘datafilenames’.
2016-12-18 18:32:44 -05:00
Steven Black
ac2a06f74b
Updating all sources: add recursive=True to the call to glob()
2016-12-18 17:55:55 -05:00
Steven Black
c022c2b230
Update data regardless fo folder depth using glob.glob().
2016-12-18 11:02:21 -05:00
Steven Black
d1c3921eb7
Restore updateHostsFile.py to 7119b725e7
because the prior commit’s diff is cluded by space/tab changes.
2016-12-18 10:55:35 -05:00
Steven Black
d3b8cc7339
Refactoring in updateHostsFile.py
2016-12-18 00:34:12 -05:00
Steven Black
7119b725e7
Added metadata to Sinfonietta’s hosts source files.
2016-12-11 13:44:51 -05:00
Steven Black
e22e3dc594
Create a sourcesdata hash for each flavor of hosts file generated.
2016-12-11 12:22:51 -05:00
Steven Black
3f4bfa2d70
Code commenting.
2016-12-11 12:22:02 -05:00
Steven Black
d089583a45
This code is never called.
2016-12-11 12:21:38 -05:00
Steven Black
962010ddcc
Issue #208 : fix - save the source data to populate the reame files.
2016-12-10 23:52:42 -05:00
Tom Hoover
1e4de72b65
add an optional blacklist file
...
The contents of this file (containing a listing of additional
domains in 'hosts' file format) are appended to the unified hosts
file during the update process.
2016-12-10 14:17:56 -06:00
Steven Black
a6fcff9f22
Change update.info files to update.json, update the python generators, and docs.
2016-12-09 20:59:43 -05:00
Steven Black
f2f6a18440
Issue #188 : Optionally create a hosts.zip file in addition to the hosts file.
2016-10-16 23:07:06 -04:00
cryzed
85ada890ba
Handle the auto flag in promptForFlushDnsCache
2016-06-13 02:13:36 +02:00
cryzed
fd6769005e
Implement feature proposed in #138
2016-06-12 14:04:38 +02:00
cclauss
b20fa35eba
Update updateHostsFile.py
2016-05-02 10:59:54 +02:00
cclauss
854f2410a1
Update updateHostsFile.py
2016-04-26 17:52:00 +02:00
cclauss
1b46ffd85b
Update updateHostsFile.py
2016-04-26 16:11:51 +02:00
cclauss
9ec9f22dda
Update updateHostsFile.py
2016-04-26 16:03:36 +02:00
cclauss
46877f22c4
Update updateHostsFile.py
2016-04-26 15:49:31 +02:00
cclauss
5e08804cec
Use 'with open() as' to automaticly close() files
2016-04-26 15:46:14 +02:00
Indrajit Raychaudhuri
8c089ff0ef
Add option to skip static localhost entries in the final hosts file.
...
This is particularly handy when you want to add the generated hosts file
as additional static 'hosts' file in DNS servers without affecting the default
`/etc/hosts`.
For example, `--addn-hosts=<file>` in dnsmasq [1] can be used exactly for this
purpose.
[1] http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
2016-04-19 14:44:39 -05:00
Steven Black
3b30ff8000
Sort the display of --help options.
2016-04-03 21:30:46 -04:00
Steven Black
b194e25020
Now the backup feature is optional, default is no backup.
2016-04-03 21:29:47 -04:00
Steven Black
6f60a86fad
Typo in settings key. Fixes #126 .
2016-04-03 21:19:41 -04:00
Steven Black
60c43d299b
Issue #118 : fix – resolve problems with whitelisting domains.
2016-04-01 23:49:22 -04:00
itachi46
6f1484a01c
Fixed file not found error due to relative path
...
When updateHostFile.py is not run from the project directory we get a file not found error trying to find readmeData.json
2016-03-31 23:35:42 +11:00
Steven Black
6dc8c77b64
Tweak for updatehostsfile.py which wasn't updating extension sources.
2016-03-28 23:04:34 -04:00
Steven Black
ef37166285
Style: normalize the code to double quotes for strings.
2016-03-28 13:27:17 -04:00
Steven Black
b996001c95
Scope management.
2016-03-25 23:45:18 -04:00
Steven Black
92e8e4d8d9
Whitespace.
2016-03-25 23:44:54 -04:00
Steven Black
2d44d18af6
Jettison legacy codeblock.
2016-03-25 23:44:22 -04:00
Steven Black
30e5d843d4
Issue #77 : fix bug with emitting comments.
2016-03-24 23:34:28 -04:00
Steven Black
94ea41fa16
Issue #77 : fix — account for empty lines.
2016-03-24 18:32:46 -04:00
Steven Black
883faf0f64
Issue #77 : fix - trim trailing whitespace from input lines.
2016-03-24 18:27:24 -04:00
Steven Black
97ef0fdded
Issue #117 — fix: restart network.service if applicable.
2016-03-24 18:07:17 -04:00
Steven Black
a0a884c2de
Better header section in the unified hosts file.
2016-03-24 10:29:51 -04:00
Tomasz Przybył
9ff912af5f
fix typo in IP address @ 392 line
2016-03-24 10:54:23 +01:00
Steven Black
5f7c9cbd1c
Global ectomy.
2016-03-24 01:10:13 -04:00
Steven Black
c2aed66c83
Moved the Python3 test earlier.
2016-03-23 23:36:47 -04:00
Steven Black
d1da3e6638
Function updateReadme is now orphaned.
2016-03-23 21:26:20 -04:00
Steven Black
97fba05f22
Nor update the readmeData.json file for each build.
2016-03-23 00:36:01 -04:00
Steven Black
8212663c8d
Merge pull request #105 from itachi46/improve-dns-flush
...
Added dnsmasq and better messaging
2016-03-20 12:47:08 -04:00
Steven Black
f18700c676
Merge pull request #110 from matkoniecz/hostname
...
include 127.0.1.1 <hostname> line
2016-03-20 12:17:41 -04:00
Steven Black
4e0e298217
Merge pull request #112 from matkoniecz/refuse_update
...
make -n working not only in combination with -a
2016-03-20 12:16:38 -04:00
xXKingRalphXx
86df89d33e
Shortened python version check in updateHostsFile.py
2016-03-19 22:17:36 -04:00
itachi46
0649aa1c8c
Changed variable
...
changed variable name of dnsFlushedOccured to dnsCacheFound to better indicate what the value represents
2016-03-19 12:35:22 +11:00
Mateusz Konieczny
6395934dfa
include 127.0.1.1 <hostname> line
...
partial, maybe full fix for #109
2016-03-18 21:32:45 +01:00
Mateusz Konieczny
4ce0fbdf3f
make -n working not only in combination with -a
...
fixes #107
2016-03-18 21:27:09 +01:00
itachi46
408069da79
Added dnsmasq and better messaging
...
* Added restarting dnsmasq as a way to flush DNS cache
* Added success messages to services being restarted
* Added an error message if none of the conditions were met instead of
silently failing
I did not really touch OSX side of the things as I am not sure what the
command does and I do not have access to an OSX box.
2016-03-18 18:24:04 +11:00
Steven Black
190a53c4cf
Note the number of unique domains in each hosts file's header.
2016-03-16 00:33:49 -04:00
Steven Black
c565266416
Making it work in Python3.
2016-03-13 11:59:25 -04:00
Steven Black
31ea0fc25b
Fixes #102 .
2016-03-13 11:24:17 -04:00
Steven Black
e946d6fa8f
Improved the readme.nmd files in subfolders.
2016-03-13 03:02:26 -04:00
Steven Black
9923ed2194
Create different readme.md for different extension combinations.
2016-03-13 01:47:56 -05:00
Steven Black
a081330fea
New option to pre-empt data source updates.
2016-03-12 23:44:49 -05:00
Steven Black
d67a7bc3be
Create the output folder if it doesn't pre-exist.
2016-03-12 23:44:23 -05:00
Steven Black
ec5178b7a5
Adding optional output path argument.
2016-03-12 23:17:37 -05:00
Steven Black
3de2d618c8
Issue #92 : fix - update.info is now treated as a list.
...
Can now have several URLs, one per line, in update.info files.
2016-03-05 20:28:32 -05:00
Steven Black
76fe64ba90
Amalgamated -> Unified.
2016-02-27 20:16:41 -05:00
Steven Black
bee5292c80
Improve amalgaated hosts file heading.
2016-02-26 22:55:07 -05:00
Steven Black
513bdd1ce8
Only process source folders, and not files that may be present.
2016-02-23 09:50:20 -05:00
Steven Black
01915623a8
Typo.
2016-02-23 09:36:33 -05:00
Steven Black
a3ac83b67d
More succinct formatting of the generation time.
2016-02-23 09:30:34 -05:00
Steven Black
ffc17dd7fa
Issue #57 : fix - ignore blank lines in the whitelist.
2016-02-22 21:48:02 -05:00
Steven Black
b96412650a
New command-line option, --replace, to activate host file replacement when in --auto mode.
2016-02-22 21:26:52 -05:00
Steven Black
3dde2e39d2
Changes to support extensions.
2016-02-22 19:20:20 -05:00
Steven Black
40eb85a797
First code alterations for extensions.
...
This is still WIP.
2016-02-22 10:22:26 -05:00
Steven Black
223b9409da
Issue #91 : fix - make the date and time windows filesystem-compatible.
2016-02-21 20:55:38 -05:00
Steven Black
e8033bff72
Issue #91 : fix - hoping this works better under windows.
2016-02-21 11:37:03 -05:00
Steven Black
012c6a49b0
Add 'fe80::1%lo0 localhost' which is in the OS X default hosts file.
...
Partly addresses Issue #86 and its arising discussion.
2016-02-20 19:33:29 -05:00
Steven Black
76ea0b54c8
Fix rendering of the 'local' domain found in someonewhocares.org. Resolves #89 .
2016-02-19 10:12:26 -05:00
Steven Black
ab129243b8
Add localhost.localdomain and broadcasthost to the base hosts. This fixes Issue #87 .
2016-02-19 08:10:03 -05:00
Steven Black
691a3f5e2e
Use 'GMT' instead of +0000 notation.
2016-02-16 11:26:17 -05:00
Steven Black
f57714c1d7
Better way to express the updated date.
2016-02-16 11:24:45 -05:00
Steven Black
c28bef1376
Update the readme to include a freshness date.
2016-02-16 11:21:45 -05:00
Steven Black
af4c7865b5
Issue #75 : pass-in the target IP address as an option.
...
Use option --ip nnn.nnn.nnn.nnn or -i nnn.nnn.nnn.nnn to specify the IP address you want in the amalgamated hosts file.
2016-02-15 17:06:38 -05:00
Steven Black
35a16da7a1
TARGET_HOST is now targetIP.
2016-02-15 16:16:42 -05:00
Steven Black
e3a11f0d59
Removed needless line feed in header.
2016-02-15 16:11:30 -05:00
Tomasz Przybył
3a2cee341f
Automatically restart wicd service rule
...
@StevenBlack
Regards
2016-02-15 19:21:23 +01:00
Steven Black
a4b254d1cf
Issue #77 : fix - replace tabs with space.
2016-02-15 12:36:38 -05:00
Steven Black
d69aa1add3
Issue #77 : fix - Remove spurrious spaces.
2016-02-15 12:29:02 -05:00
Steven Black
9b28b369e8
Add a link to the latest raw version of the hosts file.
2016-02-15 10:43:29 -05:00
gigaslayer131890
df45003106
Modified the removeOldHostsFile() function to keep backups of the old hosts file.
2016-02-14 23:15:22 +00:00
Steven Black
8930205670
Suppress marginal messages in --auto mode.
2016-02-13 21:06:37 -05:00
Steven Black
32cde9692e
Less verbose when echoing source updates.
2016-02-13 20:53:22 -05:00
Steven Black
1eb1509e41
Import argparse, and add an --auto flag to run the update and merge with no prompts.
2016-02-10 22:35:09 -05:00
Steven Black
ea43296b84
Remove initialized but thereafter unused variables.
2016-02-07 20:25:33 -05:00
Steven Black
d167327b2a
Added local pylint directives.
2016-02-07 20:09:42 -05:00
Steven Black
5dfa76790d
Going with pylint's recommendation for singleton comparisons.
2016-02-07 19:41:44 -05:00
Steven Black
ff682e2a0d
Standardize on double quotes in print() calls everywhere.
2016-02-07 19:37:27 -05:00
Steven Black
b3e770c4b4
Split long code lines.
2016-02-07 19:34:27 -05:00
Steven Black
708d5a9dad
Removed more superfluous parens.
2016-02-07 19:32:00 -05:00
Steven Black
eb00a6ca08
Removed unnecessary semicolons.
2016-02-07 19:28:31 -05:00
Steven Black
873cb4c0d4
Split long code line.
2016-02-07 19:25:32 -05:00
Steven Black
066ae7893c
Removed superfluous parens.
2016-02-07 19:23:40 -05:00
Steven Black
ed144fcd58
Split long code line.
2016-02-07 19:20:29 -05:00
Steven Black
204c825080
Removed spaces after '(' and before ')'.
2016-02-07 19:18:16 -05:00
Steven Black
72326608a5
Indent with spaces.
2016-02-07 19:15:05 -05:00
Steven Black
ad2c8e8558
Revert "Variable 'target' is never used."
...
This reverts commit 3d281af027
.
2016-02-07 15:53:37 -05:00
Steven Black
3d281af027
Variable 'target' is never used.
2016-02-07 15:35:36 -05:00
FadeMind
facba836c4
automatic systemd NetworkManager service restart
2016-01-29 15:02:22 +01:00
Steven Black
eeb6c54b13
Better handling of download errors.
2016-01-02 18:57:23 -05:00
Steven Black
9bf03dd7c9
Add at the top.
2015-11-23 09:07:36 -05:00
FrancoGag
459fb01471
Don't print '::1 localhost'
2015-11-21 10:19:25 -03:00
Steven Black
a7c73805eb
Fix IndentationError.
2015-11-20 22:12:57 -05:00
Steven Black
d372865698
Refactor: whitespace for consistency and readability.
2015-11-20 22:10:49 -05:00
Steven Black
e35ca1ecae
Merge pull request #45 from hd074/master
...
hotfix for duplicates and artefacts
2015-11-20 21:09:39 -05:00
Hannes Domschke
2b18fa1e1a
better delete after updating so we dont end up with an empty hosts file if update goes wrong and causes a crash
2015-11-15 23:23:06 +01:00
Hannes Domschke
5f2bb91173
hotfix for duplicates and artefacts
2015-11-15 22:38:07 +01:00
Franco Gagliardi
cdaffa0202
Removed sys.exit()
2015-11-15 16:19:53 -03:00
Franco Gagliardi
0b0988eeef
Check if 'hosts' file exists
...
We need to check that the file exists before trying to update it, and if it doesn't we try to create an empty 'hosts' file.
2015-11-14 22:32:17 -03:00
Steven Black
845bad283a
Why list the local data file name. I don't get it.
2015-11-09 23:10:42 -05:00
Steven Black
544490e99a
Not happy with the way this lists not the source URLS, but the local file names.
2015-11-09 23:03:23 -05:00
Steven Black
c0766a4e87
Better handle the no-domain-in-the-line error in data. This closes #38 .
2015-11-09 23:00:37 -05:00
FrancoGag
d1dba20663
Renamed removeDups() to removeDupsAndExcl()
...
Renamed removeDups() to reflect that now the function also excludes domains and keywords in the whitelist.
2015-11-09 17:09:59 -03:00
FrancoGag
e1d41823bd
Fixed: Exclude domains in the whitelist (2)
...
Now it probably works with Python 3 and the code is much cleaner.
2015-11-07 17:54:36 -03:00
FrancoGag
6a07a22b61
Fixed: Exclude domains in the whitelist
...
It still can be improved but now it's working as it should.
Not tested with Python 3. Working with Python 2.7.10
2015-11-07 17:01:55 -03:00
FrancoGag
461b06710c
Exclude domains contained in a whitelist
2015-11-05 10:44:42 -03:00
FrancoGag
091a18ee8d
Update updateHostsFile.py
2015-11-05 09:38:08 -03:00
FrancoGag
45fa325d42
Delete .DS_Store from Data
...
If the Data folder is opened in OSX it creates a .DS_Store file and the python script tries to use it a source and returns errors, deleting it solves this issue.
2015-11-04 11:47:55 -03:00
Steven Black
90ad37d6fc
Merge pull request #34 from qutorial/myhosts
...
Update to include preamble handling
2015-10-30 11:05:59 -04:00
Zaur Molotnikov
05eef7214c
Fixed ubuntu hosts file relaod
2015-10-30 11:18:08 +01:00
Zaur Molotnikov
7934f87b41
Update to include preamble handling
2015-10-30 11:13:21 +01:00
Steven Black
aa8b9508e0
File is unavailable. Don't raise this error; just eat it.
2015-10-28 19:33:59 -04:00
Steven Black
1e24a1996f
Trim whitespace in updateHostsFile.py
2015-10-28 19:33:16 -04:00
Zaur Molotnikov
d516616750
Cross-python implementation
2015-10-27 00:29:53 +01:00
Zaur Molotnikov
6f6693c17a
Migrated to Python 3
2015-10-26 23:16:55 +01:00
qqo
10c4449774
'suffix' in regex matches empty string on all the data files, except
...
one (incorrect) line containing port:
0.0.0.0 telemetry.appex.bing.net:443
The resulting entry in hosts file generated like this:
0.0.0.0 telemetry.appex.bing.net :443
which is incorrect. The bug was not spotted only because the incorrect
line in the data source was after the correct line without port,
thus it was ignored and not added to resulting hosts file.
2015-10-24 01:43:18 +03:00
qqo
d810d25178
Explicitly lowercase hostname to prevent mixed-case duplicates.
2015-10-24 00:58:12 +03:00
Zaur Molotnikov
7e8b1674fb
os.path.join introduced
2015-10-19 12:27:41 +02:00
Steven Black
cdb945e45e
Prettier formatting of the number of host records.
2015-10-17 20:23:33 -04:00
Steven Black
4998b31f24
Host file now lists 127.0.0.1 localhost, 0.0.0.0 the others.
2015-10-06 17:05:09 -04:00
Steven Black
da11d3239c
Reverting the target host back to 0.0.0.0.
2015-10-02 21:06:51 -04:00
Steven Black
71499a4153
Fix the update script so we don't write any dupes.
...
Signed-off-by: Steven Black <steveb@stevenblack.com>
2015-09-23 23:55:36 -04:00
Steven Black
a03314573c
Replace the target host from 0.0.0.0
with 0
.
2015-09-23 19:02:26 -04:00
Steven Black
f5d622a413
Issue #8 : fix - Update the stripRule() function to be smarter about whitespace preceding comments. Thanks @caneylan.
2015-01-01 21:35:11 -05:00
Peter Naudus
f459f1a765
Normalizing hosts and better duplicate detction added
2014-05-16 08:13:11 -04:00
Peter Naudus
8d0a7bb783
Added support for ZIP compressed files
2014-05-14 21:55:29 -04:00
Ben Limmer
16e922cdd6
Added query to user for moving the hosts file into place.
2013-07-30 10:59:31 -06:00
Ben Limmer
3e6a5c42c8
Correcting syntax error with elif.
2013-07-13 16:24:06 -06:00
Ben Limmer
4b8995a9af
Added back instructions for Windows users on where to move their hosts file to.
...
Resolves #5 . I'm opening a new issue for adding this for Windows.
2013-07-13 16:08:31 -06:00
Ben Limmer
f2f3e29e3f
Added support for automatically moving the hosts file into place and flushing the DNS Cache for Mac and Linux.
...
This addresses part of Issue #5 , but I still need to do Windows.
2013-07-13 15:57:11 -06:00
Ben Limmer
1e180e78be
Write out how many unique entries were generated in the readme.md file.
...
Resolves #3 .
2013-07-13 14:59:29 -06:00
Ben Limmer
02efc707f1
Print out copy locations on success.
...
Now it's easy to copy/paste where the host file needs to go.
2013-05-29 21:28:49 -06:00
Ben Limmer
9e1b5505c2
Colorized prompts for readability.
...
This commit closes #2 .
2013-02-17 14:49:16 -07:00
Ben Limmer
0f942662cf
Resolves infinite loop error introduced in 997606b
.
...
Whether you entered yes or no to the "more entries" dialog, you'd still be in the loop. Also, we now check to see if the custom domain is blank
2013-02-17 14:39:40 -07:00
Ben Limmer
c722160a9c
Woops, left debug logic in last commit.
2013-02-17 13:55:46 -07:00
Ben Limmer
997606b3f0
Added ability to exclude domains.
...
This commit closes #1 . I always hated that Hulu would freak out when I generated a new hosts file. It checks to make sure that it can access its ad servers before it will start streaming. I'm assuming people have other sites similar to this, so the script now can be extended with common and custom domains to exclude.
2013-02-17 13:51:49 -07:00
Ben Limmer
47f8f40b92
Added script to handle updates to hosts sources.
...
updateHostsFile.py can handle either simply combining local hosts files you have checked in, or it can
go out to the Internet to update your source files. It also handles automatically generating a header
and removing duplicates from the list.
2013-02-09 19:55:04 -07:00