XBT

Started by domz, July 01, 2011, 12:23:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tundracanine

Quote from: inception on November 05, 2015, 03:56:02 PM
The best thing would be to use v4 instead .. :-)

Man i crackup about this.. its what everyone been saying since the whole talk about decade old of tb-dev from you..
But good attempt Zokii :) someone might like it if want to be hacked cause old ass code base lol.
If wanting support help please put bare min info like
Os:
U-232 Version:
Php Version:
Tracker type: like xbt or php
Saves on asking more questions just so people can help someone.

inception

Quote from: zokii1983 on November 05, 2015, 03:57:31 PM
Quote from: inception on November 05, 2015, 03:56:02 PM
The best thing would be to use v4 instead .. :-)

are you fucking kidding me

No :P I am not :P

zokii1983

Quote from: inception on November 05, 2015, 03:56:02 PM
The best thing would be to use v4 instead .. :-)

are you fucking kidding me

inception

The best thing would be to use v4 instead .. :-)

zokii1983

no support from me on this what so ever...

Like I said, I used it 5 years ago

zokii1983

you l know what ... HERE

FOR ALL OF YOU GUYS THAT DON'T LIKE TO READ AND THINK YOU CAN MAKE IT WORK ...  here's a fully working tbdev with xbt version (from 5 years ago)

do your thing


based to tbdev 09 ..
import sql
unrar xbt.rar
move it outside of wwwroot
install xbt
log on to ssh and type

cd /home/<yourusername>
once again .. any other folder will do, as long as it's out of www folder

type
apt-get install cmake g++ libboost-date-time-dev libboost-dev \
libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev \
libboost-serialization-dev libmysqlclient15-dev make subversion zlib1g-dev


download xbtt.zip and extract it to /home/<yourusername>
type
cd /home/<yourusername>/xbtt/build/xbtt
type
chmod +x configure
then
configure with following
./configure --bindir=/home/<yourusername>/xbtt/bin --libdir=/home/<yourusername>/xbtt/lib --libexecdir=/home/<yourusername>/xbtt/lib --enable-epoll
then
make
and finally
make all install

now type
cd ../../bin/

download.php
  $dict['value']['announce']['value'] = "http://192.168.0.150:2710/{$CURUSER['torrent_pass']}/announce";
change to your_site:port

[attachment deleted by admin]

inception

