Borg/index.html

935 lines
No EOL
24 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="CLI and library for collecting repositories, websites, and PWAs into portable data artifacts.">
<link rel="next" href="installation/">
<link rel="icon" href="assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.1">
<title>Borg Data Collector</title>
<link rel="stylesheet" href="assets/stylesheets/main.484c7ddc.min.css">
<link rel="stylesheet" href="assets/stylesheets/palette.ab4e12ef.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<script>__md_scope=new URL(".",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="blue" data-md-color-accent="indigo">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#borg" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="." title="Borg Data Collector" class="md-header__button md-logo" aria-label="Borg Data Collector" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Borg Data Collector
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Overview
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="blue" data-md-color-accent="indigo" aria-hidden="true" type="radio" name="__palette" id="__palette_0">
</form>
<script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/Snider/Borg" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--><path d="M439.6 236.1 244 40.5c-5.4-5.5-12.8-8.5-20.4-8.5s-15 3-20.4 8.4L162.5 81l51.5 51.5c27.1-9.1 52.7 16.8 43.4 43.7l49.7 49.7c34.2-11.8 61.2 31 35.5 56.7-26.5 26.5-70.2-2.9-56-37.3L240.3 199v121.9c25.3 12.5 22.3 41.8 9.1 55-6.4 6.4-15.2 10.1-24.3 10.1s-17.8-3.6-24.3-10.1c-17.6-17.6-11.1-46.9 11.2-56v-123c-20.8-8.5-24.6-30.7-18.6-45L142.6 101 8.5 235.1C3 240.6 0 247.9 0 255.5s3 15 8.5 20.4l195.6 195.7c5.4 5.4 12.7 8.4 20.4 8.4s15-3 20.4-8.4l194.7-194.7c5.4-5.4 8.4-12.8 8.4-20.4s-3-15-8.4-20.4"/></svg>
</div>
<div class="md-source__repository">
GitHub
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<nav class="md-tabs" aria-label="Tabs" data-md-component="tabs">
<div class="md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item md-tabs__item--active">
<a href="." class="md-tabs__link">
Overview
</a>
</li>
<li class="md-tabs__item">
<a href="installation/" class="md-tabs__link">
Installation
</a>
</li>
<li class="md-tabs__item">
<a href="cli/" class="md-tabs__link">
CLI Usage
</a>
</li>
<li class="md-tabs__item">
<a href="library/" class="md-tabs__link">
Library Usage
</a>
</li>
<li class="md-tabs__item">
<a href="development/" class="md-tabs__link">
Development
</a>
</li>
<li class="md-tabs__item">
<a href="releasing/" class="md-tabs__link">
Releasing
</a>
</li>
</ul>
</div>
</nav>
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="." title="Borg Data Collector" class="md-nav__button md-logo" aria-label="Borg Data Collector" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
Borg Data Collector
</label>
<div class="md-nav__source">
<a href="https://github.com/Snider/Borg" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--><path d="M439.6 236.1 244 40.5c-5.4-5.5-12.8-8.5-20.4-8.5s-15 3-20.4 8.4L162.5 81l51.5 51.5c27.1-9.1 52.7 16.8 43.4 43.7l49.7 49.7c34.2-11.8 61.2 31 35.5 56.7-26.5 26.5-70.2-2.9-56-37.3L240.3 199v121.9c25.3 12.5 22.3 41.8 9.1 55-6.4 6.4-15.2 10.1-24.3 10.1s-17.8-3.6-24.3-10.1c-17.6-17.6-11.1-46.9 11.2-56v-123c-20.8-8.5-24.6-30.7-18.6-45L142.6 101 8.5 235.1C3 240.6 0 247.9 0 255.5s3 15 8.5 20.4l195.6 195.7c5.4 5.4 12.7 8.4 20.4 8.4s15-3 20.4-8.4l194.7-194.7c5.4-5.4 8.4-12.8 8.4-20.4s-3-15-8.4-20.4"/></svg>
</div>
<div class="md-source__repository">
GitHub
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Overview
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="." class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
Overview
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#installation" class="md-nav__link">
<span class="md-ellipsis">
Installation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#usage" class="md-nav__link">
<span class="md-ellipsis">
Usage
</span>
</a>
<nav class="md-nav" aria-label="Usage">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#borg-collect" class="md-nav__link">
<span class="md-ellipsis">
borg collect
</span>
</a>
<nav class="md-nav" aria-label="borg collect">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#borg-collect-github-repo" class="md-nav__link">
<span class="md-ellipsis">
borg collect github repo
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#borg-collect-github-release" class="md-nav__link">
<span class="md-ellipsis">
borg collect github release
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#borg-collect-pwa" class="md-nav__link">
<span class="md-ellipsis">
borg collect pwa
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#borg-collect-website" class="md-nav__link">
<span class="md-ellipsis">
borg collect website
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#borg-all" class="md-nav__link">
<span class="md-ellipsis">
borg all
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#borg-compile" class="md-nav__link">
<span class="md-ellipsis">
borg compile
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#borg-run" class="md-nav__link">
<span class="md-ellipsis">
borg run
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#borg-serve" class="md-nav__link">
<span class="md-ellipsis">
borg serve
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#borg-decode" class="md-nav__link">
<span class="md-ellipsis">
borg decode
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#formats" class="md-nav__link">
<span class="md-ellipsis">
Formats
</span>
</a>
<nav class="md-nav" aria-label="Formats">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#datanode" class="md-nav__link">
<span class="md-ellipsis">
DataNode
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#terminal-isolation-matrix-tim" class="md-nav__link">
<span class="md-ellipsis">
Terminal Isolation Matrix (TIM)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#trix" class="md-nav__link">
<span class="md-ellipsis">
Trix
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#encryption" class="md-nav__link">
<span class="md-ellipsis">
Encryption
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#decoding" class="md-nav__link">
<span class="md-ellipsis">
Decoding
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="installation/" class="md-nav__link">
<span class="md-ellipsis">
Installation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="cli/" class="md-nav__link">
<span class="md-ellipsis">
CLI Usage
</span>
</a>
</li>
<li class="md-nav__item">
<a href="library/" class="md-nav__link">
<span class="md-ellipsis">
Library Usage
</span>
</a>
</li>
<li class="md-nav__item">
<a href="development/" class="md-nav__link">
<span class="md-ellipsis">
Development
</span>
</a>
</li>
<li class="md-nav__item">
<a href="releasing/" class="md-nav__link">
<span class="md-ellipsis">
Releasing
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="borg">Borg</h1>
<p>Borg is a command-line tool for collecting resources from various URIs (like Git repositories and websites) into a unified format.</p>
<h2 id="installation">Installation</h2>
<p>You can install Borg using <code>go install</code>:</p>
<pre><code class="language-bash">go install github.com/Snider/Borg@latest
</code></pre>
<h2 id="usage">Usage</h2>
<p>Borg provides several subcommands for collecting different types of resources.</p>
<h3 id="borg-collect"><code>borg collect</code></h3>
<p>The <code>collect</code> command is the main entry point for collecting resources. It has several subcommands for different resource types.</p>
<h4 id="borg-collect-github-repo"><code>borg collect github repo</code></h4>
<p>This command collects a single Git repository and stores it in a DataNode.</p>
<pre><code class="language-bash">./borg collect github repo https://github.com/Snider/Borg --output borg.dat
</code></pre>
<h4 id="borg-collect-github-release"><code>borg collect github release</code></h4>
<p>This command downloads and packages the assets from a GitHub release.</p>
<pre><code class="language-bash">./borg collect github release https://github.com/Snider/Borg/releases/latest --output borg-release.dat
</code></pre>
<h4 id="borg-collect-pwa"><code>borg collect pwa</code></h4>
<p>This command collects a Progressive Web App (PWA) from a given URI.</p>
<pre><code class="language-bash">./borg collect pwa --uri https://squoosh.app --output squoosh.dat
</code></pre>
<h4 id="borg-collect-website"><code>borg collect website</code></h4>
<p>This command collects a single website and stores it in a DataNode.</p>
<pre><code class="language-bash">./borg collect website https://example.com --output example.dat
</code></pre>
<h3 id="borg-all"><code>borg all</code></h3>
<p>The <code>borg all</code> command collects all public repositories from a GitHub user or organization.</p>
<pre><code class="language-bash">./borg all https://github.com/Snider --output snider.dat
</code></pre>
<h3 id="borg-compile"><code>borg compile</code></h3>
<p>The <code>borg compile</code> command compiles a <code>Borgfile</code> into a Terminal Isolation Matrix.</p>
<pre><code class="language-bash">./borg compile --file Borgfile --output a.tim
</code></pre>
<h3 id="borg-run"><code>borg run</code></h3>
<p>The <code>borg run</code> command executes a Terminal Isolation Matrix.</p>
<pre><code class="language-bash">./borg run a.tim
</code></pre>
<h3 id="borg-serve"><code>borg serve</code></h3>
<p>The <code>borg serve</code> command serves a DataNode or Terminal Isolation Matrix using a static file server.</p>
<pre><code class="language-bash">./borg serve my-collected-data.dat --port 8080
</code></pre>
<h3 id="borg-decode"><code>borg decode</code></h3>
<p>The <code>borg decode</code> command decodes a <code>.trix</code> or <code>.tim</code> file.</p>
<pre><code class="language-bash">./borg decode my-collected-data.trix --output my-collected-data.dat
</code></pre>
<h2 id="formats">Formats</h2>
<p>Borg supports three output formats: <code>datanode</code>, <code>tim</code>, and <code>trix</code>.</p>
<h3 id="datanode">DataNode</h3>
<p>The <code>datanode</code> format is a simple tarball containing the collected resources. This is the default format.</p>
<h3 id="terminal-isolation-matrix-tim">Terminal Isolation Matrix (TIM)</h3>
<p>The Terminal Isolation Matrix (<code>tim</code>) is a <code>runc</code> bundle that can be executed in an isolated environment. This is useful for analyzing potentially malicious code without affecting the host system. A <code>.tim</code> file is a specialized <code>.trix</code> file with the <code>tim</code> flag set in its header.</p>
<p>To create a TIM, use the <code>--format tim</code> flag with any of the <code>collect</code> subcommands.</p>
<pre><code class="language-bash">./borg collect github repo https://github.com/Snider/Borg --output borg.tim --format tim
</code></pre>
<h3 id="trix">Trix</h3>
<p>The <code>trix</code> format is an encrypted and structured file format. It is used as the underlying format for <code>.tim</code> files, but can also be used on its own for encrypting any <code>DataNode</code>.</p>
<p>To create a <code>.trix</code> file, use the <code>--format trix</code> flag with any of the <code>collect</code> subcommands.</p>
<pre><code class="language-bash">./borg collect github repo https://github.com/Snider/Borg --output borg.trix --format trix --password &quot;my-secret-password&quot;
</code></pre>
<h2 id="encryption">Encryption</h2>
<p>Both the <code>tim</code> and <code>trix</code> formats can be encrypted with a password by using the <code>--password</code> flag.</p>
<h2 id="decoding">Decoding</h2>
<p>To decode a <code>.trix</code> or <code>.tim</code> file, use the <code>decode</code> command. If the file is encrypted, you must provide the <code>--password</code> flag.</p>
<pre><code class="language-bash">./borg decode borg.trix --output borg.dat --password &quot;my-secret-password&quot;
</code></pre>
<p>If you are decoding a <code>.tim</code> file, you must also provide the <code>--i-am-in-isolation</code> flag. This is a safety measure to prevent you from accidentally executing potentially malicious code on your host system.</p>
<pre><code class="language-bash">./borg decode borg.tim --output borg.dat --i-am-in-isolation
</code></pre>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"annotate": null, "base": ".", "features": ["navigation.tabs", "navigation.sections", "content.code.copy", "toc.integrate"], "search": "assets/javascripts/workers/search.2c215733.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
<script src="assets/javascripts/bundle.79ae519e.min.js"></script>
</body>
</html>