2025-11-14 13:47:27 +00:00
# Borg
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
Borg is a command-line tool for collecting resources from various URIs (like Git repositories and websites) into a unified format.
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
## Installation
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
You can install Borg using `go install` :
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
```bash
go install github.com/Snider/Borg@latest
2025-11-02 12:23:25 +00:00
```
2025-11-14 13:47:27 +00:00
## Usage
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
Borg provides several subcommands for collecting different types of resources.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
### `borg collect`
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
The `collect` command is the main entry point for collecting resources. It has several subcommands for different resource types.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
#### `borg collect github repo`
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
This command collects a single Git repository and stores it in a DataNode.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg collect github repo https://github.com/Snider/Borg --output borg.dat
2025-11-14 11:12:15 +00:00
```
2025-11-14 13:47:27 +00:00
#### `borg collect github release`
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
This command downloads and packages the assets from a GitHub release.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg collect github release https://github.com/Snider/Borg/releases/latest --output borg-release.dat
2025-11-14 11:12:15 +00:00
```
2025-11-14 13:47:27 +00:00
#### `borg collect pwa`
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
This command collects a Progressive Web App (PWA) from a given URI.
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
```bash
2025-11-02 12:23:25 +00:00
./borg collect pwa --uri https://squoosh.app --output squoosh.dat
```
2025-11-14 13:47:27 +00:00
#### `borg collect website`
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
This command collects a single website and stores it in a DataNode.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg collect website https://example.com --output example.dat
2025-11-14 11:12:15 +00:00
```
2025-11-14 13:47:27 +00:00
### `borg all`
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
The `borg all` command collects all public repositories from a GitHub user or organization.
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg all https://github.com/Snider --output snider.dat
2025-11-02 12:23:25 +00:00
```
2025-11-14 13:47:27 +00:00
### `borg compile`
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
The `borg compile` command compiles a `Borgfile` into a Terminal Isolation Matrix.
2025-11-02 13:03:48 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg compile --file Borgfile --output a.tim
2025-11-02 12:23:25 +00:00
```
2025-11-14 13:47:27 +00:00
### `borg run`
2025-11-02 13:27:04 +00:00
2025-11-14 13:47:27 +00:00
The `borg run` command executes a Terminal Isolation Matrix.
2025-11-02 13:27:04 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg run a.tim
2025-11-02 13:27:04 +00:00
```
2025-11-14 13:47:27 +00:00
### `borg serve`
2025-11-02 12:39:46 +00:00
2025-11-14 13:47:27 +00:00
The `borg serve` command serves a DataNode or Terminal Isolation Matrix using a static file server.
2025-11-02 12:39:46 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg serve my-collected-data.dat --port 8080
2025-11-02 12:39:46 +00:00
```
2025-11-14 13:47:27 +00:00
### `borg decode`
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
The `borg decode` command decodes a `.trix` or `.tim` file.
2025-11-02 12:39:46 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg decode my-collected-data.trix --output my-collected-data.dat
2025-11-02 12:39:46 +00:00
```
2025-11-14 13:47:27 +00:00
## Formats
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
Borg supports three output formats: `datanode` , `tim` , and `trix` .
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
### DataNode
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
The `datanode` format is a simple tarball containing the collected resources. This is the default format.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
### Terminal Isolation Matrix (TIM)
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
The Terminal Isolation Matrix (`tim` ) is a `runc` bundle that can be executed in an isolated environment. This is useful for analyzing potentially malicious code without affecting the host system. A `.tim` file is a specialized `.trix` file with the `tim` flag set in its header.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
To create a TIM, use the `--format tim` flag with any of the `collect` subcommands.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg collect github repo https://github.com/Snider/Borg --output borg.tim --format tim
2025-11-14 11:12:15 +00:00
```
2025-11-14 13:47:27 +00:00
### Trix
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
The `trix` format is an encrypted and structured file format. It is used as the underlying format for `.tim` files, but can also be used on its own for encrypting any `DataNode` .
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
To create a `.trix` file, use the `--format trix` flag with any of the `collect` subcommands.
2025-11-02 12:23:25 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg collect github repo https://github.com/Snider/Borg --output borg.trix --format trix --password "my-secret-password"
2025-11-14 11:12:15 +00:00
```
2025-11-14 13:47:27 +00:00
## Encryption
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
Both the `tim` and `trix` formats can be encrypted with a password by using the `--password` flag.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
## Decoding
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
To decode a `.trix` or `.tim` file, use the `decode` command. If the file is encrypted, you must provide the `--password` flag.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg decode borg.trix --output borg.dat --password "my-secret-password"
2025-11-14 11:12:15 +00:00
```
2025-11-14 13:47:27 +00:00
If you are decoding a `.tim` file, you must also provide the `--i-am-in-isolation` flag. This is a safety measure to prevent you from accidentally executing potentially malicious code on your host system.
2025-11-14 11:12:15 +00:00
2025-11-14 13:47:27 +00:00
```bash
./borg decode borg.tim --output borg.dat --i-am-in-isolation
2025-11-02 12:23:25 +00:00
```