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

210 lines
6.6 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>termshark 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">termshark 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>termshark is a terminal UI for tshark, inspired by Wireshark.</p>
<hr>
<h2>Basic Usage</h2>
<ul>
<li>termshark -i &lt;interface&gt; - Capture live from network interface</li>
</ul>
<ul>
<li>termshark -r &lt;file&gt; - Load and analyze pcap file</li>
</ul>
<ul>
<li>termshark &lt;file&gt; - Load pcap file (alternative)</li>
</ul>
<hr>
<h2>Navigation</h2>
<ul>
<li>j or ↓ - Move down through packets</li>
</ul>
<ul>
<li>k or ↑ - Move up through packets</li>
</ul>
<ul>
<li>Enter - Expand/collapse packet details</li>
</ul>
<ul>
<li>Space - Expand/collapse fields</li>
</ul>
<ul>
<li>h - Collapse tree view</li>
</ul>
<ul>
<li>l - Expand tree view</li>
</ul>
<ul>
<li>/ - Search/filter packet fields</li>
</ul>
<ul>
<li>n - Next packet</li>
</ul>
<ul>
<li>p - Previous packet</li>
</ul>
<ul>
<li>g - Go to top</li>
</ul>
<ul>
<li>G - Go to bottom</li>
</ul>
<hr>
<h2>Filtering and Search</h2>
<ul>
<li>/ - Open filter/search UI</li>
</ul>
<ul>
<li>Ctrl+F - Open filter/search UI (alternative)</li>
</ul>
<ul>
<li>Enter - Apply filter</li>
</ul>
<ul>
<li>Esc - Cancel filter</li>
</ul>
<hr>
<h2>Display Options</h2>
<ul>
<li>t - Toggle display format</li>
</ul>
<ul>
<li>Ctrl+N - Next tab (if using tabs)</li>
</ul>
<ul>
<li>Ctrl+P - Previous tab (if using tabs)</li>
</ul>
<hr>
<h2>System</h2>
<ul>
<li>q - Quit termshark</li>
</ul>
<ul>
<li>? - Show help</li>
</ul>
<hr>
<h2>Configuration</h2>
<h3>Config File Location</h3>
<ul>
<li>~/.config/termshark/config.yaml (user config)</li>
</ul>
<ul>
<li>~/.config/termshark/ (profiles directory)</li>
</ul>
<ul>
<li>~/.termshark/ (legacy location)</li>
</ul>
<h3>Example Configuration</h3>
<pre><code># termshark config
profiles:
default:
columns:
- Time
- Source
- Destination
- Protocol
- Length
- Info</code></pre>
<h3>Command Line Options</h3>
<ul>
<li>-i &lt;interface&gt; - Capture from interface</li>
</ul>
<ul>
<li>-r &lt;file&gt; - Read from pcap file</li>
</ul>
<ul>
<li>-f &lt;filter&gt; - Apply display filter</li>
</ul>
<ul>
<li>-Y &lt;filter&gt; - Apply display filter (alternative)</li>
</ul>
<ul>
<li>-n - Disable network name resolution</li>
</ul>
<ul>
<li>-N - Disable port name resolution</li>
</ul>
<hr>
<h2>Tips</h2>
<ul>
<li>Use live capture vs. reading pcap to compare behavior</li>
</ul>
<ul>
<li>Pipe output with tshark flags into termshark for filtering before loading</li>
</ul>
<ul>
<li>Familiarize with filter syntax early (e.g., ip.src == 1.2.3.4)</li>
</ul>
<ul>
<li>Use keyboard navigation to avoid switching back and forth to mouse</li>
</ul>
<ul>
<li>When working over SSH, using termshark avoids copying large pcap files</li>
</ul>
<ul>
<li>Adjust visible columns and packet details via profiles to reduce noise</li>
</ul>
<ul>
<li>Ensure tshark is installed and up to date, since termshark uses it under the hood</li>
</ul>
<ul>
<li>Use Wireshark-compatible display filters for familiarity</li>
</ul>
<ul>
<li>Profiles allow customizing column layouts and color schemes</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>