GithubHelp home page GithubHelp logo

eustasy / phoenix Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 5.0 344 KB

A lightweight BitTorrent Tracker written in PHP with an SQL backend.

License: MIT License

PHP 98.89% Shell 0.62% Ruby 0.49%
php cron bittorrent bittorrent-tracker lamp lamp-stack lemp lemp-stack

phoenix's Introduction

Phoenix v.3.1.5

Normal Code Climate

A lightweight BitTorrent Tracker written in PHP, with an SQL backend, for people that just want to host a tracker, not the torrent listing site.

Installation

What Do You Need?

Required

  • A PHP compatible web-server.
  • PHP >= 5.4.0 with Core, SimpleXML, date, filter, json, mysqli, pcre, & standard extensions. (Generated using PHP CompatInfo
  • A MySQLI supported database, such as MySQL >= 4.1

Recommended

Install Guide

  1. Copy _settings/phoenix.default.php to _settings/phoenix.custom.php
  2. Edit the variables in _settings/phoenix.custom.php
  3. Upload all the .php and .sh files to your server.
  4. Load admin.php in your browser and run the Setup option.

Configuration

Configuration should take place in _settings/phoenix.custom.php, NOT _settings/phoenix.default.php. Phoenix will attempt to use the default configuration if yours is missing.

Cron (Automating Maintenance)

  1. Configure _cron/hourly/backup-database.sh by changing the path in the second line, and the username, password, database, and file in the last three.
  2. Edit _settings/phoenix.custom.php and set $settings['clean_with_cron'] to true instead of false. You can also set $settings['clean_with_requests'] to 0 to save processing time.
  3. Edit your crontab with crontab -e, and add a crontab like the following. You can edit the times, and should make sure the paths are correct by running the commands after the asteriks.
15 * * * * php ~/phoenix/_cron/hourly/clean-and-optimize.php
30 * * * * ~/phoenix/_cron/hourly/backup-database.sh

phoenix's People

Contributors

enebe-nb avatar lewisgoddard avatar ncommander avatar trigunflame avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

phoenix's Issues

Add a magnet link generator.

Widely supported

  • xt (Exact Topic) – URN containing file hash
  • tr (Address Tracker) – Tracker URL for BitTorrent downloads
  • dn (Display Name) – Filename
  • xl (Exact Length) – Size in bytes
  • ws (Wed Seed) – URL for direct downloads

Less widely supported

  • kt (Keyword Topic) – Key words for search
  • xs (Exact Source) – URL or P2P for direct downloads
  • as (Acceptable Source) – Lower Priority WebSeed (supposedly for dead torrents)

References

See Magnet URI Scheme - Clients


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Add unit testing for onces. [$50]

Tests should set any and all global parameters that these scripts check, and confirm that output protects against invalid characters and attacks. They will likely need several tests each.

Onces

  • once.announce.peer.event.php
  • once.announce.torrent.php
  • once.db.connect.php
  • once.sanitise.admin.php
  • once.sanitise.announce.address.php
  • once.sanitise.announce.optional.php
  • once.sanitise.tracker.php
  • once.scrape.output.php
  • once.scrape.torrent.php
  • once.scrape.tracker.php
  • once.stats.tracker.php
  • once.stats.tracker.php

Impossible

  • once.test.initialise.php is literally part of the testing system.

There is a $50 open bounty on this issue. Add to the bounty at Bountysource.

Add unit testing for every function and integrate with Travis CI

Primary

  • New unit tests are added automatically.
  • Test against MySQL and MariaDB

Functions

  • function mysqli_array_build($connection, $sql)
  • function drop_table($connection, $settings, $table)
  • function mysqli_fetch_once($connection, $sql)
  • function peer_access($connection, $settings, $time, $peer)
  • function peer_completed($connection, $settings, $peer)
  • function peer_delete($connection, $settings, $peer)
  • function peer_new($connection, $settings, $time, $peer)
  • function maybe_binary_to_hex($binary)
  • function task($connection, $settings, $task, $value)
  • function tracker_allowed($connection, $settings)
  • function tracker_clean($connection, $settings, $time)

Impossible

As it stands, there are some functions whose composition is not lended to unit testing. These should probably be fixed later, and we can work around the super-globals for now.

  • optimize_table has no current failure states.
  • tracker_error contains an exit expression.

Create cron-jobs to optionally replace random running of tasks in `_cron`

  • Create cron-jobs to optionally replace random running of tasks in _cron.
  • Add setting with default to off.

Existing Tasks

  • clean as defined in _functions/phoenix/function.task.clean.php
  • optimize as defined in _functions/phoenix/function.task.optimize.php

Other Tasks

  • Now would be the time to consider other tasks that could be added.

Allow the admin script to create a configuration file.

Check if the directory is writable when there is no config file, then allow a user to input a MySQL username and password to install the tables and disable future installations on success.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Support Multiple Torrent Scraping

See https://wiki.vuze.com/w/Scrape#Tracker_Scrape_Convention

  • In once.sanitise.tracker.php, explode the _GET parameters.
  • Loop through parameters, storing every info_hash in an array.
  • Sanitise the parameters with maybe_binary_to_hex
  • Set the first one as $peer['info_hash'] for announce.
  • Set $peer['info_hashes'] as the full array for scrape.
  • Modify function.torrent.scrape.php to loop through the array for the WHERE caluse.
  • Modify the same file to loop through results for each of the three output formats.

Certain torrents return "-1" for seeders and leechers.

Always returns -1 for seeders and leechers

magnet:?xt=urn:btih:0a36a61cb46fc1444c95eb62185b777d65362ca9&dn=elementaryos-freya-i386.20150411.iso&tr=https%3A%2F%2Fashrise.com%3A443%2Fphoenix%2Fannounce&tr=http%3A%2F%2Flocal.localtest.me%2Fphoenix%2Fannounce.php

Binary: 6¦�´oÁDL•ëb�[w}e6,©

Works fine

magnet:?xt=urn:btih:fc85dc999730a42de3924444aadbcfa183b5f388&dn=elementaryos-freya-amd64.20150411.iso&tr=https%3A%2F%2Fashrise.com%3A443%2Fphoenix%2Fannounce&tr=http%3A%2F%2Flocal.localtest.me%2Fphoenix%2Fannounce.php

Binary: ü…Ü™—0¤-ã’DDªÛÏ¡ƒµóˆd

Be more helpful when listing peers

We can list peers more intelligently. Clients just starting a download don't need to know about a neighbour that has 0% as well, and completed downloads don't need to know each other either. Seeders being introduced to peers near completion speeds up conversion and improves ratios.

  • If a client has just started their download: list most recent peers with >50% completion.
  • If a client has not completed their download: list peers by most completed first, then most recent.
  • If a client has completed their download: list peers by most completed first, but exclude 100% completions, then most recent.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Sanatize super-globals variables before use.

We will likely want to sanitize all the variables appropriately before we do anything else.

  • List all variables
  • Sanitize in new file
  • De-duplicate sanitation
  • Replace references

Move to a puff-style structure.

  • settings.default.php to _settings/phoenix.default.php
  • function.* to _functions/phoenix/*
  • once.* to _onces/phoenix/*
  • hook.* to _hooks/phoenix/*
  • Make sure all references in code and documentation are updated.

Document how to set up cron jobs in README.md [$25 awarded]

Steps for configuring cron should go under a h3 header titled "Cron", immediately after the current Configuration section. Should be in a list-format to match the Installation section. Try to keep things as simple as possible, and maybe don't run both cron jobs at once, delay the backup for a couple of minutes. Always give root-relative file names in backticks, along with any code that needs changing. Make sure all code blocks are clearly labeled before they occur.

  • Configure _cron/hourly/backup-database.sh (path, username, password, database)
  • Configure for _cron/hourly/clean-and-optimize.php
  • Example crontab.
  • Disable cleaning in requests.

The $25 bounty on this issue has been claimed at Bountysource.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.