determinate determinate

Author Topic: DHT blocker  (Read 3392 times)

0 Members and 1 Guest are viewing this topic.

Offline Jorgo

  • Double Ace
  • *
  • Posts: 102
  • Karma: +6/-6
DHT blocker
« on: August 05, 2010, 08:24:41 pm »
A new version of ApexDC++ just came out which has DHT enabled by default. A user in the private hub I'm in nearly had a heart attack when someone who's not a member started downloading files from him - and our user isn't in any other hubs.

What I'm looking for urgently is a method to detect DHT and block users who have it enabled in their client. I'm not sure if this should be done in ptokax itself or by script - either way it's pretty urgent. There are always users who never react to hub announcements where we would ask everybody to turn it off manually.

Because of the urgency of the matter, I'll also post this in the ptokax feature request section - please forgive double posting.

Offline lUk3f1l3w4lK3R

  • Junior Member
  • **
  • Posts: 19
  • Karma: +4/-0
Re: DHT blocker
« Reply #1 on: August 06, 2010, 02:32:57 pm »
I tried such a script a while ago but with no success.
A script to disconnect users who have DHT enabled would be nice,
cause it doesnt matter on which kind of hub (NMDC or ADC) you are,
with DHT enabled, users that are not on the same hub can leech from you.
I run also a private hub and would like to see such a script
but i think its not possible due to the fact that a client that have the DHT
feature, only sends the info about this support when connecting to a ADC hub.
Therefore i dont see a way to block these clients with a PtokaX script.
When connecting to a ADC hub then ADDHT0 is send in SU (Support).
When this is not send in SU then DHT is disabled.
This info is not send by the client when you connect to a NMDC hub,
not in MyINFO and not in Support.
Maybe i missed something and somebody can enlighten me
but i think its not possible to write such a script for PtokaX.
« Last Edit: August 06, 2010, 02:36:27 pm by lUk3f1l3w4lK3R »

Offline Naithif

  • Triple Ace
  • **
  • Posts: 200
  • Karma: +32/-13
Re: DHT blocker
« Reply #2 on: August 06, 2010, 02:39:42 pm »
Quote from: StrongDC++ nmdchub.cpp
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);


Quote from: Test
$Supports UserCommand NoGetINFO NoHello UserIP2 TTHSearch ZPipe0 TLS DHT0


Code: [Select]
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")
end
end

Should work... Modify it to your needs...

Possibly sending a message and disconnecting is better because supports arrive first from a client and maybe even before kicked users check.
« Last Edit: August 06, 2010, 02:45:09 pm by Naithif »

Offline Jorgo

  • Double Ace
  • *
  • Posts: 102
  • Karma: +6/-6
Re: DHT blocker
« Reply #3 on: August 06, 2010, 04:54:17 pm »
That works just fine, thanks a lot!

Offline pR0Ps

  • Member
  • ***
  • Posts: 27
  • Karma: +0/-2
Re: DHT blocker
« Reply #4 on: August 06, 2010, 05:02:11 pm »
Just as an FYI to everyone looking for this, this script works for StrongDC++ 2.30+ and it's derivatives (such as ApexDC++ 1.3.5). At the moment these are the only clients that even support DHT, so this script will detect all DHT users, no exceptions (for now). Thanks for the post Naithif.

EDIT: NMDC hubs will receive "DHT0" while ACD hubs will get "ADDHT0".
« Last Edit: August 06, 2010, 05:09:55 pm by pR0Ps »

Offline Yahoo

  • Triple Ace
  • **
  • Posts: 225
  • Karma: +32/-14
  • People Say "I Dont Know English"
    • Yahoo
Re: DHT blocker
« Reply #5 on: August 06, 2010, 05:04:57 pm »
gr8 work @ Naithif

seen you are a long time :D
"BoRN FIGhTEr"

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 294
  • Karma: +207/-17
  • PtokaX "developer"
