Giter VIP home page Giter VIP logo

python-hosts-tool's Introduction

Build Status PRs Welcome

LinkedIn Github slack

python-hosts-tool

Manage /etc/hosts in an organized way by Python

Read more: https://www.dennyzhang.com/audit_hostsfile

Principle:

  • Be safe: When remove, make sure it's an exact match; When add, make sure no conflicts
  • Can audit: backup old version, if we have changed it

Online Usage

##        # Examine hosts file, and detect unexpected changes
##        python ./python-hosts-tool.py --action examine --examine_hosts_file ./tests/test_hosts
##
##        # Add a list of new hosts entries
##        python ./python-hosts-tool.py --action add --add_hosts_file ./tests/test_hosts
##
##        # Remove a list of existing hosts
##        python ./python-hosts-tool.py --action remove --remove_hosts_file ./tests/test_hosts

How to Install

pip install python-hosts==0.3.7
# get the tool
wget -O python-hosts-tool.py \
    https://raw.githubusercontent.com/DennyZhang/python-hosts-tool/master/python-hosts-tool.py

# Or git clone
git clone [email protected]:DennyZhang/python-hosts-tool.git

How to Use

cat ./tests/test_hosts
45.33.87.75 www.dennytest.com
104.236.158.226 repo.dennytest.com
  • Run command

How To Run test

cd tests
sudo bash -ex ./test.sh

TODO Items

  • Send PR for safe delete to python-hosts

https://github.com/jonhadfield/python-hosts

https://pypi.python.org/pypi/python-hosts/0.3.7

Code is licensed under MIT License.

python-hosts-tool's People

Contributors

dennyzhang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.