XBT

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

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

zokii1983

I have all files somewhere on external hdd ... give me few days I will upload em ... before I got gazelle version working ... I was using olafs xbt
hopefully I still have those files as well
it most likely somewhere in xbt_tracker.conf

Laur[1]

Yes, i'm using the windows version by olaf

zokii1983

did u install xbt?

Laur[1]

I have installed this for TBDev 09 but i get an error in utorrent:

Failure: unregistered torrent

Any idea what might be the problem and how to fix it? Thanks

zokii1983

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);


zokii1983

it should ...
sorry Mindless .. kinda left torrent world a side
I've found a job ~45 minutes away from my place
but with traffic, driving is more like hour and 45 minutes ... if I'm lucky


I have it done around 75% .. and files are somewhere on my computer
last thing left to do was to comment out code from cleanup.php .. (as far as I remember)
I got stuck on that part..... then just left it there ... I think I sent you a msg regarding editing cleanup.php, but you never replied ... so I switched to tbdev09 code ...

Mindless

zokii im thinking about adding XBT to V3 so can use php or XBT - will this still work ?

zokii1983

Quote from: MrRep on July 13, 2011, 03:22:24 PM
getting even better, might just have to test this myself :)

so im guessing that using the what xbt, freeleech etc works? or is that a work in progress?

yes, just set flags = 2 and freetorrent = 1

MrRep

getting even better, might just have to test this myself :)

so im guessing that using the what xbt, freeleech etc works? or is that a work in progress?

zokii1983

#6
ok... previous xbt version is shit
so we are gonna use gazelle one

so 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/

and edit xbt_tracker.conf with following
mysql_host = localhost
mysql_user = user
mysql_password = pass
mysql_database = db

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

cheater = 0
freetorrent = 1
snatched = 1
uploadonly = 0
log_access = 0
log_announce = 0
log_scrape = 0

save changes and exit


now xbt database
import following
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;


whitelist all clients (subject to change for later on)
INSERT INTO `xbt_client_whitelist` (`id`, `peer_id`, `vstring`) VALUES (1, '-', 'all');

for now, to get xbt working with u-232 add following to users and torrents table (this will be changed too later on)
ALTER TABLE `torrents` ADD `FreeTorrent` enum('0','1') NOT NULL DEFAULT '0';
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';


now go back to terminal and start xbt

we have most of the needed info... peerslist.php, userdetails.php and rest of the files can be edited

[attachment deleted by admin]

putyn

looks cool dude :) nice job :P

zokii1983

#4
log on to ssh
and on terminal type


cd /home/<yourusername>
change to your user name ... or any other folder will do fine as well
then (this is for ubutnu)

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


now install xbt
svn checkout http://xbt.googlecode.com/svn/trunk/ xbt-read-only
if you want to use one from sourceforge, that is fine too
once completed type

cd xbt-read-only/xbt/Tracker
then
./make.sh
once compile is done .. type
mv xbt_tracker.conf.default xbt_tracker.conf
then edit xbt_tracker.conf
nano xbt_tracker.conf
and
replace it with following

mysql_host = localhost
mysql_user = your_sql_user
mysql_password = your_sql_pass
mysql_database = your_sql_db
table_files = torrents
scrape_interval = 0
redirect_url =
read_db_interval = 15
write_db_interval = 15
read_config_interval = 20
pid_file =
log_scrape = 0
log_announce = 0
log_access = 0
listen_port = 2710
listen_ipa = *
listen_check = 1
gzip_scrape = 1
gzip_debug = 1
gzip_announce = 1
debug = 0
daemon = 1
clean_up_interval = 15
auto_register = 0
anonymous_scrape = 0
anonymous_announce = 0
anonymous_connect = 0
announce_interval = 1800
column_users_uid = id
column_users_pass = passhash
column_files_seeders = seeders
column_files_users_fid = id
column_files_leechers = leechers
query_log = query_log.txt
table_users = users
column_files_fid = id
column_files_completed = times_completed


then via phpmyadmin type following
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


and back to terminal
import xbt sql
mysql -u <user> -p <your_db> < xbt_tracker.sql

and start the xbt
./xbt_tracker

upload a torrent and test if it works


because this xbt version doesn't provide nuff information
gazelle xbt version is gonna be used

zokii1983

let me get started with this
hopefully further development will follow

takeupload.php
locate
$infohash = sha1($info["string"]);
replace with
$infohash = pack("H*", sha1($info["string"]));

sql run
ALTER TABLE `torrents` CHANGE `info_hash` `info_hash` BINARY( 20 ) NOT NULL;
and
ALTER TABLE `users` CHANGE `passkey` `torrent_pass` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''
download.php
locate
$pkey = isset($_GET['passkey']) && strlen($_GET['passkey']) == 32 ? $_GET['passkey'] : '';
replace with
$pkey = isset($_GET['torrent_pass']) && strlen($_GET['torrent_pass']) == 32 ? $_GET['torrent_pass'] : '';

locate
$q0 = mysql_query("SELECT * FROM users where passkey = ".sqlesc($pkey)) or sqlerr(__FILE__, __LINE__);
replace with
$q0 = mysql_query("SELECT * FROM users where torrent_pass = ".sqlesc($pkey)) or sqlerr(__FILE__, __LINE__);

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

locate
$CURUSER['passkey'] = md5($CURUSER['username'].time().$CURUSER['passhash']);
replace with
$CURUSER['torrent_pass'] = md5($CURUSER['username'].time().$CURUSER['passhash']);

locate
@mysql_query("UPDATE users SET passkey='{$CURUSER['passkey']}' WHERE id={$CURUSER['id']}");
replace with
@mysql_query("UPDATE users SET torrent_pass='{$CURUSER['torrent_pass']}' WHERE id={$CURUSER['id']}");
locate
$dict['value']['announce']['value'] = "{$INSTALLER09['announce_urls'][$ssluse]}?passkey={$CURUSER['passkey']}";
replace with
$dict['value']['announce']['value'] = "http://192.168.0.100:2710/{$CURUSER['torrent_pass']}/announce";
change 192.168.0.100 with your site name

details.php
locate
$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"])));


installing xbt and getting it to work with u-232 will follow..

Mindless

Can be done yeah but atm its not - Would be a case of altering the sql and code exact same way it was done with the 06 Tbdev i would imagine only updated with 09 source code, i'll ask a few i know that use it for there opinions or they may see the post.

domz