Re: DHT blocker
« Reply #6 on: August 06, 2010, 11:01:38 pm »
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 :P
« Last Edit: August 06, 2010, 11:05:42 pm by PPK »

Offline pR0Ps

  • Member
  • ***
  • Posts: 27
  • Karma: +0/-2
Re: DHT blocker
« Reply #7 on: August 07, 2010, 05:09:35 am »
Hmmm, didn't know that. Good to know. Probably not that relevant though, those clients have been around for a while and this seems to be a new thing for most hubowners. Is there any way to check for people using DHT on those older clients?

Offline Naithif

  • Triple Ace
  • **
  • Posts: 200
  • Karma: +32/-13
Re: DHT blocker
« Reply #8 on: August 07, 2010, 01:16:26 pm »
Wrong, there are other (and older) clients using Kademlia DHT network and they are not detected by this script :P

That doesn't really count because:

- This feat was requested on other places because Apex 1.3.5 enabled DHT by default. I believe the request here was connected and it is from the hub owner telling why they banned 1.3.5

- Latest kad client is RevConnect that has core 0.674 (other kad clients are even older) which is usually disallowed in private hubs.
« Last Edit: August 07, 2010, 01:35:41 pm by Naithif »

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 294
  • Karma: +207/-17
  • PtokaX "developer"
Re: DHT blocker
« Reply #9 on: August 07, 2010, 03:19:53 pm »
- This feat was requested on other places because Apex 1.3.5 enabled DHT by default.
Here it is requested as DHT blocker...
- Latest kad client is RevConnect that has core 0.674 (other kad clients are even older) which is usually disallowed in private hubs.
More 0.674 based clients have kademlia. And they all have kademlia from reverse connect (where it is from year 2003)  ::)

Offline Jorgo

  • Double Ace
  • *
  • Posts: 102
  • Karma: +6/-6
Re: DHT blocker
« Reply #10 on: August 07, 2010, 06:28:06 pm »
Well, I'm no expert in the matter, but I'd like the script to be as complete as possible. The goal is to not permit any public connections on a private hub.
« Last Edit: August 08, 2010, 12:07:36 am by Jorgo »

Offline Naithif

  • Triple Ace
  • **
  • Posts: 200
  • Karma: +32/-13
Re: DHT blocker
« Reply #11 on: August 09, 2010, 12:44:32 am »
Here it is requested as DHT blocker...

It does just that.
As far as one can do via hub/scripting. More can be done client level, but I doubt anyone will do that.

Besides the request was started as:

A new version of ApexDC++ just came out which has DHT enabled by default.[...]

So... Exactly...



More 0.674 based clients have kademlia. And they all have kademlia from reverse connect (where it is from year 2003)  ::)

Yes. What I've tried to say is that 99.99% clients that have kad are stuck on (at most) 0.674.

So banning older clients including 0.674 solves the problem.
Private hubs doesn't rely on usercount anyway, so doing that shouldn't be a problem. Some even enforce a particular client...



Offline P_pan

  • Fulll Member
  • ****
  • Posts: 69
  • Karma: +1/-3
Re: DHT blocker
« Reply #12 on: August 19, 2010, 08:07:57 pm »
is it possibble to forward a msg to opchat as soon someone is  using this DHT stuff?

like : user:.... has dht enabled etc etc.... ?

thanks for this great script!

Offline P_pan

  • Fulll Member
  • ****
  • Posts: 69
  • Karma: +1/-3
Re: DHT blocker
« Reply #13 on: August 20, 2010, 08:59:37 am »
Thank You Master Mutor!

getting an little error though
DHT_block.lua: 4: unexpected symbol near "="

and scripts does crash
« Last Edit: August 20, 2010, 09:14:53 am by P_pan »

Offline lUk3f1l3w4lK3R

  • Junior Member
  • **
  • Posts: 19
  • Karma: +4/-0
Re: DHT blocker
« Reply #14 on: August 21, 2010, 02:10:25 pm »
Thank You Master Mutor!

