🍩
HackBook.io
  • Pentesting Pocket Book for hackers and developers.
  • Reconnaissance
    • Internal Recon Basics
    • OSINT
      • Infrastructure
      • Recon-ng
      • Users
      • Google Dorks
    • Active Scanning
      • NMAP
        • NSE
          • reconnoitre
        • NMap Evasion
      • NC Scan
      • Finger Printing
    • Web Server OSINT
      • WhatWeb
      • Subdomains
      • Directory & File Enumeration
        • Enumeration
          • GoCutty
          • gobuster
          • Dirb
          • nikto
        • Fuzzing
        • Crawling
  • Web Application Hacking
    • Web 101
      • Clients
      • Servers
      • Encodings
    • Web Hacking Techniques
      • SOP
      • Open Redirect
      • File & Resource Attacks
        • Directory Traversal
          • Dir Traversal Fuzzer
        • LFI
        • RFI
        • Unrestricted File Uploads
      • XSS
        • DOM
        • Stored
        • Reflected
        • Blind
        • Self XSS
      • XXE
        • XXE Payloads
      • XPath
      • SSRF
      • CSRF
      • SQLi
        • SQL Basics
        • Securing SQL
        • Hacking SQL
          • sqlmap
          • In-Band
          • Error Based
          • Blind
      • Authorization
      • Session Hijacking
      • Command Injection
      • Insecure Deserialization
      • File Uploads
        • File Upload Mitigations
      • HPP
      • Click Jacking
        • Adobe SWF Investigator
      • HTTP Response Splitting
      • Flash 101
        • Flash Hacking
      • HTML5
        • WebSockets
        • CORS
          • iframe
          • Headers
    • Web Hacking Procedures
      • Captcha
      • Username Generation
      • Username Enumeration
      • Inhouse WebApps
      • SSL Cert Generation
      • CMS
        • WordPress
        • Joomla
      • Popular Exploits
        • Bludit CMS
        • ShellShock
        • WebDav
  • Weaponization
    • Buffer Overflows (BOF)
      • DSBOFG
        • Scripts
  • Initial Access
    • 😈Services
      • Finger
      • SNMP
      • LDAP
      • SMTP
      • NFS
      • RPC
        • RPCBind
      • RDP
      • SQL
        • NoSQL
      • POP3
      • Samba
      • SMB
      • SSH
      • Telnet
      • NetBios
      • VOIP/SIP
      • DNS
        • DNS Lookups
        • Zone Transfer
        • SubDomain Enums
        • dnsdumpster
    • 😈Shells
      • Powercat
      • Odd Shells
      • Troubleshoot
      • TTY/PTTY
  • Persistence
    • File Transfers
      • Py->Exe->Txt
      • Cross compile example
    • Backdoors
  • Privilege Escalation
    • Universal Escalation
    • Windows Escalation
      • Automated
      • Popular Exploits
        • ActiveXObject to Wscript RCE
        • Macros
        • Object Linking
    • Linux Escalation
      • Automated
    • Passwords
      • John
      • Medusa
      • Cewl
      • ncrack
      • Crunch
      • Hydra
      • MITM
      • Responder
        • SAM
          • pwdump and fgdump
          • Pass-the-hash
      • Crack the hash
      • NTLM
  • Network Discovery
    • Network Traffic
      • tcpdump
    • Internal Discovery
  • Collection and Staging
    • Collection
      • File types
  • Hacking Objectives
    • Non Kinetic War (Quick Guide)
  • Procedures
    • Bash Guide
    • Active Directory
    • Crypto 101
    • Forensics
  • Glossary
  • Hacking Frameworks
    • Metasploit
      • msfvenom
    • Dsnif
  • ThreatModeling
    • Threat Modeling Overview
  • Certifications
    • VMDR
      • Qualys Asset Management
      • Qualys Vulnerability Management
      • Qualys Threat Prioritization
      • Qualys Response (Patch Deployment)
    • OSCP Cheat Sheet
  • RF - Radio Frequency
    • Ham Technician
Powered by GitBook
On this page
  • DNS Record Format:
  • Tools
  • DNS Discovery
  • Note dump:

Was this helpful?

  1. Initial Access
  2. Services

DNS

