diff options
Diffstat (limited to 'tracker.0x7c0.com')
-rw-r--r-- | tracker.0x7c0.com/Makefile | 14 | ||||
-rw-r--r-- | tracker.0x7c0.com/index.7 | 28 | ||||
-rw-r--r-- | tracker.0x7c0.com/index.html | 50 | ||||
-rw-r--r-- | tracker.0x7c0.com/style.css | 22 | ||||
-rwxr-xr-x | tracker.0x7c0.com/update-stats.py | 41 |
5 files changed, 155 insertions, 0 deletions
diff --git a/tracker.0x7c0.com/Makefile b/tracker.0x7c0.com/Makefile new file mode 100644 index 0000000..d5e1208 --- /dev/null +++ b/tracker.0x7c0.com/Makefile @@ -0,0 +1,14 @@ +WEBROOT = /var/www/tracker.0x7c0.com + +FILES = index.html style.css + +all: ${FILES} + +index.html: index.7 + mandoc -T html -O style=style.css index.7 > index.html + +install: ${FILES} + install -c -m 644 ${FILES} ${WEBROOT} + +clean: + rm -f index.html diff --git a/tracker.0x7c0.com/index.7 b/tracker.0x7c0.com/index.7 new file mode 100644 index 0000000..b191989 --- /dev/null +++ b/tracker.0x7c0.com/index.7 @@ -0,0 +1,28 @@ +.Dd May 1, 2023 +.Dt TRACKER.0X7C0.COM 7 +.Os "Alpine Linux" +. +.Sh NAME +.Nm tracker.0x7c0.com +.Nd a free and open bittorrent tracker +. +.Sh ANNOUNCE +udp://tracker.0x7c0.com:6969/announce +. +.Sh STATS +. +.Pp +The tracker has been ... [ stats to be generated ] +. +.Sh DESCRIPTION +. +.Pp +This is a +.Lk https://en.wikipedia.org/wiki/BitTorrent_tracker "bittorrent tracker", +a network service which coordinates the reliable transmission of information +between peers. +. +.Pp +There is very little to be found here; there are no indexes or search boxes. You need to speak the +.Lk https://www.bittorrent.org/beps/bep_0003.html "bittorrent protocol" +and have knowledge of a hash to make use of this service. diff --git a/tracker.0x7c0.com/index.html b/tracker.0x7c0.com/index.html new file mode 100644 index 0000000..2c1aa87 --- /dev/null +++ b/tracker.0x7c0.com/index.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"/> + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + <link rel="stylesheet" href="style.css" type="text/css" media="all"/> + <title>TRACKER.0X7C0.COM(7)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">TRACKER.0X7C0.COM(7)</td> + <td class="head-vol">Miscellaneous Information Manual</td> + <td class="head-rtitle">TRACKER.0X7C0.COM(7)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<p class="Pp"><code class="Nm">tracker.0x7c0.com</code> — + <span class="Nd">a free and open bittorrent tracker</span></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="ANNOUNCE"><a class="permalink" href="#ANNOUNCE">ANNOUNCE</a></h1> +<p class="Pp">udp://tracker.0x7c0.com:6969/announce</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="STATS"><a class="permalink" href="#STATS">STATS</a></h1> +<p class="Pp">The tracker has been ... [ stats to be generated ]</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<p class="Pp">This is a + <a class="Lk" href="https://en.wikipedia.org/wiki/BitTorrent_tracker">bittorrent + tracker</a>, a network service which coordinates the reliable transmission + of information between peers.</p> +<p class="Pp">There is very little to be found here; there are no indexes or + search boxes. You need to speak the + <a class="Lk" href="https://www.bittorrent.org/beps/bep_0003.html">bittorrent + protocol</a> and have knowledge of a hash to make use of this service.</p> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">May 1, 2023</td> + <td class="foot-os">Alpine Linux</td> + </tr> +</table> +</body> +</html> diff --git a/tracker.0x7c0.com/style.css b/tracker.0x7c0.com/style.css new file mode 100644 index 0000000..cf3c99e --- /dev/null +++ b/tracker.0x7c0.com/style.css @@ -0,0 +1,22 @@ +table.head, table.foot { width: 100%; } +td.head-rtitle, td.foot-os { text-align: right; } +td.head-vol { text-align: center; } +div.Pp { margin: 1ex 0ex; } +div.Nd, div.Bf, div.Op { display: inline; } +span.Pa, span.Ad { font-style: italic; } +span.Ms { font-weight: bold; } +dl.Bl-diag > dt { font-weight: bold; } +code.Nm, code.Fl, code.Cm, code.Ic, code.In, code.Fd, code.Fn, +code.Cd { font-weight: bold; font-family: inherit; } + +html { font-family: monospace; line-height: 1.25em; font-size: 14px; } +body { max-width: 80ch; margin: 1em auto; padding: 0 1ch; } +table { border-collapse: collapse; } +table.Nm code.Nm { padding-right: 1ch; } +table.foot { margin-top: 1em; } + +html { background-color: var(--ansi16); color: var(--ansi17); } +a { color: var(--ansi4); } +a:visited { color: var(--ansi5); } +a.permalink { color: var(--ansi3); text-decoration: none; } + diff --git a/tracker.0x7c0.com/update-stats.py b/tracker.0x7c0.com/update-stats.py new file mode 100755 index 0000000..2af62eb --- /dev/null +++ b/tracker.0x7c0.com/update-stats.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +import fileinput +import os +import shutil +import sys +import urllib.request + +WWW = '/var/www/tracker.0x7c0.com' + +stats = dict.fromkeys(['torrents', 'connections', 'uptime']) + +conn = urllib.request.Request( + 'http://127.0.0.1:6969/stats?format=txt&mode=conn', +) +r = urllib.request.urlopen(conn).read().decode('utf-8').split('\n') + +stats['uptime'] = int(int(r[2].split()[0]) / 3600) +stats['connections'] = r[3].split()[2] + +conn = urllib.request.Request( + 'http://127.0.0.1:6969/stats?format=txt' +) + +r = urllib.request.urlopen(conn).read().decode('utf-8').split('\n') + +stats['torrents'] = r[2].split()[2] + +s = ( + f'The tracker has been up for {stats["uptime"]} hrs, ' + f'serving {stats["torrents"]} torrents at ' + f'{stats["connections"]} requests per second.\n' +) + +for line in fileinput.input([os.path.join(WWW, 'index.html')], inplace=True): + if line.strip().startswith('The tracker has been'): + line = s + sys.stdout.write(line) + +#import code +#code.interact(local=locals()) |