WebsiteTemplate/cheatsheets/host.html
2026-01-25 11:33:37 -04:00

215 lines
7.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self' data:; img-src 'self' data:; connect-src 'self'; base-uri 'self'; form-action 'self' https://defcon.social https://bsky.app;">
<meta http-equiv="X-Content-Type-Options" content="nosniff">
<link rel="stylesheet" href="../assets/css/style.css">
<link rel="icon" type="image/x-icon" href="../favicon.ico">
<script>
// Apply theme immediately to prevent flash
(function() {
const theme = localStorage.getItem('theme') ||
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', theme);
})();
</script>
<title>host Cheatsheet - Cheatsheets - Launch Pad</title>
</head>
<body>
<button class="theme-toggle" id="themeToggle" aria-label="Toggle dark mode">
<svg class="theme-icon theme-icon-moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
<svg class="theme-icon theme-icon-sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display: none;"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
</button>
<br/><br/>
<div class="name">
__ _______________________ _________._________________________
\_ _____/ \______ \ / _ \ / _____/ / _____/ | | \_ _____/
| __) | _/ / /_\ \ / \ ___ / \ ___ | | | __)_
| \ | | \ / | \ \ \_\ \ \ \_\ \ | |___ | \
\___ / |____|_ / \____|__ / \______ / \______ / |_______ \ /_______ /
\/ \/ \/ \/ \/ \/ \/
</div>
<div class="blog-page-header">
<div class="blog-header-content">
<a href="/cheatsheets" class="back-link" title="Back to Cheatsheets">
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" class="home-icon"><path fill="currentColor" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>
</a>
<h1 class="blog-page-title">host Cheatsheet</h1>
</div>
</div>
<div class="blog-post-container">
<div class="blog-posts-container" style="max-width: 900px; margin: 0 auto;">
<div class="blog-post">
<div class="blog-post-content">
<p><a href="index.html">← Back to cheatsheets</a></p>
<p><a href="../index.html">← Home</a></p>
<hr>
<p>host is a simple utility for performing DNS lookups. It's part of the BIND utilities and provides quick DNS resolution without the complexity of dig.</p>
<hr>
<h2>Basic Usage</h2>
<ul>
<li>host &lt;hostname&gt; - Basic lookup</li>
</ul>
<ul>
<li>host &lt;ip&gt; - Reverse lookup</li>
</ul>
<ul>
<li>host &lt;hostname&gt; &lt;dns-server&gt; - Use specific DNS server</li>
</ul>
<hr>
<h2>Query Types</h2>
<ul>
<li>host -t A &lt;hostname&gt; - IPv4 address</li>
</ul>
<ul>
<li>host -t AAAA &lt;hostname&gt; - IPv6 address</li>
</ul>
<ul>
<li>host -t MX &lt;hostname&gt; - Mail servers</li>
</ul>
<ul>
<li>host -t NS &lt;hostname&gt; - Name servers</li>
</ul>
<ul>
<li>host -t TXT &lt;hostname&gt; - TXT records</li>
</ul>
<ul>
<li>host -t CNAME &lt;hostname&gt; - Canonical name</li>
</ul>
<ul>
<li>host -t SOA &lt;hostname&gt; - Start of authority</li>
</ul>
<ul>
<li>host -t PTR &lt;ip&gt; - Pointer record (reverse)</li>
</ul>
<ul>
<li>host -t ANY &lt;hostname&gt; - All records</li>
</ul>
<hr>
<h2>Options</h2>
<ul>
<li>-a - Equivalent to -v -t ANY</li>
</ul>
<ul>
<li>-v - Verbose output</li>
</ul>
<ul>
<li>-l - Zone transfer (AXFR)</li>
</ul>
<ul>
<li>-C - Compare SOA records from all NS</li>
</ul>
<ul>
<li>-4 - Use IPv4 only</li>
</ul>
<ul>
<li>-6 - Use IPv6 only</li>
</ul>
<ul>
<li>-r - Non-recursive query</li>
</ul>
<ul>
<li>-T - Use TCP instead of UDP</li>
</ul>
<ul>
<li>-W &lt;seconds&gt; - Wait timeout</li>
</ul>
<ul>
<li>-R &lt;number&gt; - Number of retries</li>
</ul>
<hr>
<h2>Common Examples</h2>
<h3>Basic Lookup</h3>
<pre><code>host example.com</code></pre>
<p>Get IP addresses for domain.</p>
<h3>Reverse Lookup</h3>
<pre><code>host 8.8.8.8</code></pre>
<p>Find hostname for IP.</p>
<h3>MX Records</h3>
<pre><code>host -t MX example.com</code></pre>
<p>Find mail servers.</p>
<h3>Name Servers</h3>
<pre><code>host -t NS example.com</code></pre>
<p>Find authoritative name servers.</p>
<h3>TXT Records</h3>
<pre><code>host -t TXT example.com</code></pre>
<p>Get TXT records (SPF, DKIM, etc.).</p>
<h3>Use Specific DNS</h3>
<pre><code>host example.com 8.8.8.8</code></pre>
<p>Query using Google DNS.</p>
<h3>All Records</h3>
<pre><code>host -a example.com</code></pre>
<p>Verbose output with all record types.</p>
<h3>Zone Transfer (AXFR)</h3>
<pre><code>host -l example.com ns1.example.com</code></pre>
<p>Attempt zone transfer (usually blocked).</p>
<h3>SOA Record</h3>
<pre><code>host -t SOA example.com</code></pre>
<p>Get start of authority info.</p>
<h3>Compare NS Records</h3>
<pre><code>host -C example.com</code></pre>
<p>Compare SOA from all name servers.</p>
<hr>
<h2>Output Examples</h2>
<h3>A Record Output</h3>
<pre><code>$ host example.com
example.com has address 93.184.216.34
example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946</code></pre>
<h3>MX Record Output</h3>
<pre><code>$ host -t MX example.com
example.com mail is handled by 10 mail.example.com.</code></pre>
<h3>Reverse Lookup Output</h3>
<pre><code>$ host 8.8.8.8
8.8.8.8.in-addr.arpa domain name pointer dns.google.</code></pre>
<hr>
<h2>Comparison with Other Tools</h2>
<h3>host vs dig</h3>
<ul>
<li>host - Simple, quick, human-readable</li>
<li>dig - Detailed, more options, scriptable</li>
</ul>
<h3>host vs nslookup</h3>
<ul>
<li>host - Simpler output, CLI focused</li>
<li>nslookup - Interactive mode, legacy tool</li>
</ul>
<hr>
<h2>Tips</h2>
<ul>
<li>Use for quick DNS lookups</li>
</ul>
<ul>
<li>Try zone transfers (-l) during recon</li>
</ul>
<ul>
<li>Check MX records for mail server enumeration</li>
</ul>
<ul>
<li>Use -t TXT to find SPF/DKIM records</li>
</ul>
<ul>
<li>Query different DNS servers to compare</li>
</ul>
<ul>
<li>Use dig for more detailed analysis</li>
</ul>
<ul>
<li>Great for quick command-line lookups</li>
</ul>
<ul>
<li>Reverse lookups can reveal shared hosting</li>
</ul>
<hr>
<p><a href="index.html">← Back to cheatsheets</a></p>
<p><a href="../index.html">← Home</a></p>
</div>
</div>
</div>
</div>
<script async type="text/javascript" src="../blog/analytics.js"></script>
<script src="../theme.js"></script>
</body>
</html>