getting an little error though
DHT_block.lua: 4: unexpected symbol near "="

and scripts does crash

remove the , at the end of line 2 and the script starts and you dont get the error message


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)
« Last Edit: August 21, 2010, 02:40:03 pm by lUk3f1l3w4lK3R »

Offline P_pan

  • Fulll Member
  • ****
  • Posts: 69
  • Karma: +1/-3
Re: DHT blocker
« Reply #15 on: August 21, 2010, 03:11:06 pm »
Quote
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)

This error i don't have at all.....  total no lua error does show...

Ur Trick did solve  my prob...  Thank You lUk3f1l3w4lK3R



Offline P_pan

  • Fulll Member
  • ****
  • Posts: 69
  • Karma: +1/-3
Re: DHT blocker
« Reply #16 on: August 23, 2010, 09:09:59 am »
getting now indeed this error aswell but now on line 39

PtokaX\scripts\kickdht.lua:39:attempt to perform arithmetic on field '?'(a nil value)

Offline P_pan

  • Fulll Member
  • ****
  • Posts: 69
  • Karma: +1/-3
Re: DHT blocker
« Reply #17 on: August 28, 2010, 12:32:22 pm »
Thank You....

works very fine :)

Offline somewherenotthere

  • Member
  • ***
  • Posts: 31
  • Karma: +0/-0
Re: DHT blocker
« Reply #18 on: August 28, 2010, 08:57:35 pm »
Doesnt seem to be working... no errors, just not doing anything.

Offline somewherenotthere

  • Member
  • ***
  • Posts: 31
  • Karma: +0/-0
Re: DHT blocker
« Reply #19 on: August 29, 2010, 06:45:03 am »
Yes I do/did.

It is working now thought, weird...

kudos to the creators of this script, really really helpful!

Offline merlin_xl54

  • Fulll Member
  • ****
  • Posts: 63
  • Karma: +2/-0
  • Not a player, just Playing!
Re: DHT blocker
« Reply #20 on: August 31, 2010, 01:19:07 am »
I started using this in our private hub and seem to be getting quite a few notifications. Even from users with the newest DC++ 0.770. We also have some older clients too. Is there a cut off where clients have it on with no options to turn it off. Can it be listed under any other options? We have a lot of clients pre 0.699 etc?

TIA

M
Living is easy with eyes closed.

Offline P_pan

  • Fulll Member
  • ****
  • Posts: 69
  • Karma: +1/-3
Re: DHT blocker
« Reply #21 on: August 31, 2010, 09:27:29 pm »
it looks like this script is a little mean ghost.... :)

error: scripts\DHT_block.lua:50: attempt to concatenate a nil value

:)  on latest build....

For_Ever_MeXxX

  • Guest
Re: DHT blocker
« Reply #22 on: September 17, 2010, 08:30:30 am »
Hello,

how I can remove the Botname from the Report in Operator Chat?

<#Operator> <#Kolloid> The Unregistered User, NICK with IP: **.**.**.** is using DHT.


and if I set only Report it Spams the Operator Chat with the same message 5 times or sometimes more...
Look here...

