|
#1
|
|||
|
|||
how to block torrent clients ?
I would like to know how can block azureus, bittorrent...
What to do to download the torrents with the utorrent? and php and server in the databases? ? I use Torrent Strike fullymodded 1.0 how can I do this? The Best Cumps |
#2
|
||||
|
||||
Re: how to block torrent clients ?
As i understand you want your users to be able to use only utorrent !?
About the php...database, i don`t understant what you want to say... You can post a clear question in Portugese TOGETHER with the english text because the moderator of this forum is Portugese and maybe he will understand better ! |
#3
|
|||
|
|||
Re: how to block torrent clients ?
rather, use only the utorrent to make the download of torrents
|
#4
|
||||
|
||||
Re: how to block torrent clients ?
open announce.php
Find Code:
function portblacklisted($port) Code:
$useragent = substr($peer_id, 1, 2); $agentversion = substr($peer_id, 3, 4); if(($useragent != "UT" || ($useragent == "UT" && $agentversion < 1700) ) err("Client is banned. Please Use The Latest Version Of Utorrent"); its pretty simple to add/remove allowed clients and client versions in the future :) |
#5
|
|||
|
|||
Re: how to block torrent clients ?
good
the error in utorrent say: Tracker to send data invalid do not know if the code is well aki is the code to see if this well Code:
<? ob_start("ob_gzhandler"); require_once("include/bittorrent.php"); require_once("include/benc.php"); function err($msg) { benc_resp(array("failure reason" => array(type => "string", value => $msg))); exit(); } function benc_resp($d) { benc_resp_raw(benc(array(type => "dictionary", value => $d))); } function portblacklisted($port) $useragent = substr($peer_id, 1, 2); $agentversion = substr($peer_id, 3, 4); if(($useragent != "UT" || ($useragent == "UT" && $agentversion < 1.7.7) ) err("Client is banned. Please Use The Latest Version Of Utorrent"); function benc_resp_raw($x) { header("Content-Type: text/plain"); header("Pragma: no-cache"); print($x); } $req = "info_hash:peer_id:!ip:port:uploaded:downloaded:left:!event:!passkey"; foreach (explode(":", $req) as $x) { if ($x[0] == "!") { $x = substr($x, 1); $opt = 1; } else $opt = 0; if (!isset($_GET[$x])) { if (!$opt) err("missing key"); continue; } $GLOBALS[$x] = unesc($_GET[$x]); } if (ENA_PASSKEY && ( strlen($passkey) != 32 && @mysql_num_rows(@mysql_query("SELECT id FROM users WHERE passkey=" . sqlesc($passkey))) != 1)) err("Invalid passkey! Re-download the .torrent from $BASEURL ($passkey)"); $passkey=sqlesc($passkey); foreach (array("info_hash","peer_id") as $x) { if (strlen($GLOBALS[$x]) != 20) err("invalid $x (" . strlen($GLOBALS[$x]) . " - " . urlencode($GLOBALS[$x]) . ")"); } //if (empty($ip) || !preg_match('/^(\d{1,3}\.){3}\d{1,3}$/s', $ip)) $ip = getip(); $port = 0 + $port; $downloaded = 0 + $downloaded; $uploaded = 0 + $uploaded; $left = 0 + $left; $rsize = 50; foreach(array("num want", "numwant", "num_want") as $k) { if (isset($_GET[$k])) { $rsize = 0 + $_GET[$k]; break; } } $agent = $_SERVER["HTTP_USER_AGENT"]; // Deny access made with a browser... //if (ereg("^Mozilla\\/", $agent) || ereg("^Opera\\/", $agent) || ereg("^Links ", $agent) || ereg("^Lynx\\/", $agent)) // err("torrent not registered with this tracker"); if (!$port || $port > 0xffff) err("invalid port"); if (!isset($event)) $event = ""; $seeder = ($left == 0) ? "yes" : "no"; $res = mysql_query("SELECT id, name, category, banned, free, seeders + leechers AS numpeers, UNIX_TIMESTAMP(added) AS ts FROM torrents WHERE " . hash_where("info_hash", $info_hash)); $torrent = mysql_fetch_assoc($res); if (!$torrent) err("torrent not registered with this tracker"); $torrentid = $torrent["id"]; $torrentname = $torrent["name"]; $torrentcategory = $torrent["category"]; $fields = "seeder, peer_id, ip, port, uploaded, downloaded, userid"; $numpeers = $torrent["numpeers"]; $limit = ""; if ($numpeers > $rsize) $limit = "ORDER BY RAND() LIMIT $rsize"; $res = mysql_query("SELECT $fields FROM peers WHERE torrent = $torrentid AND connectable = 'yes' $limit"); $resp = 'd' . benc_str('interval') . 'i' . $announce_interval . 'e' . benc_str('peers') . (($compact = intval($_GET['compact'])) == 1 ?'':'l'); unset($self); while ($row = mysql_fetch_assoc($res)) { $row["peer_id"] = hash_pad($row["peer_id"]); if ($row["peer_id"] === $peer_id) { $userid = $row["userid"]; $self = $row; continue; } if($compact) { $peer_ip = explode('.', $row["ip"]); $plist .= pack("C*", $peer_ip[0], $peer_ip[1], $peer_ip[2], $peer_ip[3]). pack("n*", (int)$row["port"]); } else { $resp .= "d" . benc_str("ip") . benc_str($row["ip"]) . benc_str("peer id") . benc_str($row["peer_id"]) . benc_str("port") . "i" . $row["port"] . "e" . "e"; } } $resp .= ($compact ? benc_str($plist):'e'). 'e'; $selfwhere = "torrent = $torrentid AND ". (ENA_PASSKEY ?"passkey=$passkey AND ":'') . hash_where("peer_id", $peer_id); if (!isset($self)) { $res = mysql_query("SELECT $fields FROM peers WHERE $selfwhere"); $row = mysql_fetch_assoc($res); if ($row) { $userid = $row["userid"]; $self = $row; } } //// Up/down stats //////////////////////////////////////////////////////////// if (!isset($self)) { if(ENA_PASSKEY && ENA_PASSKEYLIMITCONNECTIONS) { $valid = @mysql_num_rows(@mysql_query("SELECT id FROM peers WHERE torrent=$torrentid AND passkey=$passkey")); if ($valid >= 1 && $seeder == 'no') err("Connection limit exceeded! You may only leech from one location at a time."); if (($valid >= 3 && $seeder == 'yes') || ($valid===FALSE)) err("Connection limit exceeded!"); } $rz = mysql_query("SELECT id, uploaded, downloaded, class, parked FROM users WHERE ip='$ip' AND enabled = 'yes' ". (ENA_PASSKEY ? "AND passkey=$passkey ":''). "ORDER BY last_access DESC LIMIT 1") or err("Tracker error 2"); if ($MEMBERSONLY && mysql_num_rows($rz) == 0) err("Unrecognized host ($ip). Please go to $BASEURL to sign-up or login."); $az = mysql_fetch_assoc($rz); $userid = $az["id"]; // if ($left > 0 && $az["class"] < UC_VIP) if ($az["class"] < UC_VIP) { $gigs = $az["uploaded"] / (1024*1024*1024); $elapsed = floor((gmtime() - $torrent["ts"]) / 3600); $ratio = (($az["downloaded"] > 0) ? ($az["uploaded"] / $az["downloaded"]) : 1); if ($ratio < 0.5 || $gigs < 5) $wait = 0; elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 0; elseif ($ratio < 0.8 || $gigs < 8) $wait = 0; elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 0; else $wait = 0; if (($elapsed < $wait)&&($seeder == 'no')) err("Not authorized (" . ($wait - $elapsed) . "h) - READ THE FAQ!"); } } else { $start = $self["ts"]; //last_action $end = time(); //now time if ($end - $start < 30) //~30 sec for local connection, ~60 sec for internet connection err("Sorry, minimum announce interval = 30 sec."); $upthis = max(0, $uploaded - $self["uploaded"]); $downthis = max(0, $downloaded - $self["downloaded"]); if ($upthis > 0 || $downthis > 0) mysql_query("UPDATE users SET uploaded = uploaded + $upthis". ($torrent['free']=='no'?", downloaded = downloaded + $downthis ":' '). "WHERE id=$userid") or err("Tracker error 3"); } /////////////////////////////////////////////////////////////////////////////// $dt = gmtime() - 180; $dt = sqlesc(get_date_time($dt)); function portblacklisted($port) { // direct connect if ($port >= 411 && $port <= 413) return true; // bittorrent if ($port >= 6881 && $port <= 6889) return true; // kazaa if ($port == 1214) return true; // gnutella if ($port >= 6346 && $port <= 6347) return true; // emule if ($port == 4662) return true; // winmx if ($port == 6699) return true; return false; } $updateset = array(); if ($event == "stopped") { if (isset($self)) { mysql_query("UPDATE snatched SET seeder = 'no', connectable='no' WHERE torrent = $torrentid AND userid = $userid"); mysql_query("DELETE FROM peers WHERE $selfwhere"); if (mysql_affected_rows()) { if ($self["seeder"] == "yes") $updateset[] = "seeders = seeders - 1"; else $updateset[] = "leechers = leechers - 1"; } } } else { if ($event == "completed") { mysql_query("UPDATE snatched SET finished = 'yes', completedat = $dt WHERE torrent = $torrentid AND userid = $userid"); $updateset[] = "times_completed = times_completed + 1"; } if (isset($self)) { $res=mysql_query("SELECT uploaded, downloaded FROM snatched WHERE torrent = $torrentid AND userid = $userid"); $row = mysql_fetch_array($res); $sockres = @fsockopen($ip, $port, $errno, $errstr, 5); if (!$sockres) $connectable = "no"; else { $connectable = "yes"; @fclose($sockres); } $downloaded2=$downloaded - $self["downloaded"]; $uploaded2=$uploaded - $self["uploaded"]; mysql_query("UPDATE snatched SET uploaded = uploaded+$uploaded2, downloaded = downloaded+$downloaded2, port = $port, connectable = '$connectable', agent= " . sqlesc($agent) . ", to_go = $left, last_action = $dt, seeder = '$seeder' WHERE torrent = $torrentid AND userid = $userid"); $starttime = $self['ts']; mysql_query("UPDATE peers SET uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), seeder = '$seeder'" . ($seeder == "yes" && $self["seeder"] != $seeder ? ", finishedat = " . time() : "") . " WHERE $selfwhere"); if (mysql_affected_rows() && $self["seeder"] != $seeder) { if ($seeder == "yes") { $updateset[] = "seeders = seeders + 1"; $updateset[] = "leechers = leechers - 1"; } else { $updateset[] = "seeders = seeders - 1"; $updateset[] = "leechers = leechers + 1"; } } } else { if ($az["parked"] == "yes") err("Error, your account is parked! Please read the FAQ!"); if (portblacklisted($port)) err("Port $port is blacklisted."); else { $sockres = @fsockopen($ip, $port, $errno, $errstr, 5); if (!$sockres) $connectable = "no"; else { $connectable = "yes"; @fclose($sockres); } } $res = mysql_query("SELECT torrent, userid FROM snatched WHERE torrent = $torrentid AND userid = $userid"); $check = mysql_fetch_assoc($res); if (!$check) mysql_query("INSERT INTO snatched (torrent, torrentid, userid, port, startdat, last_action, agent, torrent_name, torrent_category) VALUES ($torrentid, $torrentid, $userid, $port, $dt, $dt, " . sqlesc($agent) . ", " . sqlesc($torrentname) . ", $torrentcategory)"); $ret = mysql_query("INSERT INTO peers (connectable, torrent, peer_id, ip, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, agent, uploadoffset, downloadoffset, passkey) VALUES ('$connectable', $torrentid, " . sqlesc($peer_id) . ", " . sqlesc($ip) . ", $port, $uploaded, $downloaded, $left, NOW(), NOW(), '$seeder', $userid, " . sqlesc($agent) . ", $uploaded, $downloaded, $passkey)"); if ($ret) { if ($seeder == "yes") $updateset[] = "seeders = seeders + 1"; else $updateset[] = "leechers = leechers + 1"; } } } if ($seeder == "yes") { if ($torrent["banned"] != "yes") $updateset[] = "visible = 'yes'"; $updateset[] = "last_action = NOW()"; } if (count($updateset)) mysql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid"); benc_resp_raw($resp); ?> this may well be not edit? The Best Cumps |
#6
|
||||
|
||||
Re: how to block torrent clients ?
try this
Code:
<? ob_start("ob_gzhandler"); require_once("include/bittorrent.php"); require_once("include/benc.php"); function err($msg) { benc_resp(array("failure reason" => array(type => "string", value => $msg))); exit(); } function benc_resp($d) { benc_resp_raw(benc(array(type => "dictionary", value => $d))); } function benc_resp_raw($x) { header("Content-Type: text/plain"); header("Pragma: no-cache"); print($x); } $req = "info_hash:peer_id:!ip:port:uploaded:downloaded:left:!event:!passkey"; foreach (explode(":", $req) as $x) { if ($x[0] == "!") { $x = substr($x, 1); $opt = 1; } else $opt = 0; if (!isset($_GET[$x])) { if (!$opt) err("missing key"); continue; } $GLOBALS[$x] = unesc($_GET[$x]); } if (ENA_PASSKEY && ( strlen($passkey) != 32 && @mysql_num_rows(@mysql_query("SELECT id FROM users WHERE passkey=" . sqlesc($passkey))) != 1)) err("Invalid passkey! Re-download the .torrent from $BASEURL ($passkey)"); $passkey=sqlesc($passkey); foreach (array("info_hash","peer_id") as $x) { if (strlen($GLOBALS[$x]) != 20) err("invalid $x (" . strlen($GLOBALS[$x]) . " - " . urlencode($GLOBALS[$x]) . ")"); } //if (empty($ip) || !preg_match('/^(\d{1,3}\.){3}\d{1,3}$/s', $ip)) $ip = getip(); $port = 0 + $port; $downloaded = 0 + $downloaded; $uploaded = 0 + $uploaded; $left = 0 + $left; $rsize = 50; foreach(array("num want", "numwant", "num_want") as $k) { if (isset($_GET[$k])) { $rsize = 0 + $_GET[$k]; break; } } $agent = $_SERVER["HTTP_USER_AGENT"]; // Deny access made with a browser... //if (ereg("^Mozilla\\/", $agent) || ereg("^Opera\\/", $agent) || ereg("^Links ", $agent) || ereg("^Lynx\\/", $agent)) // err("torrent not registered with this tracker"); if (!$port || $port > 0xffff) err("invalid port"); if (!isset($event)) $event = ""; $seeder = ($left == 0) ? "yes" : "no"; $res = mysql_query("SELECT id, name, category, banned, free, seeders + leechers AS numpeers, UNIX_TIMESTAMP(added) AS ts FROM torrents WHERE " . hash_where("info_hash", $info_hash)); $torrent = mysql_fetch_assoc($res); if (!$torrent) err("torrent not registered with this tracker"); $torrentid = $torrent["id"]; $torrentname = $torrent["name"]; $torrentcategory = $torrent["category"]; $fields = "seeder, peer_id, ip, port, uploaded, downloaded, userid"; $numpeers = $torrent["numpeers"]; $limit = ""; if ($numpeers > $rsize) $limit = "ORDER BY RAND() LIMIT $rsize"; $res = mysql_query("SELECT $fields FROM peers WHERE torrent = $torrentid AND connectable = 'yes' $limit"); $resp = 'd' . benc_str('interval') . 'i' . $announce_interval . 'e' . benc_str('peers') . (($compact = intval($_GET['compact'])) == 1 ?'':'l'); unset($self); while ($row = mysql_fetch_assoc($res)) { $row["peer_id"] = hash_pad($row["peer_id"]); if ($row["peer_id"] === $peer_id) { $userid = $row["userid"]; $self = $row; continue; } if($compact) { $peer_ip = explode('.', $row["ip"]); $plist .= pack("C*", $peer_ip[0], $peer_ip[1], $peer_ip[2], $peer_ip[3]). pack("n*", (int)$row["port"]); } else { $resp .= "d" . benc_str("ip") . benc_str($row["ip"]) . benc_str("peer id") . benc_str($row["peer_id"]) . benc_str("port") . "i" . $row["port"] . "e" . "e"; } } $resp .= ($compact ? benc_str($plist):'e'). 'e'; $selfwhere = "torrent = $torrentid AND ". (ENA_PASSKEY ?"passkey=$passkey AND ":'') . hash_where("peer_id", $peer_id); if (!isset($self)) { $res = mysql_query("SELECT $fields FROM peers WHERE $selfwhere"); $row = mysql_fetch_assoc($res); if ($row) { $userid = $row["userid"]; $self = $row; } } //// Up/down stats //////////////////////////////////////////////////////////// if (!isset($self)) { if(ENA_PASSKEY && ENA_PASSKEYLIMITCONNECTIONS) { $valid = @mysql_num_rows(@mysql_query("SELECT id FROM peers WHERE torrent=$torrentid AND passkey=$passkey")); if ($valid >= 1 && $seeder == 'no') err("Connection limit exceeded! You may only leech from one location at a time."); if (($valid >= 3 && $seeder == 'yes') || ($valid===FALSE)) err("Connection limit exceeded!"); } $rz = mysql_query("SELECT id, uploaded, downloaded, class, parked FROM users WHERE ip='$ip' AND enabled = 'yes' ". (ENA_PASSKEY ? "AND passkey=$passkey ":''). "ORDER BY last_access DESC LIMIT 1") or err("Tracker error 2"); if ($MEMBERSONLY && mysql_num_rows($rz) == 0) err("Unrecognized host ($ip). Please go to $BASEURL to sign-up or login."); $az = mysql_fetch_assoc($rz); $userid = $az["id"]; // if ($left > 0 && $az["class"] < UC_VIP) if ($az["class"] < UC_VIP) { $gigs = $az["uploaded"] / (1024*1024*1024); $elapsed = floor((gmtime() - $torrent["ts"]) / 3600); $ratio = (($az["downloaded"] > 0) ? ($az["uploaded"] / $az["downloaded"]) : 1); if ($ratio < 0.5 || $gigs < 5) $wait = 0; elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 0; elseif ($ratio < 0.8 || $gigs < 8) $wait = 0; elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 0; else $wait = 0; if (($elapsed < $wait)&&($seeder == 'no')) err("Not authorized (" . ($wait - $elapsed) . "h) - READ THE FAQ!"); } } else { $start = $self["ts"]; //last_action $end = time(); //now time if ($end - $start < 30) //~30 sec for local connection, ~60 sec for internet connection err("Sorry, minimum announce interval = 30 sec."); $upthis = max(0, $uploaded - $self["uploaded"]); $downthis = max(0, $downloaded - $self["downloaded"]); if ($upthis > 0 || $downthis > 0) mysql_query("UPDATE users SET uploaded = uploaded + $upthis". ($torrent['free']=='no'?", downloaded = downloaded + $downthis ":' '). "WHERE id=$userid") or err("Tracker error 3"); } $useragent = substr($peer_id, 1, 2); $agentversion = substr($peer_id, 3, 4); if(($useragent != "UT" || ($useragent == "UT" && $agentversion < 1700)) err("Client is banned. Please Use The Latest Version Of Utorrent"); /////////////////////////////////////////////////////////////////////////////// $dt = gmtime() - 180; $dt = sqlesc(get_date_time($dt)); function portblacklisted($port) { // direct connect if ($port >= 411 && $port <= 413) return true; // bittorrent if ($port >= 6881 && $port <= 6889) return true; // kazaa if ($port == 1214) return true; // gnutella if ($port >= 6346 && $port <= 6347) return true; // emule if ($port == 4662) return true; // winmx if ($port == 6699) return true; return false; } $updateset = array(); if ($event == "stopped") { if (isset($self)) { mysql_query("UPDATE snatched SET seeder = 'no', connectable='no' WHERE torrent = $torrentid AND userid = $userid"); mysql_query("DELETE FROM peers WHERE $selfwhere"); if (mysql_affected_rows()) { if ($self["seeder"] == "yes") $updateset[] = "seeders = seeders - 1"; else $updateset[] = "leechers = leechers - 1"; } } } else { if ($event == "completed") { mysql_query("UPDATE snatched SET finished = 'yes', completedat = $dt WHERE torrent = $torrentid AND userid = $userid"); $updateset[] = "times_completed = times_completed + 1"; } if (isset($self)) { $res=mysql_query("SELECT uploaded, downloaded FROM snatched WHERE torrent = $torrentid AND userid = $userid"); $row = mysql_fetch_array($res); $sockres = @fsockopen($ip, $port, $errno, $errstr, 5); if (!$sockres) $connectable = "no"; else { $connectable = "yes"; @fclose($sockres); } $downloaded2=$downloaded - $self["downloaded"]; $uploaded2=$uploaded - $self["uploaded"]; mysql_query("UPDATE snatched SET uploaded = uploaded+$uploaded2, downloaded = downloaded+$downloaded2, port = $port, connectable = '$connectable', agent= " . sqlesc($agent) . ", to_go = $left, last_action = $dt, seeder = '$seeder' WHERE torrent = $torrentid AND userid = $userid"); $starttime = $self['ts']; mysql_query("UPDATE peers SET uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), seeder = '$seeder'" . ($seeder == "yes" && $self["seeder"] != $seeder ? ", finishedat = " . time() : "") . " WHERE $selfwhere"); if (mysql_affected_rows() && $self["seeder"] != $seeder) { if ($seeder == "yes") { $updateset[] = "seeders = seeders + 1"; $updateset[] = "leechers = leechers - 1"; } else { $updateset[] = "seeders = seeders - 1"; $updateset[] = "leechers = leechers + 1"; } } } else { if ($az["parked"] == "yes") err("Error, your account is parked! Please read the FAQ!"); if (portblacklisted($port)) err("Port $port is blacklisted."); else { $sockres = @fsockopen($ip, $port, $errno, $errstr, 5); if (!$sockres) $connectable = "no"; else { $connectable = "yes"; @fclose($sockres); } } $res = mysql_query("SELECT torrent, userid FROM snatched WHERE torrent = $torrentid AND userid = $userid"); $check = mysql_fetch_assoc($res); if (!$check) mysql_query("INSERT INTO snatched (torrent, torrentid, userid, port, startdat, last_action, agent, torrent_name, torrent_category) VALUES ($torrentid, $torrentid, $userid, $port, $dt, $dt, " . sqlesc($agent) . ", " . sqlesc($torrentname) . ", $torrentcategory)"); $ret = mysql_query("INSERT INTO peers (connectable, torrent, peer_id, ip, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, agent, uploadoffset, downloadoffset, passkey) VALUES ('$connectable', $torrentid, " . sqlesc($peer_id) . ", " . sqlesc($ip) . ", $port, $uploaded, $downloaded, $left, NOW(), NOW(), '$seeder', $userid, " . sqlesc($agent) . ", $uploaded, $downloaded, $passkey)"); if ($ret) { if ($seeder == "yes") $updateset[] = "seeders = seeders + 1"; else $updateset[] = "leechers = leechers + 1"; } } } if ($seeder == "yes") { if ($torrent["banned"] != "yes") $updateset[] = "visible = 'yes'"; $updateset[] = "last_action = NOW()"; } if (count($updateset)) mysql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid"); benc_resp_raw($resp); ?> Code:
v1.7 = 1700 Code:
v1.7.7 = 1770 |
#7
|
|||
|
|||
Re: how to block torrent clients ?
good
of the error Tracker to send data invalid <NULL> |
#8
|
||||
|
||||
Re: how to block torrent clients ?
Quote:
|
Tags |
block , clients , torrent |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Friends block | Fynnon | Mods & Themes | 2 | 23rd June 2010 12:36 |
[TT 2.0.5] Block Donate | matrix78 | Mods & Themes | 0 | 5th March 2010 13:52 |
Block needed | wMan | BT.Manager (phpMyBitTorrent) | 1 | 5th June 2009 11:10 |
Block partner | Tory | Template Shares | 1 | 19th September 2008 15:14 |
clients | wMan | Community Cafe | 0 | 29th May 2008 13:18 |