内网渗透 | 域内DNS信息收集工具编写
2021-12-11 10:42:12 Author: mp.weixin.qq.com(查看原文) 阅读量:16 收藏

在一个大型的内网环境当中,如果我们在不确定目标资产定位在哪里我们就可以通过dns去定位,当然也可以通过活动目录集成的dns服务。

这里举例DC Locator Process

ffDAQa.png

第一步它会询问_ldap._tcp.dc._msdcs.contoso.com注册记录是什么,dns就会返回所有的域控。

ffDMDu.png

ffDWiD.png

dnscmd

dnscmd.exe . /EnumRecords redteam.local .

ffD7Ti.png
dnscmd /zoneexport redteam.local redteam.local.dns.txt 

ffDvtL.png

SharpAdidnsdump

ffD35W.png

这里我们也可以通过获取域内机器然后通过Dns.GetHostEntry解析ip。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.DirectoryServices;
using System.Net;

namespace QueryDomainIp
{
    class Program
    {
        static void Main(string[] args)
        {
            DirectoryEntry coon = new DirectoryEntry();
            DirectorySearcher search = new DirectorySearcher(coon);
            search.Filter = "(&(objectclass=computer))";
            try
            {
                foreach (SearchResult r in search.FindAll())
                {
                    string computername = "";
                    computername = r.Properties["cn"][0].ToString();
                    IPHostEntry hostInfo = Dns.GetHostEntry(computername);
                    foreach (IPAddress result_ip in hostInfo.AddressList)
                    {
                        Console.WriteLine("HostName:{0} IP:{1}", computername, result_ip);
                    }
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("[-] error");
                Console.WriteLine("[-] Exception: " + ex.Message);
            }
        }
    }
}

ffDNXw.png

PowerView.ps1

import-module PowerView.ps1
Get-DNSRecord -ZoneName redteam.local

ffDayR.png

推荐阅读:

内网渗透 | 域渗透之Dcsync的利用实战

实战|内网渗透hash窃取技巧

内网渗透|LAPS的使用小技巧

内网渗透 | 横向移动中MSTSC的密码获取

内网渗透 | 内网穿透之多层代理

点赞,转发,在看


文章来源: http://mp.weixin.qq.com/s?__biz=MzI5MDU1NDk2MA==&mid=2247502315&idx=1&sn=d733e39ca70543055da98b0e9cf5ea5d&chksm=ec1c9cd4db6b15c2e33695619dc62632303710042df072eb69f6bd438667cd1be197435438bc#rd
如有侵权请联系:admin#unsafe.sh