Code: [Select]
[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.
« Last Edit: September 17, 2010, 11:33:29 am by For_Ever_MeXxX »

Offline somewherenotthere

  • Member
  • ***
  • Posts: 31
  • Karma: +0/-0
Re: DHT blocker
« Reply #23 on: September 19, 2010, 09:56:55 pm »
hey mutor, this is definitely a helpful script, apex users are now aware of the fact that dht is enabled.

The problem that i am experiencing is that, on user arrival, the opchat gets spammed with msgs of all users using dht and multiples of this:

Quote
[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.

I have report only on fyi. Any help? it seems like such a random thing
« Last Edit: September 20, 2010, 10:01:49 am by somewherenotthere »

Offline somewherenotthere

  • Member
  • ***
  • Posts: 31
  • Karma: +0/-0
Re: DHT blocker
« Reply #24 on: September 20, 2010, 09:54:48 am »
Hey Mutor, I did read them yes, and i used the latest one. Unless there is something i missed in those 2 posts? Or perhaps you could make it clearer as to what your suggestion is in those posts?

For_Ever_MeXxX

  • Guest
Re: DHT blocker
« Reply #25 on: September 20, 2010, 12:58:19 pm »
He is right Mutor, my Opchat get spammed again, too...

Offline lUk3f1l3w4lK3R

  • Junior Member
  • **
  • Posts: 19
  • Karma: +4/-0
Re: DHT blocker
« Reply #26 on: September 20, 2010, 05:35:30 pm »
First version of this script did exactly what the script did, that i tried to make myself: it didnt disconnect users with DHT enabled clients (yes, there where DHT enabled clients).
Now the 2nd version of your script works like it should work.

I dont know what caused the issue with your first version
but thanks for updating your script.

Good work as allways Mutor.

Thx alot.

For_Ever_MeXxX

  • Guest
Re: DHT blocker
« Reply #27 on: September 20, 2010, 10:08:43 pm »
Yes, it was always the same IP for one User...


I was getting the msg from 3 user with DHT in 4secs 4-5times then it stops and after same mins it was starting again...
« Last Edit: September 20, 2010, 10:11:54 pm by For_Ever_MeXxX »

Offline somewherenotthere

  • Member
  • ***
  • Posts: 31
  • Karma: +0/-0
Re: DHT blocker
« Reply #28 on: September 21, 2010, 05:40:20 pm »
No Sir, I was asking if more than one user on a common IP
Hey Mutor, no problem. The users were completely different, and in fact one user was myself (owner) as I was testing the reporting capability. I have since disabled it and have had the problem again, last part of IP left intact for your consideration:

Quote
[15:43:37] <*> <*> The Reg, *with I.P.: *.*.150.180 is using DHT.
[15:43:38] <*> <*> The Reg, *with I.P.: *.*.150.180 is using DHT.
[15:43:39] <*> <*> The Reg, *with I.P.: *.*.150.180 is using DHT.
[15:43:41] <*> <*> The Reg, *with I.P.: *.*.150.180 is using DHT.
[15:43:41] <*> <*> The Reg, *with I.P.: *.*.37.234 is using DHT.

If you note: the first 4 are the same person, the last is a different person. This swaps each time, leading me to believe that it is triggered by it checking one user.

It is not a terrible problem, just slightly annoying in what is really helpful script (many kudos to Mutor and other contributors) as the hub is meant for a certain country only, and the apexdc++ devs for some really silly reason decided that they should ship it with it enabled.

Again, thank you for helping out so much Mutor, you have made running a hub much nicer with the many scripts you have made/helped make.

Offline somewherenotthere

  • Member
  • ***
  • Posts: 31
  • Karma: +0/-0
Re: DHT blocker
« Reply #29 on: September 22, 2010, 06:33:03 pm »
Another revision, testers welcome.
Also I removed the original script as
I feel at least some people may have
been using that version unwittingly.

Hey Mutor, seems to be better now... i was using the one with the options listed as "0 ,1 , etc"


For_Ever_MeXxX

  • Guest
Re: DHT blocker
« Reply #30 on: September 22, 2010, 08:55:14 pm »
Working great now... No problems anymore...

Great work, Mutor.  ;)

Offline merlin_xl54

  • Fulll Member
  • ****
  • Posts: 63
  • Karma: +2/-0
  • Not a player, just Playing!
Re: DHT blocker
« Reply #31 on: September 24, 2010, 03:38:46 am »
Hi Mutor,

Thanks for all your work. I received this in error from the bot. scripts\DHTDetector.lua:27: bad argument #1 to 'insert' (table expected, got number)
Line 27--> table.insert(Tab[user.sIP],1,GetProf(user))

Thanks again,

M
Living is easy with eyes closed.

 

determinate determinate
guestbook