Skip to content

re-ws.pl

ReverseEngineering WorkStation

  • Home
  • Tutorials
  • Random
  • About

How to recover torrent from rtorrent meta files

Posted on May 27, 2024 - May 28, 2024 by Kamil (aka. v3l0c1r4pt0r)
meta2torrent result in torrent file editor

rtorrent is very nice tool to download torrents quickly and on headless systems. However, while making such a quick use, I was caught by its weird design decision that it comes unconfigured and while not configured explicitly it does not store its session in any way, even as torrent files of jobs that were started. I can imagine that in many cases it is not a problem as still usually torrent files are easily available and if not using magnet to obtain one is not a problem. Unfortunately I ran into such a weird situation where I was not able to start a job again with just a magnet link and obviously was not able to download whole torrent at one run. Also saving session in rtorrent was not working. So the only chance for me to recover download job was to use meta file that rtorrent leaves behind for reason unknown. There is even Github issue discussing those files and requesting ability to use them to recover the job. But unfortunately it is still open. So the only way for me was to do it myself.

meta2torrent.py

Let me first show you this little, handy tool to do it automatically. To be able to use it you have to simply clone the repo and install all dependencies:

git clone https://github.com/v3l0c1r4pt0r/meta2torrent
cd meta2torrent
pip install -r requirements.txt

Then to convert meta file, you have to provide its location, name of the output torrent file and optionally list of trackers:

./meta2torrent.py --announce 'udp%3A//tracker.opentrackr.org%3A1337/announce' A8F2B5E67788128CD4F23DCFCB5826F2A5021A07.meta A8F2B5E67788128CD4F23DCFCB5826F2A5021A07.torrent

Unfortunately meta files do not seem to contain any trackers, so they have to be provided externally. It is also possible to skip, but in this case it might be harder to find peers for the download as you would need to base only on DHT for finding them.

How does it work?

While for ordinary user above knowledge should be sufficient, there might be some people wondering how it works, or (more likely) why it does not and how to fix that. The script is just a quick hack, written in one evening, so there are a lot of things that could go wrong.

So, basically meta file is almost identical as ordinary torrent file, while still being completely incompatible with it. It uses the same bencode encoding to pack structured data into a tree. But for some reason authors of this format did not keep identical structure, but rather cut one subtree of torrent root tree and dropped all the metadata beside it. This can be easily seen in the picture below.

meta file and torrent file structure
meta and torrent file bencoded structure

As can be seen, there are 4 nodes in meta file’s root node (length, name, piece length and pieces), while torrent file has info node directly in root, while same nodes are under it. Beside that in root there are some metadata nodes, that can be either easily generated, or copied from info. In this example there is no announce in torrent file, while usually it is there. Also there is url-list for HTTP download acceleration, this can be ignored here, it is optional and usually does not appear at all. There is also different variant of torrent files, where there is more than one file inside and in this case there is files node instead of length field, that describe each file in torrent. In such case, this files node also appears in meta file, as the rest shown here, so conversion algorithm does not change.

And this was as easy as that. Nothing more. Maybe there are more variations of torrent files that will generate errors with this script. Who knows. For me this was just a quick hack to solve a problem that occurred for the first time for me and it is likely that I will not encounter it anymore. The other lesson for me is to configure rtorrent before first use. If I did that, I would never encounter this issue. If you did this same mistake, hope I provided enough information to help you.

Posted in TutorialsTagged hacking, torrent

Post navigation

Connecting WMS services to apps able to handle only OpenStreetMap format like OsmAnd Android app
Authorizing adb connections from Android command line (and making other service calls from cli)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tags

Android assembly busybox C CAN can-hacking cc-factory cmake compiler docker Dreamspark electronics English gcc hacking hardware JavaCard JCOP kernel KiCAD library Linux PC PCB pinout PKI polski programming Python radio Raspberry Pi Reverse Engineering RTL-SDR SDC SDM SDR smart card software tor tty UART UEFi Windows X.509 Xperia Pro

Recent Posts

  • PHP build for use bundled in Android applications
  • Running graphical apps inside Docker containers
  • Plugin architecture demo for Python projects
  • Authorizing adb connections from Android command line (and making other service calls from cli)
  • How to recover torrent from rtorrent meta files

Recent Comments

  • pomi on Playing with GF-07 GPS device
  • pomi on Playing with GF-07 GPS device
  • Hamdy Abumgata on Playing with GF-07 GPS device
  • Mousum Gogoi on Playing with GF-07 GPS device
  • Eason on Sniffing USB traffic with DSLogic logic analyzer into pcap file

Categories

  • News
  • Random
  • Reversing LKV373A
  • Setting up new v3 Hidden Service with ultimate security
  • Tutorials
  • Uncategorized
  • Understanding JCOP

Links

  • Me @ github
  • LKV373A Wiki
  • DevTomek

Archives

  • December 2024
  • November 2024
  • May 2024
  • July 2023
  • October 2022
  • August 2022
  • July 2021
  • June 2021
  • May 2021
  • December 2020
  • November 2020
  • October 2020
  • August 2020
  • December 2019
  • November 2019
  • October 2019
  • August 2019
  • July 2019
  • February 2019
  • November 2018
  • October 2018
  • June 2018
  • May 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • September 2017

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Proudly powered by WordPress | Theme: micro, developed by DevriX.