Git Product home page Git Product logo

dnssync's Introduction

dnssync

The goal of this project is to generate a custom hosts file to be used with a local dns resolver for manually specifying DNS names.

This project uses scapy to send an ARP broadcast packet, and record the results into a yaml file.

The domains which are set in will generate a hosts file when re-run.

This can then be used as a hosts file for pihole's custom DNS file allowing you to register your computer as my-computer.home for example.

Requirements

  • scapy requires raw socket acess:
    • root or CAP_NET_RAW given to the application
  • poetry to install dependancies

How to use

  1. Clone repo
  2. Create virtual env
  3. Run poetry install
  4. Run with python -m dnssync

First Run

On first run it will generate a file with a list of hosts in a file called hosts.yaml

tld: null
hosts:
  - domain: null
    mac: aa:bb:cc:dd:ee:00
    ip: 192.168.0.2
  - domain: null
    mac: aa:bb:cc:dd:ee:01
    ip: 192.168.0.3
  - domain: null
    mac: aa:bb:cc:dd:ee:02
    ip: 192.168.0.4

Edit this file to include the domains that you wish to create rules for:

tld: home
hosts:
  - domain: my-computer
    mac: aa:bb:cc:dd:ee:00
    ip: 192.168.0.2
  - domain: null
    mac: aa:bb:cc:dd:ee:01
    ip: 192.168.0.3
  - domain: my-laptop
    mac: aa:bb:cc:dd:ee:02
    ip: 192.168.0.4

Subsequent Runs

It will rescan and add any new found hosts

It will then generate a file called custom.list in the hosts file format:

For example:

192.168.0.2 my-computer.home
192.168.0.4 my-laptop.home

This file can then be copied or symlinked.

pihole uses /etc/pihole/custom.list for custom mapping.

I use a docker compose version of pihole and replace that file with a symlink.

Limitations

Not all hosts may respond to broadcast packets

Ping scan could be a better approach

dnssync's People

Contributors

jonathannakandala avatar

Watchers

 avatar  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.