Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
Thread Tools
  #1  
Old 29th September 2010, 16:59
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,242
Default Get agent function
Someone has an updated one ?
I can't see some clients like Bittorrent and others ...
Reply With Quote
  #2  
Old 29th September 2010, 17:23
Krypto Krypto is offline
Retired from BVList
 
Join Date: Jan 2008
P2P
Posts: 510
Default
I just use this

PHP Code:
function getagent($httpagent=''$peer_id="")
    {
        return (
$httpagent $httpagent : ($peer_id $peer_id Unknown));
    } 
Reply With Quote
  #3  
Old 29th September 2010, 17:54
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,242
Default
that's it ?
i have a more complex one ..
with Ban Bittorent Clients by petrified ..
and some clients i get as unkown in the peers table

Code:
function getagent($httpagent, $peer_id="")
{

if ($peer_id!="")
    $peer_id=hex2bin($peer_id);

//if (preg_match("/^Azureus ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]\_B([0-9][0-9|*])(.+)$)/", $httpagent, $matches))
//return "Azureus/$matches[1]";
//elseif (preg_match("/^Azureus ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]\_[a-zA-Z]+)/", $httpagent, $matches))
//return "Azureus/$matches[1]";
//elseif (preg_match("/^Azureus ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]\_CVS)/", $httpagent, $matches))
//return "Azureus/$matches[1]";
if (preg_match("/^Java\/([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "Azureus/<2.0.7.0";
//elseif (preg_match("/^Azureus ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
//return "Azureus/$matches[1]";
elseif (preg_match("/BitTorrent\/S-([0-9]+\.[0-9]+(\.[0-9]+)*)/", $httpagent, $matches))
return "Shadow's/$matches[1]";
elseif (preg_match("/BitTorrent\/U-([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "UPnP/$matches[1]";
elseif (preg_match("/^BitTor(rent|nado)\\/T-(.+)$/", $httpagent, $matches))
return "BitTornado/$matches[2]";
elseif (preg_match("/^BitTornado\\/T-(.+)$/", $httpagent, $matches))
return "BitTornado/$matches[1]";
elseif (preg_match("/^BitTorrent\/ABC-([0-9]+\.[0-9]+(\.[0-9]+)*)/", $httpagent, $matches))
return "ABC/$matches[1]";
elseif (preg_match("/^ABC ([0-9]+\.[0-9]+(\.[0-9]+)*)\/ABC-([0-9]+\.[0-9]+(\.[0-9]+)*)/", $httpagent, $matches))
return "ABC/$matches[1]";
elseif (preg_match("/ABC\/ABC-([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "ABC/$matches[1]";
elseif (preg_match("/ABC\/AO([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "ABC/AO$matches[1]";
elseif (preg_match("/^Python-urllib\/.+?, BitTorrent\/([0-9]+\.[0-9]+(\.[0-9]+)*)/", $httpagent, $matches))
return "BitTorrent/$matches[1]";
elseif (ereg("^BitTorrent\/BitSpirit$", $httpagent))
return "BitSpirit";
elseif (ereg("^DansClient", $httpagent))
return "XanTorrent";
elseif (preg_match("/^BitTorrent\/brst(.+)/", $httpagent, $matches))
return "Burst/$matches[1]";
elseif (preg_match("/^RAZA (.+)$/", $httpagent, $matches))
return "Shareaza/$matches[1]";
elseif (preg_match("/Rufus\/([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "Rufus/$matches[1]";
elseif (preg_match("/uTorrent\/([0-9]+)([0-9]+)([0-9]+)([0-9]+)/", $httpagent, $matches))
return "uTorrent/$matches[1].$matches[2].$matches[3]";
elseif (preg_match("/uTorrent\/([0-9]+)([0-9]+)([0-9]+)/", $httpagent, $matches))
return "uTorrent/$matches[1].$matches[2].$matches[3]";
elseif (preg_match("/uTorrent\/([0-9]+[0-9]+[0-9]+B)/", $httpagent, $matches))
return "uTorrent/$matches[1]";
elseif (preg_match("/Acquisition\/([0-9]+[0-9]+[0-9]+\.[0-9])/", $httpagent, $matches))
return "Acquisition/$matches[1]";
elseif (preg_match("/BitComet Turbo ([0-9]+\.[0-9]+\.[0-9]+.[0-9])/", $httpagent, $matches))
return "BitComet Turbo/$matches[1]";
elseif (preg_match("/btpd\/([0-9]+\.[0-9])/", $httpagent, $matches))
return "btpd/$matches[1]";
elseif ((strpos($httpagent, 'BitTorrent/4.1.2')!== false) && (substr($peer_id, 2, 2) == "BS"))
return "BitSpirit/v3";
if (preg_match("/rtorrent\/([0-9]+\.[0-9]+\.[0-9]+\/[0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "rtorrent/$matches[1]";
if (preg_match("/libtorrent\/([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "libtorrent/$matches[1]";
if (preg_match("/Transmission\/([0-9]+\.[0-9]+)/", $httpagent, $matches))
return "Transmission/$matches[1]";
if (preg_match("/Shareaza\ ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "Shareaza $matches[1]";
elseif (preg_match("/^BitsOnWheels ([0-9]+\.[0-9]+\.[0-9])/", $httpagent, $matches))
return "BitsOnWheels/$matches[1]";
elseif (preg_match("/ktorrent\/([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "KTorrent/$matches[1]";
elseif (preg_match("/ktorrent\/([0-9]+\.[0-9]+)/", $httpagent, $matches))
return "KTorrent/$matches[1]";
elseif (preg_match("/GetRight\/([0-9]+\.[0-9]+[a-z])/", $httpagent, $matches))
return "GetRight/$matches[1]";
elseif (preg_match("/^0P3R4H BT/", $httpagent, $matches))
return "0P3R4H_BT";
elseif (preg_match("/Fast Torrent ([0-9]+\.[0-9]+\.[0-9]+.[0-9])/", $httpagent, $matches))
return "FastTorrent/$matches[1]";
elseif (preg_match("/^BitTorrent\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
{
if(substr($peer_id, 0, 6) == "exbc\08")
return "BitComet/0.56";
elseif(substr($peer_id, 0, 6) == "exbc\09")
return "BitComet/0.57";
elseif(substr($peer_id, 0, 6) == "exbc\0:")
return "BitComet/0.58";
elseif(substr($peer_id, 0, 7) == "exbc\0L")
return "BitLord/1.0";
elseif(substr(bin2hex($peer_id), 0, 14) == "6578626301014C")
return "BitLord/1.1";
elseif(substr(bin2hex($peer_id), 0, 14) == "6578626302004C")
return "BitLord/2.0";
elseif(substr($peer_id, 0, 8) == "-GR5907-")
return "GetRightPro/6.0beta7";
else
return "BitTorrent/$matches[1]";
}
elseif(substr($peer_id, 0, 5) == "-BC00")
return "BitComet/0.".substr($peer_id, 5, 2);
elseif(substr($peer_id, 0, 5) == "-BC01")
return "BitComet/1.".substr($peer_id, 5, 2);
elseif (preg_match("/^Python-urllib\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
return "G3 Torrent";
elseif (preg_match("/MLdonkey( |\/)([0-9]+\\.[0-9]+).*/", $httpagent, $matches))
return "MLdonkey$matches[1]";
elseif (preg_match("/MLDonkey\/([0-9]+\.[0-9]+\.[0-9]+)/", $httpagent, $matches))
return "MLDonkey/$matches[1]";
elseif (preg_match("/ed2k_plugin v([0-9]+\\.[0-9]+).*/", $httpagent, $matches))
return "eDonkey/$matches[1]";
elseif(substr($peer_id, 0, 8) == "-CD0201-")
return "CTorrent/2.1";
elseif(substr($peer_id, 0, 4) == "-qB0")
return "QBittorrent/0.".substr($peer_id, 4, 1);
elseif(substr($peer_id, 0, 3) == "-KT")
return "KTorrent/".substr($peer_id, 3, 1).".".substr($peer_id, 4, 1);
elseif(substr($peer_id, 0, 8) == "AZ2500BT")
return "Azureus BitTyrant";
elseif(substr($peer_id, 0, 3) == "-AG")
return "Ares/".substr($peer_id, 3, 1).".".substr($peer_id, 4, 1).".".substr($peer_id, 5, 1).".".substr($peer_id, 6, 1);
elseif(substr($peer_id, 0, 3) == "-lt")
return "libTorrent/".hexdec(substr($peer_id, 3, 1)).".".hexdec(substr($peer_id, 4, 1)).".".hexdec(substr($peer_id, 5, 1));
elseif(substr($peer_id, 0, 3) == "-LT")
return "Free_Download_Manager";
elseif(substr($peer_id, 0, 8) == "-CD0202-")
return "CTorrent";
elseif(substr($peer_id, 0, 3) == "-LP")
return "Lphant/".substr($peer_id, 4, 1).".".substr($peer_id, 5, 2);
elseif(substr($peer_id, 0, 3) == "-BF")
{
    if(substr($peer_id, 3, 4) == "6110")
        $ver="0.10";
    elseif(substr($peer_id, 3, 4) == "6C05")
        $ver="0.20";
    elseif(substr($peer_id, 3, 4) == "6C0F")
        $ver="0.21";
    elseif(substr($peer_id, 3, 4) == "7114")
        $ver="0.22";
    elseif(substr($peer_id, 3, 4) == "7127")
        $ver="0.30";
    elseif(substr($peer_id, 3, 4) == "7128")
        $ver="0.31";
    elseif(substr($peer_id, 3, 4) == "7224")
        $ver="0.32";
    else $ver="??";
    return "BitFlu/".$ver;
}
elseif(substr($peer_id, 0 , 2)=="OP")
return "Opera";
elseif(substr($peer_id, 1, 2)=="DE")
return "Deluge/".substr($peer_id, 3, 1).".".substr($peer_id, 4, 1).".".substr($peer_id, 5, 1).".".substr($peer_id, 6, 1);
elseif(substr($peer_id, 0 , 1)=="M" && substr($peer_id, 2 , 1)=="-" && substr($peer_id, 4 , 1)=="-")
return "BitTorrent/".substr($peer_id, 1, 1).".".substr($peer_id, 3, 1).".".substr($peer_id, 5, 1);
elseif(substr($httpagent,0,8)=="LimeWire" && (substr($peer_id,0,4)=="LIME") || substr($peer_id,1,2)=="LW")
return $httpagent;
elseif(substr($httpagent,0,4)=="Plus")
return "BitTorrent Plus! II/".substr($peer_id, 4, 1).".".substr($peer_id, 5, 1)." Beta ".substr($peer_id, 6, 1);
elseif(substr($peer_id, 1, 2)=="HL")
return "Halite/".intval(substr($peer_id,3,2)).".".substr($peer_id,5,1);
elseif(substr($peer_id, 1, 2)=="CD")
return "Enhanced CTorrent/".intval(substr($peer_id,3,2)).".".intval(substr($peer_id,5,2));
elseif(substr($peer_id, 1, 2)=="XL" || substr($peer_id, 1, 2)=="SD")
return "Xunlei/".intval(substr($peer_id,3,2)).".".intval(substr($peer_id,5,2));
elseif(substr($peer_id, 1, 2)=="TT")
return "TuoTu/".substr($peer_id,3,1).".".substr($peer_id,4,1).".".substr($peer_id,5,1);
elseif(substr($peer_id, 1, 2)=="AZ" && substr($peer_id, 3, 2)<31)
return "Azureus/".substr($peer_id,3,1).".".substr($peer_id,4,1).".".substr($peer_id,5,1).".".substr($peer_id,6,1);
elseif(substr($peer_id, 1, 2)=="AZ" && substr($peer_id, 3, 2)>=31)
return "Vuze/".substr($peer_id,3,1).".".substr($peer_id,4,1).".".substr($peer_id,5,1).".".substr($peer_id,6,1);
elseif(substr($peer_id, 1, 2)=="UM")
return "uTorrent_Mac/".substr($peer_id,3,1).".".substr($peer_id,4,1).".".substr($peer_id,5,1).".".substr($peer_id,6,1);
elseif(substr($peer_id, 1, 2)=="BE")
return "BitTorrent_SDK/".substr($peer_id,3,1).".".substr($peer_id,4,1);
elseif(substr($peer_id, 1, 2)=="LH")
return "LH-ABC/".substr($peer_id,3,1).".".substr($peer_id,4,1).".".substr($peer_id,5,1).".".substr($peer_id,6,1);
elseif(substr($peer_id, 1, 2)=="FC")
return "FileCroc/".substr($peer_id,3,1).".".substr($peer_id,4,1).".".substr($peer_id,5,1).".".substr($peer_id,6,1);
elseif(substr($peer_id, 1, 2)=="ML")
return "MLdonkey/".substr($peer_id,3,5);
elseif(substr($peer_id, 1, 5)=="aria2")
return "aria2";
elseif(substr($peer_id, 1, 2)=="OS")
return "OneSwarm/".substr($peer_id,3,1).".".substr($peer_id,4,1);
elseif(substr($peer_id, 1, 4)=="UT16" && $httpagent=="uTorrent 1.5")
return "uTorrent/1.6.".substr($peer_id,5,1);
elseif(substr($peer_id, 1, 6)=="AR1001" && $httpagent=="(libtorrent)")
return "Arctic/1.2.3";
elseif(substr($peer_id, 1, 2)=="qB")
return "qBittorent/".substr($peer_id,3,1).".".substr($peer_id,4,1).".".substr($peer_id,5,1);
elseif(substr($peer_id, 0, 1)=="O")
return "Osprey Permaseed/".substr($peer_id,1,1).".".substr($peer_id,2,1);
else
return "Unknown Client (".substr($peer_id, 0, 8).")";
}
Reply With Quote
  #4  
Old 29th September 2010, 20:27
Krypto Krypto is offline
Retired from BVList
 
Join Date: Jan 2008
P2P
Posts: 510
Default
I used to use the more complex one but like you it did not detect all the clients, but this one seems to, try it and see.
Reply With Quote
  #5  
Old 30th September 2010, 11:53
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,242
Default
i had that in the 1st place .. but he said i need to change it so that the mod will work
Reply With Quote
  #6  
Old 30th September 2010, 13:01
Krypto Krypto is offline
Retired from BVList
 
Join Date: Jan 2008
P2P
Posts: 510
Default
Other way would be if you know which members are showing using an unknown client would be to PM them and ask what client and version they are using and then try to see if you can find the peer_id of them and add them to your function?
Reply With Quote
  #7  
Old 1st October 2010, 10:09
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,242
Default
i can see that easily ..
in userdetails it shows what client and what port they use :)
and most times Bittorrent itn't showing properly in peers table
Reply With Quote
Reply

Tags
agent , function


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 07:53. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.