Is this really work.. I dont understand where to get peerlist.php from attachment :(

BamBam0077

Thanks for this share. :D not a bad idea!
"When Darkness Shadows Your Doubts, Deep Within Us Is Our Key, Not Success But Everything" ~ Anonymous

Zsolti88

Hello
How I would be able to calculate it it xbt the seedelt time out?
The xbt_ snatched a board stores it the was ready time out (tstamp)
Last activity ( last_action )
The time of hitchhiking ( stoppedat )

zokii1983

hmm we are replacing torrent tracker system!!! ...
literately the core of the torrent file sharing .. what tracks torrents and connects you to other people and at the same time keeps track of your stats

so yeah.. it's not easy

but luckily .. mindless has it integrated into v4 ... so no worries

denede

Quote from: zokii1983 on February 20, 2012, 11:29:46 PM
tbdev09 code is
takeupload.php

look for
$infohash = sha1($info["string"]);
replace with
$infohash = pack("H*", sha1($info["string"]));
then update db
ALTER TABLE `torrents` CHANGE `info_hash` `info_hash` BINARY( 20 ) NOT NULL;

download.php
look for
  if (!isset($CURUSER['passkey']) || strlen($CURUSER['passkey']) != 32)
  {

    $CURUSER['passkey'] = md5($CURUSER['username'].time().$CURUSER['passhash']);

    @mysql_query("UPDATE users SET passkey='{$CURUSER['passkey']}' WHERE id={$CURUSER['id']}");

  }

replace with
  if (!isset($CURUSER['torrent_pass']) || strlen($CURUSER['torrent_pass']) != 32)
  {

    $CURUSER['torrent_pass'] = md5($CURUSER['username'].time().$CURUSER['passhash']);

    @mysql_query("UPDATE users SET torrent_pass='{$CURUSER['torrent_pass']}' WHERE id={$CURUSER['id']}");

  }

look for
$dict['value']['announce']['value'] = "{$TBDEV['announce_urls'][0]}?passkey={$CURUSER['passkey']}";
replace with
$dict['value']['announce']['value'] = "http://192.168.0.100:2710/{$CURUSER['torrent_pass']}/announce";
replace 192.168.0.100 with your site name
and change in db, passkey to torrent_pass
ALTER TABLE `users` CHANGE `passkey` `torrent_pass` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''

details.php
look for
$HTMLOUT .= tr("{$lang['details_info_hash']}", $row["info_hash"]);
replace with
function hex_esc($matches) {
return sprintf("%02x", ord($matches[0]));
}
$HTMLOUT .= tr("{$lang['details_info_hash']}", preg_replace_callback('/./s', "hex_esc", hash_pad($row["info_hash"])));


run following in your database
ALTER TABLE `torrents` ADD `flags` INT( 11 ) NOT NULL;
ALTER TABLE `torrents` ADD `mtime` INT( 11 ) NOT NULL;
ALTER TABLE `torrents` ADD `ctime` INT( 11 ) NOT NULL;
ALTER TABLE `torrents` ADD `freetorrent` enum('0','1') NOT NULL DEFAULT '0';
ALTER TABLE `torrents` ADD `balance` INT( 11 ) NOT NULL;
ALTER TABLE `users` ADD `torrent_pass_version` INT( 11 ) NOT NULL;
ALTER TABLE `users` ADD `name` char(8) NOT NULL COMMENT 'useless column';
ALTER TABLE `users` ADD `pass` blob NOT NULL COMMENT 'useless column';
ALTER TABLE `users` ADD `can_leech` tinyint(4) NOT NULL DEFAULT '1';
ALTER TABLE `users` ADD  `wait_time` int(11) NOT NULL;
ALTER TABLE `users` ADD  `peers_limit` int(11) DEFAULT '1000';
ALTER TABLE `users` ADD  `torrents_limit` int(11) DEFAULT '1000';
ALTER TABLE `users` ADD  `torrent_pass_secret` bigint(20) NOT NULL COMMENT 'useless column';
INSERT INTO `xbt_client_whitelist` (`id`, `peer_id`, `vstring`) VALUES (1, '-', 'all');

if you are using olaf's xbt, you just need
ALTER TABLE `torrents` ADD `flags` INT( 11 ) NOT NULL
ALTER TABLE `torrents` ADD `mtime` INT( 11 ) NOT NULL
ALTER TABLE `torrents` ADD `ctime` INT( 11 ) NOT NULL
ALTER TABLE `users` ADD `torrent_pass_version` INT( 11 ) NOT NULL


then import xbt database
CREATE TABLE `xbt_announce_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ipa` int(10) unsigned NOT NULL,
  `port` int(11) NOT NULL,
  `event` int(11) NOT NULL,
  `info_hash` blob NOT NULL,
  `peer_id` blob NOT NULL,
  `downloaded` bigint(20) NOT NULL,
  `left0` bigint(20) NOT NULL,
  `uploaded` bigint(20) NOT NULL,
  `uid` int(11) NOT NULL,
  `mtime` int(11) NOT NULL,
  `useragent` varchar(51) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `xbt_cheat` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uid` int(11) NOT NULL,
  `ipa` int(10) unsigned NOT NULL,
  `upspeed` bigint(20) NOT NULL,
  `tstamp` int(11) NOT NULL,
  `uploaded` bigint(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `xbt_client_whitelist` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `peer_id` varchar(20) DEFAULT NULL,
  `vstring` varchar(200) DEFAULT '',
  PRIMARY KEY (`id`),
  UNIQUE KEY `peer_id` (`peer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `xbt_config` (
  `name` varchar(255) NOT NULL,
  `value` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `xbt_deny_from_hosts` (
  `begin` int(11) NOT NULL,
  `end` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `xbt_files` (
  `fid` int(11) NOT NULL AUTO_INCREMENT,
  `info_hash` blob NOT NULL,
  `leechers` int(11) NOT NULL,
  `seeders` int(11) NOT NULL,
  `completed` int(11) NOT NULL,
  `announced_http` int(11) NOT NULL,
  `announced_http_compact` int(11) NOT NULL,
  `announced_http_no_peer_id` int(11) NOT NULL,
  `announced_udp` int(11) NOT NULL,
  `scraped_http` int(11) NOT NULL,
  `scraped_udp` int(11) NOT NULL,
  `started` int(11) NOT NULL,
  `stopped` int(11) NOT NULL,
  `flags` int(11) NOT NULL,
  `mtime` int(11) NOT NULL,
  `ctime` int(11) NOT NULL,
  `balance` int(11) NOT NULL,
  `freetorrent` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`fid`),
  UNIQUE KEY `info_hash` (`info_hash`(20))
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `xbt_files_users` (
  `uid` int(11) NOT NULL,
  `active` tinyint(1) NOT NULL,
  `announced` int(11) NOT NULL,
  `completed` int(11) NOT NULL,
  `downloaded` bigint(20) NOT NULL,
  `remaining` bigint(20) NOT NULL,
  `uploaded` bigint(20) NOT NULL,
  `upspeed` bigint(20) NOT NULL,
  `downspeed` bigint(20) NOT NULL,
  `corrupt` bigint(20) NOT NULL DEFAULT '0',
  `timespent` bigint(20) NOT NULL,
  `useragent` varchar(51) NOT NULL,
  `connectable` tinyint(4) NOT NULL DEFAULT '1',
  `peer_id` binary(20) DEFAULT NULL,
  `fid` int(11) NOT NULL,
  `ipa` int(12) unsigned NOT NULL,
  `mtime` int(11) NOT NULL,
  `ip` varchar(15) NOT NULL DEFAULT '',
  UNIQUE KEY `uid_2` (`uid`,`fid`,`ipa`),
  KEY `uid` (`uid`),
  KEY `remaining_idx` (`remaining`),
  KEY `fid_idx` (`fid`),
  KEY `mtime_idx` (`mtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `xbt_scrape_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ipa` int(11) NOT NULL,
  `info_hash` blob,
  `uid` int(11) NOT NULL,
  `mtime` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `xbt_snatched` (
  `uid` int(11) NOT NULL DEFAULT '0',
  `tstamp` int(11) NOT NULL,
  `fid` int(11) NOT NULL,
  `IP` varchar(15) NOT NULL,
  KEY `fid` (`fid`),
  KEY `uid` (`uid`),
  KEY `tstamp` (`tstamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `xbt_users` (
  `uid` int(11) NOT NULL AUTO_INCREMENT,
  `name` char(8) NOT NULL,
  `pass` blob NOT NULL,
  `can_leech` tinyint(4) NOT NULL DEFAULT '1',
  `wait_time` int(11) NOT NULL,
  `peers_limit` int(11) NOT NULL,
  `torrents_limit` int(11) NOT NULL,
  `torrent_pass` char(32) NOT NULL,
  `torrent_pass_secret` bigint(20) NOT NULL,
  `downloaded` bigint(20) NOT NULL,
  `uploaded` bigint(20) NOT NULL,
  `fid_end` int(11) NOT NULL,
  PRIMARY KEY (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


for olaf's xbt via ssh type
mysql -u <user> -p <your_db> < xbt_tracker.sql

replace peerlist.php with attached file
for olaf's xbt version ... remember to replace "remaining" with "left" and comment useragent and connectable

cleanup.php
look for
do {
$res = mysql_query("SELECT id FROM torrents");
$ar = array();
while ($row = mysql_fetch_array($res,MYSQL_NUM)) {
$id = $row[0];
$ar[$id] = 1;
}

if (!count($ar))
break;

$dp = @opendir($TBDEV['torrent_dir']);
if (!$dp)
break;

$ar2 = array();
while (($file = readdir($dp)) !== false) {
if (!preg_match('/^(\d+)\.torrent$/', $file, $m))
continue;
$id = $m[1];
$ar2[$id] = 1;
if (isset($ar[$id]) && $ar[$id])
continue;
$ff = $TBDEV['torrent_dir'] . "/$file";
unlink($ff);
}
closedir($dp);

if (!count($ar2))
break;

$delids = array();
foreach (array_keys($ar) as $k) {
if (isset($ar2[$k]) && $ar2[$k])
continue;
$delids[] = $k;
unset($ar[$k]);
}
if (count($delids))
mysql_query("DELETE FROM torrents WHERE id IN (" . join(",", $delids) . ")");

$res = mysql_query("SELECT torrent FROM peers GROUP BY torrent");
$delids = array();
while ($row = mysql_fetch_array($res,MYSQL_NUM)) {
$id = $row[0];
if (isset($ar[$id]) && $ar[$id])
continue;
$delids[] = $id;
}
if (count($delids))
mysql_query("DELETE FROM peers WHERE torrent IN (" . join(",", $delids) . ")");

$res = mysql_query("SELECT torrent FROM files GROUP BY torrent");
$delids = array();
while ($row = mysql_fetch_array($res,MYSQL_NUM)) {
$id = $row[0];
if (isset($ar[$id]) && $ar[$id])
continue;
$delids[] = $id;
}
if (count($delids))
mysql_query("DELETE FROM files WHERE torrent IN (" . join(",", $delids) . ")");
} while (0);

$deadtime = deadtime();
@mysql_query("DELETE FROM peers WHERE last_action < $deadtime");

$deadtime -= $TBDEV['max_dead_torrent_time'];
@mysql_query("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < $deadtime");

$deadtime = time() - $TBDEV['signup_timeout'];
@mysql_query("DELETE FROM users WHERE status = 'pending' AND added < $deadtime AND last_login < $deadtime AND last_access < $deadtime");

$torrents = array();
$res = @mysql_query("SELECT torrent, seeder, COUNT(*) AS c FROM peers GROUP BY torrent, seeder");
while ($row = mysql_fetch_assoc($res)) {
if ($row["seeder"] == "yes")
$key = "seeders";
else
$key = "leechers";
$torrents[$row["torrent"]][$key] = $row["c"];
}

$res = @mysql_query("SELECT torrent, COUNT(*) AS c FROM comments GROUP BY torrent");
while ($row = mysql_fetch_assoc($res)) {
$torrents[$row["torrent"]]["comments"] = $row["c"];
}


$fields = explode(":", "comments:leechers:seeders");
$res = @mysql_query("SELECT id, seeders, leechers, comments FROM torrents");
while ($row = mysql_fetch_assoc($res)) {
$id = $row["id"];
if(isset($torrents[$id]))
$torr = $torrents[$id];
foreach ($fields as $field) {
if (!isset($torr[$field]))
$torr[$field] = 0;
}
$update = array();
foreach ($fields as $field) {
if ($torr[$field] != $row[$field])
$update[] = "$field = " . $torr[$field];
}
if (count($update))
@mysql_query("UPDATE torrents SET " . implode(",", $update) . " WHERE id = $id");
}


replace with


mysql_query("DELETE FROM xbt_files_users WHERE mtime < UNIX_TIMESTAMP() - 3600") or sqlerr(__FILE__, __LINE__);
mysql_query("DELETE FROM `xbt_files_users` WHERE `active` = '0'");

//torrents visable
mysql_query("UPDATE torrents SET visible='yes' WHERE seeders >'0'");
mysql_query("UPDATE torrents SET visible='no' WHERE seeders ='0'");


look for
@mysql_query("DELETE FROM torrents WHERE id={$arr['id']}");
replace with
@mysql_query("UPDATE torrents SET flags='1' id={$arr['id']}");

delete.php

look for
    mysql_query("DELETE FROM torrents WHERE id = $id");
    foreach(explode(".","peers.files.comments.ratings") as $x)


replace with
    mysql_query("UPDATE torrents SET flags = 1 WHERE id = $id");
    foreach(explode(".","files.comments.ratings") as $x)


bittorrent.php
look for
$res2 = @mysql_query("SELECT seeder, COUNT(*) AS pCount FROM peers WHERE userid=".$CURUSER['id']." GROUP BY seeder") or sqlerr(__LINE__,__FILE__);

$seedleech = array('yes' => '0', 'no' => '0');

while( $row = mysql_fetch_assoc($res2) ) {
if($row['seeder'] == 'yes')
$seedleech['yes'] = $row['pCount'];
else
$seedleech['no'] = $row['pCount'];

}

replace with
$res2 = mysql_query("SELECT COUNT(*) FROM `xbt_files_users` WHERE uid=".$CURUSER['id']." AND `remaining`=0 AND `active`=1");
$row = mysql_fetch_row($res2);
$activeseed = $row[0];

$res2 = mysql_query("SELECT COUNT(*) FROM `xbt_files_users` WHERE uid=".$CURUSER['id']." AND `remaining`>0 AND `active`=1");
$row = mysql_fetch_row($res2);
$activeleech = $row[0];

olaf's xbt, change remaining to left

look for
&nbsp;{$seedleech['yes']}
replace with
&nbsp;$activeseed
look for
&nbsp;{$seedleech['no']}
replace with
&nbsp;$activeleech

userdetails.php
look for
"<td><a href='details.php?id=$arr[torrent]&amp;hit=1'><b>" . htmlspecialchars($arr["torrentname"]) .
replace with
"<td><a href='details.php?id=$arr[id]&amp;hit=1'><b>" . htmlspecialchars($arr["torrentname"]) .

look for
    $res = mysql_query("SELECT p.torrent, p.uploaded, p.downloaded, p.seeder, t.added, t.name as torrentname, t.size, t.category, t.seeders, t.leechers, c.name as catname, c.image FROM peers p LEFT JOIN torrents t ON p.torrent = t.id LEFT JOIN categories c ON t.category = c.id WHERE p.userid=$id") or sqlerr();

    while ($arr = mysql_fetch_assoc($res))
    {
        if ($arr['seeder'] == 'yes')
            $seeding[] = $arr;
        else
            $leeching[] = $arr;
    }

replace with
$res = mysql_query("SELECT torrents.id, added,uploaded,downloaded,torrents.name as torrentname,categories.name as catname,size,image,category,seeders,leechers,remaining FROM xbt_files_users JOIN torrents ON xbt_files_users.fid = torrents.id JOIN categories ON torrents.category = categories.id WHERE uid=$id") or sqlerr();

    while ($arr = mysql_fetch_assoc($res))
    {
        if ($arr['remaining'] == '0')
            $seeding[] = $arr;
        else
            $leeching[] = $arr;
    }


index.php
look for
    $r = mysql_query("SELECT value_u FROM avps WHERE arg='seeders'") or sqlerr(__FILE__, __LINE__);
    $a = mysql_fetch_row($r);
    $seeders = 0 + $a[0];
    $r = mysql_query("SELECT value_u FROM avps WHERE arg='leechers'") or sqlerr(__FILE__, __LINE__);
    $a = mysql_fetch_row($r);
    $leechers = 0 + $a[0];
    if ($leechers == 0)
      $ratio = 0;
    else
      $ratio = round($seeders / $leechers * 100);
    $peers = number_format($seeders + $leechers);
    $seeders = number_format($seeders);
    $leechers = number_format($leechers);

replace with
$r = mysql_query("SELECT SUM(seeders) FROM torrents") or sqlerr(__FILE__, __LINE__);
$a = mysql_fetch_row($r);
$seeders = 0 + $a[0];
$r = mysql_query("SELECT SUM(leechers) FROM torrents") or sqlerr(__FILE__, __LINE__);
$a = mysql_fetch_row($r);
$leechers = 0 + $a[0];
if ($leechers == 0)
  $ratio = 0;
else
  $ratio = round($seeders / $leechers * 100);
$peers = number_format($seeders + $leechers);
$seeders = number_format($seeders);
$leechers = number_format($leechers);


a lot of things to modify ... daaaamn

Mindless

What's that supposed to mean like

Zsolti88

xbt seed time mod  ??

zokii1983

#17
you probably have configuration twice xbt_config in database, as well as in xbt_tracker.conf

post your structure of xbt_config and xbt_tracker.conf

this part
table_users = users
table_files = torrents
column_files_fid = id
column_files_completed = times_completed
column_files_leechers = leechers
column_files_seeders = seeders
column_users_uid = id
auto_register = 0
anonymous_scrape = 0
anonymous_announce = 0
anonymous_connect = 0
listen_check = 1
read_db_interval = 15
write_db_interval = 15
read_config_interval = 20
clean_up_interval = 15
announce_interval = 1800
pid_file = xbt_tracker.pid

Laur[1]

Ok, thanks zokii  :) i appreciate