This is a collection of tools for creating and manipulating BitTorrent v2 torrent files

Overview

torrent tools

This is a collection of tools for creating and manipulating BitTorrent v2 torrent files. torrent-new can create hybrid torrents, but the other tools for manipulating torrents only supports v2.

torrent-new
Creates new torrent files
torrent-merge
merges multiple torrents and creates a new torrent with all files in it
torrent-add
add a new file to an existing torrent
torrent-modify
remove and rename files from a torrent. Add and remove trackers, DHT nodes, web sedds and other properties.
torrent-print
print the content of a .torrent file to stdout

examples

Here's a demonstration of some of the things one can do with these tools. First, create two files to test:

$ dd count=16000 if=/dev/random of=file-number-1
$ dd count=32000 if=/dev/random of=file-number-2

create a torrent

We can create a torrent from one of them (this is a v2-only torrent):

$ ./torrent-new -o torrent-1.torrent -2 -m file-number-1
/Users/arvid/Documents/dev/torrent-tools/file-number-1
249/250

See what it looks like:

$ ./torrent-print torrent-1.torrent
piece-count: 250
piece length: 32768
info hash: v2: 9a12b62cf2717146eeaf5519cd5fdc981a251fd31df1f92d2a664f5320513ec2
comment:
created by: torrent-tools
name: file-number-1
number of files: 1
files:
    8192000 ---- file-number-1

extend a torrent

Now, we can extend torrent-1.torrent, by adding another file to it. This is done without re-hashing file-number-1, just the file that's being added:

$ ./torrent-add torrent-1.torrent -o torrent-2.torrent -m file-number-2
piece size: 32768
adding file-number-2
499/500
-> writing to torrent-2.torrent

The new torrent looks like this:

$ ./torrent-print torrent-2.torrent
piece-count: 750
piece length: 32768
info hash: v2: 982f09b470be0e2218147b0a1aa2fb24c42cfde2c6fbb922fcbf3eba1b9089bb
comment:
created by: torrent-tools
name: file-number-1
number of files: 2
files:
    8192000 ---- file-number-1/file-number-1
   16384000 ---- file-number-1/file-number-2

merge torrents

Create two torrents, one file each:

$ ./torrent-new -o 1.torrent -2 -m file-number-1
/Users/arvid/Documents/dev/torrent-tools/file-number-1
249/250
$ ./torrent-new -o 2.torrent -2 -m file-number-2
/Users/arvid/Documents/dev/torrent-tools/file-number-2
249/250

Merge them:

$ ./torrent-merge -o merged.torrent 1.torrent 2.torrent
-> 1.torrent
  8545cbbe942e7c0d8061a8ed31b0badb32feadc1f4963ec2f6643df30d07500b 8192000 file-number-1
-> 2.torrent
  d64405bd94ec88f708481612a1dd35203d88d864191b0a584e2ebc27cfa336dd 16384000 file-number-2
new piece size: 65536
-> writing to merged.torrent

The new torrent now contains both files:

$ ./torrent-print merged.torrent
piece-count: 375
piece length: 65536
info hash: v2: a2898893986df997ee10c7765a8ae8b523460e18363b89c8c6ba15070b9c985c
comment:
created by: torrent-tools
name: file-number-1
number of files: 2
files:
    8192000 ---- file-number-1/file-number-1
   16384000 ---- file-number-1/file-number-2

modify torrents

The merged.torrent has a root directory called file-number-1:

$ ./torrent-print --tree merged.torrent
piece-count: 375
piece length: 65536
info hash: v2: a2898893986df997ee10c7765a8ae8b523460e18363b89c8c6ba15070b9c985c
comment:
created by: torrent-tools
name: file-number-1
number of files: 2
files:
                 └ file-number-1
    8192000 ----   ├ file-number-1
   16384000 ----   └ file-number-2

Let's rename the root folder to "foobar":

$ ./torrent-modify --name foobar -o merged2.torrent merged.torrent

The new torrent looks like this:

$ ./torrent-print --tree merged2.torrent
piece-count: 375
piece length: 65536
info hash: v2: b2adfd009b31bc56f7af9f9962fc9fdc1d80282e598e8d8857c7e82aa9b55cd4
comment:
created by: torrent-tools
name: foobar
number of files: 2
files:
                 └ foobar
    8192000 ----   ├ file-number-1
   16384000 ----   └ file-number-2

Now, set a comment:

$ ./torrent-modify --comment "This is a foobar" -o merged3.torrent merged2.torrent

The new torrent looks like this:

$ ./torrent-print --tree merged3.torrent
piece-count: 375
piece length: 65536
info hash: v2: b2adfd009b31bc56f7af9f9962fc9fdc1d80282e598e8d8857c7e82aa9b55cd4
comment: This is a foobar
created by: torrent-tools
name: foobar
number of files: 2
files:
                 └ foobar
    8192000 ----   ├ file-number-1
   16384000 ----   └ file-number-2
Owner
Arvid Norberg
Arvid Norberg
A collection of tools to abuse chrome browser

A collection of tools to abuse chrome browser

batsec 261 Aug 6, 2022
the checkra1n set of tools targeting bare metal, Linux and Windows

Universal toolchain Low-effort cross-compiling for the masses. What's Universal toolchain? It's a collection of sysroots and shell scripts in such a w

null 62 May 27, 2022
Tools for analyzing and browsing Tarmac instruction traces.

Tarmac Trace Utilities Arm Tarmac Trace Utilities is a suite of tools to read, analyze and browse traces of running programs in the 'Tarmac' textual f

Arm Software 31 Aug 1, 2022
My collection of raylib code examples - For learning the C language with 2D and 3D games.

Raylib-Examples My collection of raylib examples. ( https://www.raylib.com/index.html ) For Raylib Version of 4 april 2020 ( Notepad++ windows install

Rudy Boudewijn van Etten 47 Jul 11, 2022
Play Doh Windows ACL Tools

PDAcl 是一个支持Windows活动目录扩展权限设置、Windows活动目录常规权限设置、Windows服务权限设置的命令工具。

倾旋 58 Jun 25, 2022
Open-CMSIS-Pack development tools - C++

CMSIS-Pack Development Tools and Libraries This repository contains the source code of command line tools and library components for processing meta i

Open-CMSIS-Pack 27 Jul 26, 2022
A shebang-friendly script for "interpreting" single C99, C11, and C++ files, including rcfile support.

c99sh Basic Idea Control Files Shebang Tricks C++ C11 Credits Basic Idea A shebang-friendly script for "interpreting" single C99, C11, and C++ files,

Rhys Ulerich 101 Jul 29, 2022
A tool for use with clang to analyze #includes in C and C++ source files

Include What You Use For more in-depth documentation, see docs. Instructions for Users "Include what you use" means this: for every symbol (type, func

null 2.9k Aug 13, 2022
ByteCopy , or BCP, intends to copy files accurately (down to the bytes) in a simple , safe and efficient manner.

ByteCopy v3.6 About ByteCopy , or BCP, intends to copy files accurately (down to the bytes) in a simple , safe and efficient manner. It's functionalit

A.P. Jo. 16 Jun 22, 2022
RapidObj is an easy-to-use, single-header C++17 library that loads and parses Wavefront .obj files.

RapidObj About Integration Prerequisites Manual Integration CMake Integration API RapidObj Result Next Steps OS Support Third Party Tools and Resource

Slobodan Pavlic 77 Aug 4, 2022
libnpy is a simple C++ library for reading and writing of numpy's .npy files.

C++ library for reading and writing of numpy's .npy files

Leon Merten Lohse 164 Aug 3, 2022
Libelf is a simple library to read ELF files

libelf Libelf is a simple library which provides functions to read ELF files. Headers #include <stdint.h> #include <elf.h> Structures typedef struct

David du Colombier 44 Aug 7, 2022
Cobalt Strike BOF Files with Nim!

BOF-Nim oh yeah baby I have an inkling it's possible, right now the problem seems to be getting the go function to be present in the Symbol table. No

byt3bl33d3r 63 Jul 28, 2022
A tool to edit Cyberpunk 2077 sav.dat files

This is a holidays project and will probably not reach the user-friendly GUI state that a save editor is expected to have.

null 259 Aug 7, 2022
Load Aseprite files for animated sprites in raylib.

raylib-aseprite Load Aseprite .aseprite files for animated sprites in raylib. Features Load Aseprite files directly for use in raylib Draw individual

Rob Loach 25 Jul 27, 2022
Disassembling .class files

jvmdisassembler Contribution You can contribute by creating an issue or pull request. Please keep the code clean and readable. All contributed code mu

Jonas 6 Jun 20, 2022
Atomically exchange two files in Linux

Atomically exchange two files in Linux.

David Pape 9 Aug 4, 2022
A tool for Pikmin 1 model files

MODConv A Pikmin 1 model format converter Functionality NOTE: these are not command-line parameters, the program has a built-in input parser load (inp

null 4 Oct 20, 2021
Authenticode Hash Calculator for PE32/PE32+ files

AuthHashCalc Authenticode Hash Calculator for PE32/PE32+ files System Requirements x86/x64 Windows 7/8/8.1/10/11 Administrative privilges are not requ

null 58 Jul 27, 2022