토렌트 파일의 트래커를 편집 할 수있는 사이트를 만들고 있습니다.
현재의 SEEDS
및 PEERS
에 대해 검색 하고 TRACKER
있습니다.
어떻게 작동했는지 혼란 스럽습니다. 표시하는 방법을 알고 거기에 누군가가 SEEDS
하고 PEERS
있는 토렌트 파일의는 PHP
?
에서와 마찬가지로 이와 같은 TORRENTEDITOR.COM
코드를 보았지만 작동 방식을 이해하지 못합니다. 도와주세요.
// global $seedsandpeers;
if ($seedsandpeers === TRUE){
if (!empty($array["announce-list"])){
$announce = $array["announce-list"];
// Possibly HtTp://
$announce = strtolower($announce);
if (substr($announce, 0, 7) === "http://"){
if ((substr_count($announce, "/announce")) == 1){
$scrape = str_replace('/announce', '/scrape', $announce);
$httpget = "?info_hash=";
$binsha1 = pack("H*", $infohash);
$binsha1s = addslashes($binsha1);
$fullurl = "$scrape$httpget$binsha1";
$httpurl = pathurlencode($fullurl);
sapeerconnect($httpurl, $binsha1s, $torrentsize);
} else {
$error = '<BR><label style="font-family:timesnewroman;font-size:12px;">Bad Tracker enter code hereURL for scraping (Maybe trackerless torrent).<br>' ;
echo $error;
}
}
else {
$error = '<BR><label style="font-family:timesnewroman;font-size:12px;">Bad Tracker URL for scraping (Maybe trackerless torrent).<br>';
echo $error;
}
}
}
그래서 나는 조금 연구했고 .torrent 파일을 디코딩 할 수있는 것 같습니다.
<?php
include 'functions.php';
$torrent_data = bdec(file_get_contents('test.torrent'));
$info=strtolower(sha1(benc($torrent_data['info'])));
$scrape=str_replace('announce','scrape',$torrent_data['announce']);
$sources=bdec(@file_get_contents($scrape.'?info_hash='.urlencode(hex2bin($info))));
$c=count($torrent_data['info']['files']);
echo '<h2>Files</h2>';
$files=array();
if($c > 1)
{
for ($i = 0; $i < $c; $i++) $files[]=$torrent_data['info']['files'][$i]['path']['1'];
sort($files);
foreach($files as $file) echo $file."<br>";
}
else echo $torrent_data['info']['name']."<br>";
$seeds = $sources['files'][hex2bin($info)]['complete'];
$leechs = $sources['files'][hex2bin($info)]['incomplete'];
$downloads = $sources['files'][hex2bin($info)]['downloaded'];
echo '<h2>Sources</h2>'.
'<b>Seeds:</b> '.$seeds.'<br/>'.
'<b>Leechs:</b> '.$leechs.'<br/>' .
'<b>Downloads:</b> '.$downloads.'<br/>';
?>
이 코드를 사용하려면 먼저 benc, bdec 및 hex2bin 함수가있는 파일을 포함해야합니다. 여기 에서 이러한 기능을 얻을 수 있습니다.
여기 에서 찾을 수있는 테스트 케이스를 준비했습니다.
이것이 도움이 되었기를 바랍니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다