READ THE RULES
0 Members and 1 Guest are viewing this topic.
Code: [Select] StringList feat; feat.push_back("UserCommand"); feat.push_back("NoGetINFO"); feat.push_back("NoHello"); feat.push_back("UserIP2"); feat.push_back("TTHSearch"); feat.push_back("ZPipe0"); if(CryptoManager::getInstance()->TLSOk() && !getStealth()) feat.push_back("TLS"); if(BOOLSETTING(USE_DHT)) feat.push_back("DHT0"); supports(feat);
StringList feat; feat.push_back("UserCommand"); feat.push_back("NoGetINFO"); feat.push_back("NoHello"); feat.push_back("UserIP2"); feat.push_back("TTHSearch"); feat.push_back("ZPipe0"); if(CryptoManager::getInstance()->TLSOk() && !getStealth()) feat.push_back("TLS"); if(BOOLSETTING(USE_DHT)) feat.push_back("DHT0"); supports(feat);
$Supports UserCommand NoGetINFO NoHello UserIP2 TTHSearch ZPipe0 TLS DHT0
function SupportsArrival(tUser, sData) if string.find(sData, "DHT0") then Core.Kick(tUser, "Hub-Security", "Please turn off DHT in Settings/Advanced/Publish shared files on DHT and use it for searching alternate sources") endend
At the moment these are the only clients that even support DHT, so this script will detect all DHT users, no exceptions (for now).
Wrong, there are other (and older) clients using Kademlia DHT network and they are not detected by this script
- This feat was requested on other places because Apex 1.3.5 enabled DHT by default.
- Latest kad client is RevConnect that has core 0.674 (other kad clients are even older) which is usually disallowed in private hubs.
Here it is requested as DHT blocker...
A new version of ApexDC++ just came out which has DHT enabled by default.[...]
More 0.674 based clients have kademlia. And they all have kademlia from reverse connect (where it is from year 2003)
Thank You Master Mutor!getting an little error thoughDHT_block.lua: 4: unexpected symbol near "="and scripts does crash
I get this error message when a registered user try to download filelist from another user:PtokaX\scripts\kickdht.lua:34:attempt to perform arithmetic on field '?'(a nil value)
[15:30:40] <[PxDev]> DHT is disallowed here. Please disable DHT functions in your client.[15:30:40] <[PxDev]> You are being kicked because: DHT Enabled[15:30:41] *** Connection closed
---- Admin's nick for status / error messages ["" = OpChat]OpNick = "Mutor"--Extended status / error messages? true/false [false script errors only]Verbose = true--Penalty for DHT enabled [0 = None,report only / 1 = Disconnect / 2= Tempban / 3 = Redirect]Penalty = 2OnStartup = function() Hub,Bot,Tab,Tmr = SetMan.GetString(0),SetMan.GetString(21),{},TmrMan.AddTimer(1000,"Process") Msg1 = "DHT is not allowed here. Please disable DHT functions in your client.|" Msg2 = "Uncheck: Settings\\Advanced\\Process shared files on DHT and use it for searching alternate sources."endOnError = function(msg) if msg then local user,bot = Core.GetUser(OpNick),"<"..Bot.."> " if user then Core.SendToUser(user,bot..msg.."|") else Core.SendToOpChat(bot..msg.."|") end endendSupportsArrival = function(user,data) if data:find("DHT0") and not Tab[user.sIP] then Tab[user.sIP] = {os.time()} endendVersionArrival = function(user) if Tab[user.sIP] then table.insert(Tab[user.sIP],1,GetProf(user)) table.insert(Tab[user.sIP],1,user.sNick) if not Tmr then Tmr = TmrMan.AddTimer(1000,"Process") end if Tab[user.sIP] and #Tab[user.sIP] == 3 and Verbose then OnError("DHT Client Connected: "..table.concat(Tab[user.sIP]," "):gsub("%d+$",os.date(nil,tonumber("%1")))) end endendUserDisconnected = function(user) if Tab[user.sIP] then local s = "DHT Client Disconnected: "..table.concat(Tab[user.sIP]," "):gsub("%d+$",os.date(nil,os.time())) Tab[user.sIP] = nil if not Tab[user.sIP] and Verbose then OnError(s) end endendRegDisconnected,OpDisconnected = UserDisconnected,UserDisconnectedProcess = function() local t,n = os.time(),0 for i,v in pairs(Tab) do if type(v) == "table" and #v == 3 and ((t - v[3]) > 5) then local rep = "The "..v[2]..", "..v[1].." with I.P.: "..i.." is using DHT." local user = Core.GetUser(v[1]) if user then Core.SendToUser(user,"<"..Bot.."> "..Msg1) Core.SendToUser(user,"<"..Bot.."> "..Msg2) local s,n = "DHT Enabled",user.sNick if Penalty == 0 then OnError(rep) else local Reply = {"disconnected from "..SetMan.GetString(0), "tempbanned for "..tostring(SetMan.GetNumber(16)).." minutes", "redirected to "..SetMan.GetString(6)} if Reply[Penalty] then Core.SendToUser(user,"<"..Bot.."> You will be "..Reply[Penalty]) rep = v[2].." "..v[1].." "..Reply[Penalty] if Penalty == 1 then if Core.Disconnect(user) and Verbose then OnError(rep) end elseif Penalty == 2 then if BanMan.TempBan(user,0,s,Bot,false) and Verbose then OnError(rep) end elseif Penalty == 3 then if Core.Redirect(user,SetMan.GetString(6),s) and Verbose then OnError(rep) end end end end end Tab[i] = nil else n = n + 1 end end if n == 0 then TmrMan.RemoveTimer(Tmr) Tmr = nil endendGetProf = function(user) local Prof = "Unregistered User" if user.iProfile ~= -1 then Prof = ProfMan.GetProfile(user.iProfile).sProfileName end return Profend
[12:26:30] <#Operator> <#Kolloid> The Unregistered User, [ ROMANIA-GIRL ] with IP: [ **.**.**.** ] is using DHT.[12:26:30] <#Operator> <#Kolloid> The Unregistered User, [ [ro][rds]fane ] with IP: [ **.**.**.** ] is using DHT.[12:26:30] <#Operator> <#Kolloid> The Unregistered User, [ sdhgfnsdfsdxaz ] with IP: [ **.**.**.** ] is using DHT.[12:26:30] <#Operator> <#Kolloid> The Unregistered User, [ [RO][AG][RDS][George_2010] ] with IP: [ **.**.**.** ] is using DHT. [12:26:31] <#Operator> <#Kolloid> The Unregistered User, [ ROMANIA-GIRL ] with IP: [ **.**.**.** ] is using DHT.[12:26:31] <#Operator> <#Kolloid> The Unregistered User, [ [ro][rds]fane ] with IP: [ **.**.**.** ] is using DHT.[12:26:31] <#Operator> <#Kolloid> The Unregistered User, [ sdhgfnsdfsdxaz ] with IP: [ **.**.**.** ] is using DHT.[12:26:31] <#Operator> <#Kolloid> The Unregistered User, [ [RO][AG][RDS][George_2010] ] with IP: [ **.**.**.** ] is using DHT.[12:26:32] <#Operator> <#Kolloid> The Unregistered User, [ ROMANIA-GIRL ] with IP: [ **.**.**.** ] is using DHT.[12:26:32] <#Operator> <#Kolloid> The Unregistered User, [ [ro][rds]fane ] with IP: [ **.**.**.** ] is using DHT.[12:26:32] <#Operator> <#Kolloid> The Unregistered User, [ sdhgfnsdfsdxaz ] with IP: [ **.**.**.** ] is using DHT.[12:26:32] <#Operator> <#Kolloid> The Unregistered User, [ [RO][AG][RDS][George_2010] ] with IP: [ **.**.**.** ] is using DHT.[12:26:33] <#Operator> <#Kolloid> The Unregistered User, [ ROMANIA-GIRL ] with IP: [ **.**.**.** ] is using DHT.[12:26:33] <#Operator> <#Kolloid> The Unregistered User, [ [ro][rds]fane ] with IP: [ **.**.**.** ] is using DHT.[12:26:33] <#Operator> <#Kolloid> The Unregistered User, [ sdhgfnsdfsdxaz ] with IP: [ **.**.**.** ] is using DHT.[12:26:33] <#Operator> <#Kolloid> The Unregistered User, [ [RO][AG][RDS][George_2010] ] with IP: [ **.**.**.** ] is using DHT.[12:26:34] <#Operator> <#Kolloid> The Unregistered User, [ ROMANIA-GIRL ] with IP: [ **.**.**.** ] is using DHT.[12:26:34] <#Operator> <#Kolloid> The Unregistered User, [ [ro][rds]fane ] with IP: [ **.**.**.** ] is using DHT.[12:26:34] <#Operator> <#Kolloid> The Unregistered User, [ sdhgfnsdfsdxaz ] with IP: [ **.**.**.** ] is using DHT.[12:26:34] <#Operator> <#Kolloid> The Unregistered User, [ [RO][AG][RDS][George_2010] ] with IP: [ **.**.**.** ] is using DHT.[12:26:35] <#Operator> <#Kolloid> The Unregistered User, [ ROMANIA-GIRL ] with IP: [ **.**.**.** ] is using DHT.[12:26:35] <#Operator> <#Kolloid> The Unregistered User, [ [ro][rds]fane ] with IP: [ **.**.**.** ] is using DHT.[12:26:35] <#Operator> <#Kolloid> The Unregistered User, [ sdhgfnsdfsdxaz ] with IP: [ **.**.**.** ] is using DHT.[12:26:35] <#Operator> <#Kolloid> The Unregistered User, [ sossana ] with IP: [ **.**.**.** ] is using DHT.[12:26:35] <#Operator> <#Kolloid> The Unregistered User, [ [RO][AG][RDS][George_2010] ] with IP: [ **.**.**.** ] is using DHT.[12:27:48] <#Operator> <#Kolloid> The Unregistered User, [ ROMANIA-GIRL ] with IP: [ **.**.**.** ] is using DHT.[12:27:48] <#Operator> <#Kolloid> The Unregistered User, [ [ro][rds]fane ] with IP: [ **.**.**.** ] is using DHT.[12:27:48] <#Operator> <#Kolloid> The Unregistered User, [ sossana ] with IP: [ **.**.**.** ] is using DHT.[12:27:48] <#Operator> <#Kolloid> The Unregistered User, [ sdhgfnsdfsdxaz ] with IP: [ **.**.**.** ] is using DHT.[12:27:48] <#Operator> <#Kolloid> The Unregistered User, [ [RO]90-CMO ] with IP: [ **.**.**.** ] is using DHT.[12:27:48] <#Operator> <#Kolloid> The Unregistered User, [ [RO][AG][RDS][George_2010] ] with IP: [ **.**.**.** ] is using DHT.[12:28:46] <#Operator> <#Kolloid> The Unregistered User, [ ROMANIA-GIRL ] with IP: [ **.**.**.** ] is using DHT.[12:28:46] <#Operator> <#Kolloid> The Unregistered User, [ [ro][rds]fane ] with IP: [ **.**.**.** ] is using DHT.[12:28:46] <#Operator> <#Kolloid> The Unregistered User, [ sossana ] with IP: [ **.**.**.** ] is using DHT.[12:28:46] <#Operator> <#Kolloid> The Unregistered User, [ sdhgfnsdfsdxaz ] with IP: [ **.**.**.** ] is using DHT.[12:28:46] <#Operator> <#Kolloid> The Unregistered User, [ [RO]90-CMO ] with IP: [ **.**.**.** ] is using DHT.[12:28:46] <#Operator> <#Kolloid> The Unregistered User, [ [RO][AG][RDS][George_2010] ] with IP: [ **.**.**.** ] is using DHT.
[21:39:34] <*> <*> The Reg, *with I.P.: *.*.*.*is using DHT.[21:39:34] <*> <*> The Owner, *with I.P.: *..*.*is using DHT.[21:39:34] <*> <*> The Reg, *with I.P.: *.*.*.*is using DHT.[21:39:34] <*> <*> The Owner, *with I.P.: *.*.*.*is using DHT.[21:39:34] <*> <*> The Reg, *with I.P.: *.*.*.*is using DHT.[21:39:34] <*> <*> The Owner, *with I.P.: *.*.*.*is using DHT.[21:39:36] <*> <*> The Reg, *with I.P.: **.*.*is using DHT.[21:39:36] <*> <*> The Owner, *with I.P.: *.*.*.*is using DHT.[21:39:36] <*> <*> The Reg, *with I.P.: *.*.*.*is using DHT.[21:39:36] <*> <*> The Unregistered User, *with I.P.: *.*.*.*is using DHT.[21:39:36] <*> <*> The Owner, *with I.P.: ***.*.*is using DHT.