Skip to content

A python CLI Tool with the ability to download files from the BitTorrent network. Used the knowledge of networking and studied the P2P networks to come up with this project

Notifications You must be signed in to change notification settings

Naman027/TorrentClient_Py

Repository files navigation

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contact
  5. References

About The Project

This is a CLI tool that downloads files from the BitTorrent network.

I wanted to make a straightforward program to learn how does BitTorrent protocol works.

It is written with python 3.8, only the pubsub library was used to create events when a new peer is connected, or when data is received from a peer. You first need to wait for the program to connect to some peers first, then it starts downloading.

With this torrent client, you can :

  • Read a torrent file
  • Scrape udp or http trackers
  • Connect to peers
  • Ask them for the blocks you want
  • Save a block in RAM, and when a piece is completed and checked, write the data into your hard drive
  • Will add Wireshark debugging soon.

    Built With

    Python

    Getting Started

    Prerequisites

    1. Python
    2. Knowledge of TCP/UDP protocols
    3. Asynchronous programming
    4. Peer to Peer networks

    Installation

    You can run the following command to install the dependencies using pip

    pip3 install -r requirements.txt
    Note:This is not applicable on Windows

    Usage

    If you want to specify a torrent file, you need to edit it manually in the main.py file:

    self.torrent = Torrent.Torrent("path_to_your_torrent") 

    Then simply run: python3 main.py

    The files will be downloaded in the same path as your main.py script.

    Contributing

    Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

    1. Fork the Project
    2. Create your Feature Branch (git checkout -b feature/Torrent-Client)
    3. Commit your Changes (git commit -m 'Add some features')
    4. Push to the Branch (git push origin feature/Torrent-Client)
    5. Open a Pull Request

    References

    1.http://allenkim67.github.io/programming/2016/05/04/how-to-make-your-own-bittorrent-client.html
    2.http://www.kristenwidman.com/blog/33/how-to-write-a-bittorrent-client-part-1/
    3.https://github.com/lita/bittorrent
    4.https://wiki.theory.org/BitTorrentSpecification

    About

    A python CLI Tool with the ability to download files from the BitTorrent network. Used the knowledge of networking and studied the P2P networks to come up with this project

    Topics

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages