THE WRITER MUST EAT -> patreon.com/trn1ty <-

| \    |   | blah!
|\ | `\|\  | the rantings and ravings
|/ |(_|| | * of a depraved lunatic

<^>

2024-06-12

: debugging some bullshit

> alright i wanna torrent some linux isos
$ torsocks aria2c --disable-ipv6 magnet://...

[every other port abridged]

06/12 19:02:40 [ERROR] IPv4 BitTorrent: failed to bind TCP port 6947
Exception: [SocketCore.cc:367] errorCode=1 Failed to listen to a socket, cause:
Operation not permitted

06/12 19:02:40 [ERROR] IPv4 BitTorrent: failed to bind TCP port 6909
Exception: [SocketCore.cc:367] errorCode=1 Failed to listen to a socket, cause:
Operation not permitted

06/12 19:02:40 [ERROR] IPv4 BitTorrent: failed to bind TCP port 6955
Exception: [SocketCore.cc:367] errorCode=1 Failed to listen to a socket, cause:
Operation not permitted

06/12 19:02:40 [ERROR] IPv4 BitTorrent: failed to bind TCP port 6977
Exception: [SocketCore.cc:367] errorCode=1 Failed to listen to a socket, cause:
Operation not permitted

06/12 19:02:40 [ERROR] IPv4 BitTorrent: failed to bind TCP port 6915
Exception: [SocketCore.cc:367] errorCode=1 Failed to listen to a socket, cause:
Operation not permitted

06/12 19:02:40 [ERROR] Exception caught
Exception: [BtSetup.cc:212] errorCode=1 Errors occurred while binding port.

06/12 19:02:40 [NOTICE] Download [...] not complete: [...]

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
...   |ERR |        n/a|...

Status Legend:
(ERR):error occurred.

aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man pag
e for details.

> well fuck
> perms issue?
$ doas torsocks aria2c --disable-ipv6 magnet://...
[errors out]

$ doas setcap cap_net_raw=ep $(which aria2c)
$ torsocks aria2c --disable-ipv6 magnet://...
[torsocks errors out because it hates extra perms]

> well fuck
> iptables issue?
$ man iptables

> wait let me try something
$ cd
$ python3 -m http.server 6915 &
[1] 95309
Serving HTTP on 0.0.0.0 port 6915 (http://0.0.0.0:6915/) ...

$ curl http://127.0.0.1:6915/.bash_history | tail -n 9
man setcap
sudo setcap -r $(which aria2c)
man setcap
sudo setcap -r $(which aria2c) cap_net_raw
sudo setcap -r $(which aria2c)
sudo setcap -rcap_net_raw $(which aria2c)
sudo setcap - rcap_net_raw $(which aria2c)
sudo setcap -r - $(which aria2c)
sudo setcap - -r $(which aria2c)

> i still can't figure out how to use fucking setcap(8)
> this isn't a port problem. maybe torsocks?
$ kill 95309
[1]+  Terminated              python3 -m http.server

$ torsocks python3 -m http.server
1718241786 ERROR torsocks[104835]: Unable to resolve. Status reply: 4 (in socks
5_recv_resolve_reply() at socks5.c:677)
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.9/http/server.py", line 1289, in 
    test(
  File "/usr/lib/python3.9/http/server.py", line 1244, in test
    with ServerClass(addr, HandlerClass) as httpd:
  File "/usr/lib/python3.9/socketserver.py", line 453, in __init__
    self.server_activate()
  File "/usr/lib/python3.9/socketserver.py", line 475, in server_activate
    self.socket.listen(self.request_queue_size)
PermissionError: [Errno 1] Operation not permitted

> alright what the fuck
$ man torsocks
$ man 8 torsocks
$ TORSOCKS_ALLOW_INBOUND=1 aria2c --disable-ipv6 ...

06/12 19:32:48 [NOTICE] Downloading 1 item(s)

06/12 19:32:48 [ERROR] Exception caught while loading DHT routing table from /h
ome/trinity/.cache/aria2/dht.dat
Exception: [DHTRoutingTableDeserializer.cc:82] errorCode=1 Failed to load DHT r
outing table from /home/trinity/.cache/aria2/dht.dat

06/12 19:32:48 [NOTICE] IPv4 DHT: listening on UDP port 6925

06/12 19:32:48 [NOTICE] IPv4 BitTorrent: listening on TCP port 6917

[it works]

> FUCK yeah

<^>

No rights reserved, all rights exercised, rights turned to lefts, left in this
corner of the web.