PreviousVOIP/SIPNextDNS Lookups

Last updated 3 years ago

Was this helpful?

DNS Record Format:

  • rr:fqdn and zone that record resides

  • ttl:time to live set by SOA

  • rc:internet, hesiod, or chaos

  • soa:start of authority, indicates the beginning of the zone and other values like the serial number of the zone.

  • ns:zones authoratative name server assigned

  • a: host name -> Ip mapping (forward zones:dns records that have an A record) // nslookup <domain.tld>// dig <domain.tld>

  • ptr: IP -> hostname mapping (reverse zone) //nslookup -type=PTR //dig PTR

  • cname: Alias host name -> A record hostname mapping

  • mx: Host that will accept email for the domain //nslookup -type=MX //dig MX

Tools

  • Linux: dig

  • Win: nslookup

  • Automated:

    • fierce

    • foca

    • maltego

    • hostmap

    • dmitry

DNS Discovery

nmap -sU -p53 <cidr> //udp
nmap -sS -p53 <cidr> //tcp, may allow Zone Transfers

Note dump:

Get hotname: #host 8.8.8.8 //'A' host record Get IP: #host //'A' host record //Use -t to specify type of server to look for. MX: #host -t mx megacorpone.com TXT: #host -t txt megacorpone.com Get domain info: (A record) #nslookup sub.site.com (mail exchange record) #nslookup -query=mx sub.site.com (name servers) #nslookup -query=ns sub.site.com (all) #nslookup -query=any sub.site.com Subdomain brute force from list: #dnsmap site.com (forward lookup?) BRUTEFORCE: //Script looks for all associated subdomains for a given domain and prints its IP. Also known as a Forward DNS look up. //Uses a list of common subdomains from ‘subdomainList.txt’ #!/bin/bash for name in $(cat subdomainList.txt);do host $name.ligit.com|grep "has address" |cut -d" " -f1,4 done //we can use these given IPs and search the IPs that are unlisted but inbetween our listed ones. Href search: #wget www.cisco.com #grep "href=" index.html | cut -d'/' -f3 | grep "\." |cut -d '"' -f1 |sort -u //Better #cat index.html | grep -o 'https://[^"]*' | cut -d"/" -f3 | sort -u > list.txt //Get all IPs for the links //Oneliner #for url in $(cat list.txt); do host $url; done | grep "has address" | cut -d" " -f4 | sort -u //As a program #!/bin/bash for url in $(cat cisco.txt);do host $url |grep “has address” |cut -d" " -f4 done //then give execute rights #chmod 755 cisco.sh //and run #./cisco.sh Reverse lookup: //It can be usefull to do a forward lookup first then once you have an IP range prove the unknown IPs to get the domain names for them. //the squence below needs to be chaged according to your look up. //seq, ip, grep all will change #! /bin/bash for ip in $(seq 72 91);do host 38.100.193.$ip |grep “megacorp” |cut -d" " -f1,5 done OR #! /bin/bash for ip in $(seq 72 91);do host 38.100.193.$ip |grep -v “not found” done //make sure to chmod 755 the script Zone transfers: //grab the dns list from a name server to get a map of all devices //a good start is to get all name servers of an organization #host -t ns corp.com //ZONE TRASFER #host -l <domain> <dns server> ex. #host -l corp.com ns1.corp.com. //last period is not a mistake //SCRIPT to grab NS #! /bin/bash for server in $(host -t ns corp.com |cut -d" " -f4); do host -l corp.com $server; done //prints to buffer OR //SCRIPT WITH ARGUMENT FOR DOMAIN. Will search domain for name servers then try zone transfers on those name servers. Make sure to chmod 755 the script #usage ./script <domain> #! /bin/bash #first checks if an argument was passed if [-z “$1”]; then echo “[*] Simple Zone trasfer script” echo “[*] Useage : $0 <domain name>” exit 0 fi # if argument was given, identify the DNS servers for the domain for server is $(host -t ns $1 |cut -d" " -f4);do # For each of these servers, attempt a zone transfer host -l $1 $server |grep “has address” done NMAP NSE: nmap --script=dns-zone-transfer -p 53 ns2.megacorpone.com

😈
www.megacorpone.com
A DNS Record format