Skip to main content

An FTP server that forwards uploaded files to Telegram users

Project description

ftp2telegram

ftp2telegram is an FTP server that forwards all uploaded files to preconfigured Telegram contacts. It was developed with the specific goal of retrofitting a Telegram interface into older devices or software that exclusively support FTP upload for file transfer.

Caution: ftp2telegram has not undergone security testing. Avoid exposing it to untrusted networks or the public internet without implementing proper security measures.

Quick Navigation

Features

  • Multiple telegram recipients
  • User authorization
  • Lightweight and fast (uses pyftpdlib underneath)
  • Easy YAML configuration

Installation

Requires Python version 3.9 or higher and pip.

pip install ftp2telegram

Configuration

To configure ftp2telegram, a configuration file is required. By default, the program looks for it in ~/.ftp2telegram.conf or /etc/ftp2telegram. Create a sample configuration file with:

ftp2telegram --create-example-config

Example Configuration File

---
ftp:
  host: 127.0.0.1
  port: 21

telegram:
  token: MY_TOKEN

users:
  - name: alice
    hashed_password: |
      $6$Zfgtsr/z3RLvOEKj$D2s4w51WiFiCgyrRD.gxEeMtXxMkgas1OGkSU2c.XMKDdaJ2iOt72yFXM1rvzb7YuoOJ3.i9lMn1qQ7oVEDEm1
    telegram_id: 123
  • FTP server configuration (ftp):
    • host: Specifies the FTP server's IP address or hostname.
    • port: Specifies the FTP server's port.
  • Telegram configuration (telegram):
    • token: Replace MY_TOKEN with the actual token of your Telegram bot. Create one using BotFather.
  • User configuration (users):
    • Each user in the list is defined by:
      • name: The username for FTP server authentication.
      • hashed_password: The SHA512-hashed password of the FTP user. Generate a hashed password using openssl passwd -6.
      • telegram_id: The Telegram user ID associated with the FTP user. Obtain it using bots such as @userinfobot.

Usage

Run the server:

ftp2telegram

File Upload

Log into the server using any of the configured user credentials, and then upload a file. The uploaded file will be automatically sent to the Telegram user linked to the corresponding FTP user in the config file.

Caveats

  • There are no subfolders on the FTP server, nor does it allow the creation of any. Thus, all files must be directly uploaded to the root directory.
  • Using interactive FTP browsers to access the server may result in errors, as they are restricted from reading the contents of the root directory.
  • Since Telegram bots cannot initiate conversations with users, recipients must add the bot and send them a message first before they can receive any files from the bot.

License

ftp2telegram is distributed under the terms of the MIT License.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ftp2telegram-0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

ftp2telegram-0.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file ftp2telegram-0.1.tar.gz.

File metadata

  • Download URL: ftp2telegram-0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.5.0-4-amd64

File hashes

Hashes for ftp2telegram-0.1.tar.gz
Algorithm Hash digest
SHA256 3d8863f769f279ec2e3d77e59fa3df7f33a71588ea476eb9854bf6571e6b1d3b
MD5 825d65b30e0206a168723ea0e23ff96e
BLAKE2b-256 4675a56c6b58f05bd1d0553fc3fc16e01042062bb1ba3e3ebf11fb6a6e4a4a84

See more details on using hashes here.

File details

Details for the file ftp2telegram-0.1-py3-none-any.whl.

File metadata

  • Download URL: ftp2telegram-0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.5.0-4-amd64

File hashes

Hashes for ftp2telegram-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 198373339a2c9c1223cffc51ccfbfb2e2ec2020ff9a81f71a0bb742bba68500d
MD5 f86b7d8abb7031e1a49b54bfcc6f633a
BLAKE2b-256 6a79205121211bf9d8c4af9dc3249ace0000c0dfd7407aa62ed6e8fd34fc3b7a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page