Linux Torrent

From Omnia
Jump to navigation Jump to search

rtorrent

See rtorrent

mktorrent

mktorrent - http://borg.uu3.net/~borg/?mktorrent

mktorrent - Console .torrent file creator. It support Multi Trackers (tier groups).

Download: ftp://borg.uu3.net/pub/unix/mktorrent/mktorrent-0.9.9.tgz
mktorrent GIT repository: git://borg.uu3.net/mktorrent.git
mktorrent SVN repository (not updated anymore): svn://borg.uu3.net/devel-src/mktorrent

Install:

mkdir -p ~/.src ; cd ~/.src
wget ftp://borg.uu3.net/pub/unix/mktorrent/mktorrent-0.9.9.tgz
tar -zvxf mktorrent-0.9.9.tgz
cd mktorrent
make
sudo cp mktorrent /usr/local/bin

Usage:

mktorrent -a [ANNOUNCE_URL] -o [OUT_FILE.torrent] [FILE/FOLDER...]
# mktorrent -a http://mytorrent.com -o mytorrent.torrent mytorrent/

Makefile:

CC=gcc

# Default
CFLAGS = -w -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFS64
LFLAGS =
LIBS = -lcrypto

# no large file support
#CFLAGS = -w -O2
#LFLAGS =
#LIBS = -lcrypto


APPN = mktorrent
OBJS = mktorrent.o

.c.o:
	$(CC) $(CFLAGS) -c $?

all: $(OBJS)
	$(CC) $(LFLAGS) -o $(APPN) $(OBJS) $(LIBS)

clean:
	rm *.o

Enhanced CTorrent

Enhanced CTorrent - http://www.rahul.net/dholmes/ctorrent/

CTorrent is a BitTorrent client implemented in C++ to be lightweight and quick. The original has fallen a little behind in updates and bug fixes though.

The files here contain the good work of those who wrote the original CTorrent base code and a number of patches that provide fixes and enhancements, as well as additional fixes and enhancements that I am contributing. I am not the original author, current maintainer, or any other official representative of CTorrent. The files on this page are not the original or official CTorrent distribution. I encourage you to visit the CTorrent project page on SourceForge for further information.

Enhanced CTorrent now has a SourceForge project page with forums, bug reporting, and downloads.


Create .torrent with ctorrent: [1]

one tool you could use is ctorrent.
/usr/ports/net-p2p/ctorrent/
ctorrent -t -u tracker_url -s torrent_name source

BitTorrent

BitTorrent Official Linux Client

py3createtorrent

en:coding:py3createtorrent [RobertNitsch.de - Wiki] - http://wiki.robertnitsch.de/doku.php?id=en:coding:py3createtorrent

Create torrents via command line!

py3createtorrent is a comprehensive shell/commandline utility for creating torrents (Linux & Windows). It's a GPL-licensed Python v3.1 script. I tested it with Ubuntu 8.04 / rTorrent and Windows 7 / µTorrent.

Some of the features:

  • you can create huge torrents for any amount of data
  • you can add a comment to the torrent file
  • you can create private torrents (disabled DHT, …)
  • you can create torrents with multiple trackers
  • you can exclude specific files/folders
  • you can exclude files/folders based on regular expressions
  • you can specify custom piece sizes
  • you can specify custom creation dates

bittorrent file parser in php

bittorrent file parser in php [php] [torrent] - http://snippets.dzone.com/posts/show/3289

// parser function to recursively convert torrent file into array

<?php

// bit torrent parser function by techtonik // php.net


if ($argc != 2) exit("usage: ".$argv[0]." <torrent>");
$input = $argv[1];
if (!file_exists($input)) { exit("input file $input doesn't exists"); }

$str = file_get_contents($input);

function parse_torrent($s) {
    static $str;
    $str = $s;

//    echo $str{0};

    if ($str{0} == 'd') {
       $str = substr($str,1);
       $ret = array();
       while (strlen($str) && $str{0} != 'e') {
          $key = parse_torrent($str);
          if (strlen($str) == strlen($s)) break; // prevent endless cycle if no changes made
          if (!strcmp($key, "info")) {
              $save = $str;
          }
//          echo ".",$str{0};
          $value = parse_torrent($str);
          if (!strcmp($key, "info")) {
              $tosha = substr($save, 0, strlen($save) - strlen($str));
              $ret['info_hash'] = sha1($tosha);
          }

          // process hashes - make this stuff an array by piece
          if (!strcmp($key, "pieces")) {
              $value = explode("====",
                         substr(
                           chunk_split( $value, 20, "===="),
                           0, -4
                         )
                       );
          };
          $ret[$key] = $value;
       }
       $str = substr($str,1);
       return $ret;
    } else if ($str{0} == 'i') {
//       echo "_";
       $ret = substr($str, 1, strpos($str, "e")-1);
       $str = substr($str, strpos($str, "e")+1);
       return $ret;
    } else if ($str{0} == 'l') {
//       echo "#";
       $ret = array();
       $str = substr($str, 1);
       while (strlen($str) && $str{0} != 'e') {
          $value = parse_torrent($str);
          if (strlen($str) == strlen($s)) break; // prevent endless cycle if no changes made
          $ret[] = $value;
       }
       $str = substr($str,1);
       return $ret;
    } else if (is_numeric($str{0})) {
//       echo "@";
       $namelen = substr($str, 0, strpos($str, ":"));
       $name = substr($str, strpos($str, ":")+1, $namelen);
       $str = substr($str, strpos($str, ":")+1+$namelen);
       return $name;
    }                                
}

$bencode = parse_torrent($str);

print_r( $bencode );

Others:

keywords