A great python/java dynamic DNS service for NameSilo, with log, email reminder...

Overview


简体中文 | English

NameSilo DDNS is a DDNS service for NameSilo domain names for home broadband , it can automatically detect IP changes in home broadband and automatically update the resolution of the domain name.

This project has been refactored via Python3, to view the Java version please switch branches.

This program is only available for domain names purchased on NameSilo.

This program obtains the public IP address of home broadband by visiting http://202020.ip138.com/, and queries and updates the DNS status by https://www.namesilo.com/api/.

It would be the best encouragement for me to get your STAR.

Features

  • Simple configuration, you can set the frequency of detecting IP changes and refreshing DNS.

  • With email alert function, you will be alerted when there is an abnormality in the process of the service running for a long time.

  • Support multi-platform (Linux, Windows...)

Table of Contents

Background

At present, telecom operators assign to home broadband IP are dynamic, although the IP address is not fixed, but the good thing is that the home router can get a real public IP, so we just need to use router NAT mapping (need router support, set up in the management console) to access the home device in the public network. After the router mapping port 22 we can remotely connect to our home linux machine, and after mapping port 445+3389 we can use the remote desktop of Win10.

网络拓扑图

To solve the problem of changing public IP, you can purchase a domain name and use DDNS (Dynamic Domain Name Server) to resolve the domain name to your broadband's IP. This will allow you to access your home devices by accessing a fixed domain name.

To achieve this, you need a computer that is always running to run this DDNS program.

Install

Download and use

git -b python clone https://github.com/Charles94jp/NameSilo-DDNS.git

Update

mv conf.json conf.json.back
git pull origin python
mv conf.json.back conf.json

Dependencies

A Python3 environment is required. The httpx module also needs to be installed.

pip install httpx

Usage

Configuration

The conf.json file needs to be configured before starting.

Fields Introduction
domain The domain name to be updated must be a subdomain. For example, if you purchase a domain name that is bb.cc, you must build a resolution on NameSilo for a subdomain such as aa.bb.cc.
key The key generated from NameSilo, after generation you need to remember and keep this key.
frequency How often do you detect changes in your ip, and only update your DNS when a change in ip occurs, in seconds.
mail_host For example, you can use Google Mail's POP/IMAP
mail_port
mail_user The login user name, which is also the email sender.
mail_pass passwd or key
receivers An array to hold the recipient's address.

The last five configurations are not required. Only after all five are filled in will the email alert feature be enabled.

Note

This program can only update the DNS record of a domain name, it cannot be added, please make sure this DNS record exists for your domain name and it needs to be a sub-domain.

Start

Direct start

python ddns.py

Linux usage:

chmod +x DDNS
./DDNS {start|stop|status|restart|force-reload}

Example

Windows usage: Double-click the bat or vbs file, please check the log for the running status of the program.

Start At Boot

Linux

Set up start at boot, only CentOS 7 is demonstrated, please write your own script for other Linux distributions.

First edit the DDNS file, change the 8th line to the path of NameSilo-DDNS project, change the 17th line to the path of python 3 executable file

Next, register DDNS as a service.

chmod +x DDNS
cp DDNS /etc/init.d/DDNS
chkconfig --add /etc/init.d/DDNS
# check
chkconfig --list

After registering DDNS as a service, you have finished setting the start at boot and you can use DDNS through service.

service DDNS {start|stop|status|restart|force-reload}

Windows

Add the vbs file to the Windows policy group.

You might also like...
Simple Python Script to Parse Apache Log, Get all Unique IPs and Urls visited by that IP

Parse_Apache_Log Simple Python Script to Parse Apache Log, Get all Unique IPs and Urls visited by that IP. It will create 3 different files. allIP.txt

A simple python script that parses the MSFT Teams log file for the users current Teams status and then outputs the status color to a MQTT connected light.

