Bravo List
Register
Go Back   > Bravo List > Source Code > Trackers > TBDev
Reply
  #1  
Old 18-07-17, 17:50
EdeNeT's Avatar
EdeNeT EdeNeT is offline
Member
 
Join Date: Oct 2015
Posts: 5
Default I will pay 25$ for help.
I will pay 25$ to the man who fix my problam,
i have "torrent is not vaild bencoding".

tbdev 2009

this is benc.php :
PHP Code:
<?php 
/* 
+------------------------------------------------ 
|   TBDev.net BitTorrent Tracker PHP 
|   ============================================= 
|   by CoLdFuSiOn 
|   (c) 2003 - 2009 TBDev.Net 
|   http://www.tbdev.net 
|   ============================================= 
|   svn: http://sourceforge.net/projects/tbdevnet/ 
|   Licence Info: GPL 
+------------------------------------------------ 
|   $Date$ 
|   $Revision$ 
|   $Author$ 
|   $URL$ 
+------------------------------------------------ 
*/ 

function benc($obj) { 
    if (!
is_array($obj) || !isset($obj["type"]) || !isset($obj["value"])) 
        return; 
    
$c $obj["value"]; 
    switch (
$obj["type"]) { 
        case 
"string"
            return 
benc_str($c); 
        case 
"integer"
            return 
benc_int($c); 
        case 
"list"
            return 
benc_list($c); 
        case 
"dictionary"
            return 
benc_dict($c); 
        default: 
            return; 
    } 


function 
benc_str($s) { 
    return 
strlen($s) . ":$s"


function 
benc_int($i) { 
    return 
"i" $i "e"


function 
benc_list($a) { 
    
$s "l"
    foreach (
$a as $e) { 
        
$s .= benc($e); 
    } 
    
$s .= "e"
    return 
$s


function 
benc_dict($d) { 
    
$s "d"
    
$keys array_keys($d); 
    
sort($keys); 
    foreach (
$keys as $k) { 
        
$v $d[$k]; 
        
$s .= benc_str($k); 
        
$s .= benc($v); 
    } 
    
$s .= "e"
    return 
$s


function 
bdec_file($f$ms) { 
    
$fp fopen($f"rb"); 
    if (!
$fp
        return; 
    
$e fread($fp$ms); 
    
fclose($fp); 
    return 
bdec($e); 


function 
bdec($s) { 
    if (
preg_match('/^(\d+):/'$s$m)) { 
        
$l $m[1]; 
        
$pl strlen($l) + 1
        
$v substr($s$pl$l); 
        
$ss substr($s0$pl $l); 
        if (
strlen($v) != $l
            return; 
        return array(
"type" => "string""value" => $v"strlen" => strlen($ss), "string" => $ss); 
    } 
    if (
preg_match('/^i(-{0,1}\d+)e/'$s$m)) {   
        
$v $m[1]; 
        
$ss "i" $v "e"
        if (
$v === "-0"
            return; 
        if (
$v[0] == "0" && strlen($v) != 1
            return; 
        return array(
"type" => "integer""value" => $v"strlen" => strlen($ss), "string" => $ss); 
    } 
    switch (
$s[0]) { 
        case 
"l"
            return 
bdec_list($s); 
        case 
"d"
            return 
bdec_dict($s); 
        default: 
            return; 
    } 


function 
bdec_list($s) { 
    if (
$s[0] != "l"
        return; 
    
$sl strlen($s); 
    
$i 1
    
$v = array(); 
    
$ss "l"
    for (;;) { 
        if (
$i >= $sl
            return; 
        if (
$s[$i] == "e"
            break; 
        
$ret bdec(substr($s$i)); 
        if (!isset(
$ret) || !is_array($ret)) 
            return; 
        
$v[] = $ret
        
$i += $ret["strlen"]; 
        
$ss .= $ret["string"]; 
    } 
    
$ss .= "e"
    return array(
"type" => "list""value" => $v"strlen" => strlen($ss), "string" => $ss); 


function 
bdec_dict($s) { 
    if (
$s[0] != "d"
        return; 
    
$sl strlen($s); 
    
$i 1
    
$v = array(); 
    
$ss "d"
    for (;;) { 
        if (
$i >= $sl
            return; 
        if (
$s[$i] == "e"
            break; 
        
$ret bdec(substr($s$i)); 
        if (!isset(
$ret) || !is_array($ret) || $ret["type"] != "string"
            return; 
        
$k $ret["value"]; 
        
$i += $ret["strlen"]; 
        
$ss .= $ret["string"]; 
        if (
$i >= $sl
            return; 
        
$ret bdec(substr($s$i)); 
        if (!isset(
$ret) || !is_array($ret)) 
            return; 
        
$v[$k] = $ret
        
$i += $ret["strlen"]; 
        
$ss .= $ret["string"]; 
    } 
    
$ss .= "e"
    return array(
"type" => "dictionary""value" => $v"strlen" => strlen($ss), "string" => $ss); 


?>
it is appear when im uploading a torrent with utorrent 3.X+
Reply With Quote
  #2  
Old 18-07-17, 20:13
LeeHowarth's Avatar
LeeHowarth LeeHowarth is offline
TT
 
Join Date: Nov 2008
Posts: 95
Default
Do not trust this guy he his a scammer, he will get you to work and will have no intention in paying.

Code:
<?php

try
{
    $iterator = new RecursiveDirectoryIterator( '.' );
    $iterator = new RecursiveIteratorIterator( $iterator );
    $updates  = 0;
    foreach ( $iterator as $item )
    {
        $filepath  = $item->getPathName();
        $extension = pathinfo( $filepath, PATHINFO_EXTENSION );
        if ( 0 === strcmp( $extension, 'php' ) )
        {
             $contents = file_get_contents( $filepath );
             if ( $contents === false )
             {
                  continue;
             }
    
             if ( 0 === strpos( $contents, "\xEF\xBB\xBF" ) )
             {
                  $contents = str_replace( "\xEF\xBB\xBF", null, $contents );
                  $found = 1;
             }
             else
             {
                  $found = 0;
             }

             if ( $found === 1 )
             {
                  file_put_contents( $filepath, $contents );
                  $updates++;
             }
        }
    }

    print( "Updated $updates files.\n" );
}
catch ( Exception $e )
{
    printf( "An error occurred: %s\n", $e->getMessage() );
}
will fix the problem if others encounter this issue, it's due to using an editor such as notepad which embeds the UTF-8 byte order mark.
Reply With Quote
  #3  
Old 18-07-17, 20:41
DND's Avatar
DND DND is offline
Support
 
Join Date: Dec 2008
Posts: 1,000
Default
the problem is at the preg_match variable
__________________
Need HELP!? I can install:

  1. Server/VPS (Debian,CentOS,Ubuntu,Fedora, FreeBSD) Optimization and ... + Modules
  2. Webserver Windows/Linux (Apache/Lighttpd/Nginx/Mysql/PhpMyAdmin/SSL) Optimization and ... + Modules
  3. Seedbox Windows/Linux (uTorrent,rTorrent,libTorrent,ruTorrent) + Modules
  4. TBDev Support
  5. Gazelle Support Install
  6. TSSE Install Support
Reply With Quote
  #4  
Old 18-07-17, 21:38
Extremlym's Avatar
Extremlym Extremlym is offline
Senior Member
 
Join Date: Oct 2012
P2P
Posts: 78
Default new benc
Code:
<?
//// https://extremlymtorrents.ws
function benc($obj) {
    if (!is_array($obj) || !isset($obj["type"]) || !isset($obj["value"]))
        return;
    $c = $obj["value"];
    switch ($obj["type"]) {
        case "string":
            return benc_str($c);
        case "integer":
            return benc_int($c);
        case "list":
            return benc_list($c);
        case "dictionary":
            return benc_dict($c);
        default:
            return;
    }
}

function hash_where_arr($name, $hash_arr) {
        $new_hash_arr = Array();
        foreach ($hash_arr as $hash) {
                $new_hash_arr[] = sqlesc((urldecode($hash)));
        }
        return $name." IN ( ".implode(", ",$new_hash_arr)." )";
}

function benc_str($s) {
    return strlen($s) . ":$s";
}

function benc_int($i) {
    return "i" . $i . "e";
}

function benc_list($a) {
    $s = "l";
    foreach ($a as $e) {
        $s .= benc($e);
    }
    $s .= "e";
    return $s;
}

function benc_dict($d) {
    $s = "d";
    $keys = array_keys($d);
    sort($keys);
    foreach ($keys as $k) {
        $v = $d[$k];
        $s .= benc_str($k);
        $s .= benc($v);
    }
    $s .= "e";
    return $s;
}

function bdec_file($f, $ms) {
    $fp = fopen($f, "rb");
    if (!$fp)
        return;
    $e = fread($fp, $ms);
    fclose($fp);
    return bdec($e);
}

function bdec($s) {
    if (preg_match('/^(\d+):/', $s, $m)) {
        $l = $m[1];
        $pl = strlen($l) + 1;
        $v = substr($s, $pl, $l);
        $ss = substr($s, 0, $pl + $l);
        if (strlen($v) != $l)
            return;
        return array(type => "string", value => $v, strlen => strlen($ss), string => $ss);
    }
    if (preg_match('/^i(-{0,1}\d+)e/', $s, $m)) {
        $v = $m[1];
        $ss = "i" . $v . "e";
        if ($v === "-0")
            return;
        if ($v[0] == "0" && strlen($v) != 1)
            return;
        return array(type => "integer", value => $v, strlen => strlen($ss), string => $ss);
    }
    switch ($s[0]) {
        case "l":
            return bdec_list($s);
        case "d":
            return bdec_dict($s);
        default:
            return;
    }
}

function bdec_list($s) {
    if ($s[0] != "l")
        return;
    $sl = strlen($s);
    $i = 1;
    $v = array();
    $ss = "l";
    for (;;) {
        if ($i >= $sl)
            return;
        if ($s[$i] == "e")
            break;
        $ret = bdec(substr($s, $i));
        if (!isset($ret) || !is_array($ret))
            return;
        $v[] = $ret;
        $i += $ret["strlen"];
        $ss .= $ret["string"];
    }
    $ss .= "e";
    return array(type => "list", value => $v, strlen => strlen($ss), string => $ss);
}

function bdec_dict($s) {
    if ($s[0] != "d")
        return;
    $sl = strlen($s);
    $i = 1;
    $v = array();
    $ss = "d";
    for (;;) {
        if ($i >= $sl)
            return;
        if ($s[$i] == "e")
            break;
        $ret = bdec(substr($s, $i));
        if (!isset($ret) || !is_array($ret) || $ret["type"] != "string")
            return;
        $k = $ret["value"];
        $i += $ret["strlen"];
        $ss .= $ret["string"];
        if ($i >= $sl)
            return;
        $ret = bdec(substr($s, $i));
        if (!isset($ret) || !is_array($ret))
            return;
        $v[$k] = $ret;
        $i += $ret["strlen"];
        $ss .= $ret["string"];
    }
    $ss .= "e";
    return array(type => "dictionary", value => $v, strlen => strlen($ss), string => $ss);
}

?>
Reply With Quote
  #5  
Old 24-07-17, 20:51
order's Avatar
order order is offline
Banned
 
Join Date: May 2017
Posts: 40
Default
That new its tbev lol bans
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 06:09. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2018, vBulletin Solutions Inc.