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

211 lines
7.1 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>zeek 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">zeek 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>zeek (formerly Bro) is a network security monitor and analysis framework.</p>
<hr>
<h2>Basic Usage</h2>
<ul>
<li>zeek -r &lt;pcap&gt; - Analyze a pcap file</li>
</ul>
<ul>
<li>zeek -i &lt;interface&gt; - Monitor live traffic on interface</li>
</ul>
<ul>
<li>zeek -i &lt;interface&gt; -C - Monitor live traffic (ignore checksum errors)</li>
</ul>
<ul>
<li>zeek &lt;script&gt; - Run zeek script</li>
</ul>
<hr>
<h2>zeekctl Commands</h2>
<ul>
<li>zeekctl start - Start all nodes</li>
</ul>
<ul>
<li>zeekctl stop - Stop all nodes</li>
</ul>
<ul>
<li>zeekctl restart - Restart all nodes</li>
</ul>
<ul>
<li>zeekctl status - View node status</li>
</ul>
<ul>
<li>zeekctl deploy - Check, install, and restart zeek</li>
</ul>
<ul>
<li>zeekctl check - Syntax-check configs without restarting</li>
</ul>
<ul>
<li>zeekctl top - Monitor resource usage across nodes</li>
</ul>
<ul>
<li>zeekctl netstats - Show network statistics</li>
</ul>
<ul>
<li>zeekctl diag - Run diagnostics</li>
</ul>
<ul>
<li>zeekctl cron - Enable/disable cron jobs</li>
</ul>
<hr>
<h2>Command Line Options</h2>
<ul>
<li>-r &lt;file&gt; - Read from pcap file</li>
</ul>
<ul>
<li>-i &lt;interface&gt; - Capture from interface</li>
</ul>
<ul>
<li>-C - Ignore checksum errors (useful for NIC offloading)</li>
</ul>
<ul>
<li>-f &lt;filter&gt; - Apply BPF filter</li>
</ul>
<ul>
<li>-w &lt;file&gt; - Write output to file</li>
</ul>
<ul>
<li>-b - Run in bare mode (minimal scripts)</li>
</ul>
<ul>
<li>-s &lt;script&gt; - Load script file</li>
</ul>
<ul>
<li>-p &lt;plugin&gt; - Load plugin</li>
</ul>
<hr>
<h2>Configuration</h2>
<h3>Config File Locations</h3>
<ul>
<li>/usr/local/zeek/etc/node.cfg - Node configuration</li>
</ul>
<ul>
<li>/usr/local/zeek/etc/networks.cfg - Network configuration</li>
</ul>
<ul>
<li>/usr/local/zeek/etc/zeekctl.cfg - zeekctl configuration</li>
</ul>
<ul>
<li>/usr/local/zeek/share/zeek/site/local.zeek - Local scripts</li>
</ul>
<ul>
<li>/opt/zeek/etc/ - Alternative install location</li>
</ul>
<h3>Example node.cfg</h3>
<pre><code>[zeek]
type=standalone
host=localhost
interface=eth0</code></pre>
<h3>Example networks.cfg</h3>
<pre><code>10.0.0.0/8 Private IP Space
172.16.0.0/12 Private IP Space
192.168.0.0/16 Private IP Space</code></pre>
<hr>
<h2>Log Files</h2>
<ul>
<li>conn.log - Connection logs</li>
</ul>
<ul>
<li>http.log - HTTP logs</li>
</ul>
<ul>
<li>dns.log - DNS logs</li>
</ul>
<ul>
<li>ssl.log - SSL/TLS logs</li>
</ul>
<ul>
<li>files.log - File analysis logs</li>
</ul>
<ul>
<li>Logs stored in: /usr/local/zeek/logs/current/</li>
</ul>
<hr>
<h2>Tips</h2>
<ul>
<li>Use zeek -C when listening on interfaces where checksum offloading causes invalid checksums</li>
</ul>
<ul>
<li>Always test configs with zeekctl check before deploying</li>
</ul>
<ul>
<li>Use the UID field from conn.log to correlate across logs (HTTP, DNS, etc.)</li>
</ul>
<ul>
<li>After changing config files or scripts, use zeekctl deploy to apply changes</li>
</ul>
<ul>
<li>Use zeekctl status, top, netstats for monitoring runtime status</li>
</ul>
<ul>
<li>Enable JSON logs using LogAscii::use_json=T for integration with logging pipelines</li>
</ul>
<ul>
<li>Logs are organized by date under logs/current/ and older ones under dated subfolders</li>
</ul>
<ul>
<li>Make use of zeek&#39;s plugin/package manager zkg for easy extension</li>
</ul>
<ul>
<li>Use BPF filters to reduce processing load on high-traffic networks</li>
</ul>
<ul>
<li>Custom scripts can extend zeek&#39;s analysis capabilities</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>