Description A simple python script that parses the MSFT Teams log file for the users current Teams status and then outputs the status color to a MQTT

Automatically block traffic on Cloudflare's side based on Nginx Log parsing.
Automatically block traffic on Cloudflare's side based on Nginx Log parsing.

AutoRL This is a PoC of automatically block traffic on Cloudflare's side based on Nginx Log parsing. It will evaluate Nginx access.log and find potent

Modern Denial-of-service ToolKit for python
Modern Denial-of-service ToolKit for python

💣 Impulse Modern Denial-of-service ToolKit 💻 Main window 📡 Methods: Method Target Description SMS PHONE Sends a massive amount of SMS messages and

Very simple and tiny file sharing service written in python

Simple File sharing tool Sharing client usage (You will need to use python3 for linux) main.py --send -f file/path Optionnal flags : pwd : set a passw

This script aims to make the dynamic public ip of your local server, public.
This script aims to make the dynamic public ip of your local server, public.

EZ DDNS CLOUDFLARE This script aims to make the dynamic ip of your local server, public. It does this by regularly updating cloudflare's dns record. B

Public HTTPS access to Home Assistant with Dataplicity service
Public HTTPS access to Home Assistant with Dataplicity service

Custom component for public HTTPS access to Home Assistant with Dataplicity service. Should work on any Linux PC or ARM, not only Raspberry as Dataplicity service said. Don't work on Windows.

Bark Toolkit is a toolkit wich provides Denial-of-service attacks, SMS attacks and more.
Bark Toolkit is a toolkit wich provides Denial-of-service attacks, SMS attacks and more.

Bark Toolkit About Bark Toolkit Bark Toolkit is a set of tools that provides denial of service attacks. Bark Toolkit includes SMS attack tool, HTTP

Client library for relay - a service for relaying server side messages to the client side browsers via websockets.

Client library for relay - a service for relaying server side messages to the client side browsers via websockets.

Comments
  • Image's platform does not match for Raspberry Pi 4

    Image's platform does not match for Raspberry Pi 4

    Greetings, I am trying to use DDNS in a docker container for namesilo using the docker run command provided in the github. My issue is that it seems like arm64/v8 isn't supported and there are only amd64 builds available. I am running a Raspberry Pi 4 via dietpi/raspbian. Any chance to add additional support for this?

    `root@DietPi:~/docker# docker run -d --name ddns -v /docker/namesilo/:/home/NameSilo-DDNS:rw charles94jp/ddns

    --restart=always

    WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested e815e9a71dfd8c7cc7ed752086f299e90a854c726b9321e2a1938061e4a60c5d`

    Thank you

    opened by yslupdates 4
  • Feature Request: Update multiple sub-domains

    Feature Request: Update multiple sub-domains

    可以把 domain 字段设置为子域名数组吗?一次将多个域名 IP 地址更新为本机地址。

    Google Translate: Can the domain field be set to an array of subdomains? Update multiple domain IP addresses to local addresses at once.

    enhancement 
    opened by kongjun18 4
  • 随机出现SSL错误导致程序卡住

    随机出现SSL错误导致程序卡住

    目前我的解决方法是把**./NameSilo-DDNS/DDNS restart**做成定时任务 经常在日志中会各种出现SSL出错情况,类似

    Traceback (most recent call last):
      File "ddns.py", line 100, in __init__
        r = httpx.get("https://www.ip138.com/", headers=self.httpHeaders, timeout=10)
      File "/usr/local/lib/python3.8/dist-packages/httpx/_api.py", line 189, in get
        return request(
      File "/usr/local/lib/python3.8/dist-packages/httpx/_api.py", line 100, in request
        return client.request(
      File "/usr/local/lib/python3.8/dist-packages/httpx/_client.py", line 802, in request
        return self.send(request, auth=auth, follow_redirects=follow_redirects)
      File "/usr/local/lib/python3.8/dist-packages/httpx/_client.py", line 889, in send
        response = self._send_handling_auth(
      File "/usr/local/lib/python3.8/dist-packages/httpx/_client.py", line 917, in _send_handling_auth
        response = self._send_handling_redirects(
      File "/usr/local/lib/python3.8/dist-packages/httpx/_client.py", line 954, in _send_handling_redirects
        response = self._send_single_request(request)
      File "/usr/local/lib/python3.8/dist-packages/httpx/_client.py", line 990, in _send_single_request
        response = transport.handle_request(request)
      File "/usr/local/lib/python3.8/dist-packages/httpx/_transports/default.py", line 218, in handle_request
        resp = self._pool.handle_request(req)
      File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python3.8/dist-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
        raise mapped_exc(message) from exc
    httpx.ConnectError: EOF occurred in violation of protocol (_ssl.c:1131)
    
    opened by MarvinChiang 2
  • Does not support domain with both A and AAAA records

    Does not support domain with both A and AAAA records

    When I have "domains": [ "hpe.example.com" ], "domains_ipv6": [ "hpe.example.com" ], Every time fetching the current record, only A record will be returned, which then caused the program to update the A record with an ipv6 address and yields

    <?xml version="1.0"?>
    <namesilo><request><operation>dnsUpdateRecord</operation><ip>73.4.114.xxx</ip></request><reply><code>280</code><detail>2601:180:8300:1df6:b12d:3410:b7c5:xxxx must be a valid ipv4</detail></reply></namesilo>```
    opened by nightdawnex 5
Releases(v2.2.1)
  • v2.2.1(Aug 25, 2022)

    更新内容:

    ip138的接口被限流,同一个局域网访问10次左右就会被ban(即使是每隔10分钟访问一次)。影响:

    v2.2.0 由于有bug不可用。

    更旧的版本能启用备用api,但是是美国的api,可能会出现超时情况。

    Updates

    Fix the bug that appears in the program due to the ip138 api being limited in rate.

    Links

    Code for this version: https://github.com/Charles94jp/NameSilo-DDNS/tree/v2.2.1

    Docker Hub: https://hub.docker.com/r/charles94jp/ddns/tags

    Quick Start

    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Aug 8, 2022)

    更新内容:

    1. 重构代码

    2. 代码变动:优化参数解析、删除email_after_reboot、邮件网络代理、更新docker镜像

    3. 支持IPv6

    4. 邮件内容支持英文,添加域名信息表

    Email content

    Updates

    1. Code refactoring.

    2. Code changes: optimize parameter parsing, deprecate email_after_reboot, mail network proxy, update docker image.

    3. IPv6 support.

    4. Email content support in English, add domain name information table.

    Links

    Code for this version: https://github.com/Charles94jp/NameSilo-DDNS/tree/v2.2.0

    Docker Hub: https://hub.docker.com/r/charles94jp/ddns/tags

    Quick Start

    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Jul 24, 2022)

    更新内容:

    1. 修复SSL链接错误、NameSilo record_id 过期问题等。提升程序稳定性

    2. 支持每次更新ip成功都发送邮件

    3. 域名格式从二级域名(cc.bb.aa),到支持多级域名(dd.cc.bb.aa)

    4. 支持同时更新多个域名

    5. docker 支持多平台

    Updates

    1. Fix SSL link error and NameSilo record_id expired bug. Improve the robustness of the program.

    2. Support sending email every time the domain name information is updated successfully.

    3. Change domain name format from second level domain name (cc.bb.aa) to multi-level domain name (dd.cc.bb.aa).

    4. Support update multiple domain names at the same time.

    5. Docker support multi-platform.

    Links

    Code for this version: https://github.com/Charles94jp/NameSilo-DDNS/tree/v2.1.0

    Docker Hub: https://hub.docker.com/r/charles94jp/ddns/tags

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Mar 11, 2022)

    更新内容:

    1. 重新组织了项目目录结构
    2. 支持Docker:https://hub.docker.com/r/charles94jp/ddns/tags
    3. 优化了程序

    注意:由于程序使用的api 2021.ip138.com 的域名发生了变更,新域名为2022.ip138.com,旧版程序已无法直接使用。v2.0.0版本能自动获取api域名,并添加了两个备用api。

    Code for this version: https://github.com/Charles94jp/NameSilo-DDNS/tree/v2.0.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Feb 6, 2022)

    完成以下功能:

    1. DDNS基本功能——循环检测IP变动并更新DNS
    2. 程序异常邮件提醒——包括调用第三方api时出现异常,服务器意外断电后,通电重启后的IP检测
    3. 针对Linux的脚本,包括开机自动启动,查询DDNS服务运行状态DDNS status
    4. 针对Windows开机自动启动的脚本

    Code for this version: https://github.com/Charles94jp/NameSilo-DDNS/tree/v1.0.0

    Source code(tar.gz)
    Source code(zip)
    NameSiloDDNS-1.0.0-linux.tar.gz(5.51 KB)
    NameSiloDDNS-1.0.0-windows.zip(5.27 KB)
Owner
云牧青
啥也不会
云牧青
A pure python implementation of multicast DNS service discovery

python-zeroconf Documentation. This is fork of pyzeroconf, Multicast DNS Service Discovery for Python, originally by Paul Scott-Murphy (https://github

Jakub Stasiak 483 Dec 29, 2022
DNSStager is an open-source project based on Python used to hide and transfer your payload using DNS.

What is DNSStager? DNSStager is an open-source project based on Python used to hide and transfer your payload using DNS. DNSStager will create a malic

Askar 547 Dec 20, 2022
🥑 A Python ARP and DNS Spoofer CLI and INTERFACE 🥓

NEXTGEN SPOOFER ?? A Python ARP and DNS Spoofer CLI and INTERFACE ?? CLI -> advanced pentesters INTERFACE -> beginners SetUp Make sure you installed P

null 9 Dec 25, 2022
Build custom OSINT tools and APIs (Ping, Traceroute, Scans, Archives, DNS, Scrape, Whois, Metadata & built-in database for more info) with this python package

Build custom OSINT tools and APIs with this python package - It includes different OSINT modules (Ping, Traceroute, Scans, Archives, DNS, Scrape, Whoi

QeeqBox 52 Jan 6, 2023
Way find out if DNS is down or your instance

DNS-PING Way to find out if DNS is down or your instance Problem: At times it happens that DNS provider services of a website URL is down and so to re

Giten Mitra 4 Nov 18, 2022
ExtDNS synchronizes labeled records in docker-compose with DNS providers.

ExtDNS for docker-compose ExtDNS synchronizes labeled records in docker-compose with DNS providers. Inspired by External DNS, ExtDNS makes resources d

DNTSK 6 Dec 24, 2022
mitm6 is a pentesting tool that exploits the default configuration of Windows to take over the default DNS server.

mitm6 is a pentesting tool that exploits the default configuration of Windows to take over the default DNS server.

Fox-IT 1.3k Jan 5, 2023
Script and library to wait for a DNS authority server to get its configuration.

DNSWait dnswait is a small script to wait for the "propagation" of a namserver configuration. Installing It's as easy as: python -m pip install dnswai

Julien Palard 14 Jan 17, 2022
Makes dynamically updating your Cloudflare DNS records a bit easier ⏩👍😎

Easy Dynamic Cloudflare DNS Updater Makes dynamically updating your Cloudflare DNS records a bit easier ⏩ ?? ?? If using it as a 'Dynamic DNS' client,

Zac Koch 3 Dec 19, 2021
Octodns-cloudflare - Cloudflare DNS provider for octoDNS

CloudflareProvider provider for octoDNS An octoDNS provider that targets Cloudfl

octoDNS 6 May 28, 2022