scrips for new clients needed

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
robbieboy
Posts: 3
Joined: 2003-02-07 04:50

scrips for new clients needed

Post by robbieboy » 2003-07-05 17:50

is there a script out or is anybody capable of witing one to search out and ban these new clients like Intradream or the new nmdc with all the features for the leechers

i run a small hub and i dont wanna see these clients kill dc which in my eyes is what is happening unless we can find a way of detecting them

long live dc dont let it die

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Re: scrips for new clients needed

Post by GargoyleMT » 2003-07-06 13:58

robbieboy wrote:... or the new nmdc with all the features for the leechers
Jon Hess released NMDC 2.01 - http://www.neo-modus.com/?page=News
It has features to appease angry hub ops.

Atomic Jo
Posts: 62
Joined: 2003-01-04 03:50
Location: Québec, Canada
Contact:

Post by Atomic Jo » 2003-07-07 02:00

Here is a mini script for the two latest NMDC versions (2 and 2.01)
See the "Const" list to configure the script, and please report bugs if you discover.

Thanks to TasMan for the original script :)

Code: Select all

'By TasMan 
'Mod by Atomic Jo
'Version 2.0

Const ALLOWNMDC2   = False  'Allow or not NMDC ver 2
Const ALLOWNMDC201 = True   'Allow or not NMDC ver 2.01
Const MINSLOTS = 1          'Min slots
Const MAXHUBS = 3           'Max hubs
Const HSRATIO = 0.5         'Ratio Slot/hub
Const MINUPLOAD = 8         'Min Upload (in KiloBytes per Second)
Const BOTNAME = "DC2"       'BotName
Const CHECKDELAY = 1        'Delay (in minute) between each general check
Const POLICY = 2            '0=no action, 1=redirect, 2=deconnect, 3=kick, 4=kick&permban

Dim oNetInfo, iCount

Sub Main()
If ALLOWNMDC2 Or ALLOWNMDC201 Then
   Set oNetInfo = CreateObject("Scripting.Dictionary")
   iCount = 0
   tmrScriptTimer.Interval = 60000
   tmrScriptTimer.Enabled = True
End If
End Sub

Sub DataArival(curUser, sData)
 If LeftB(sData, 16) = "$NetInfo" Then
   Check curUser, MidB(sData, 19)
   If Not oNetInfo.Exists(CStr(curUser.sName)) Then oNetInfo.Add curUser.sName, curUser.sName
   Exit Sub
 End If
End Sub

Sub NewUserConnected(curUser)
 curUser.SendData "$GetNetInfo|"
End Sub

Sub OpConnected(curUser)
 If Not curUser.bOperator Then curUser.SendData "$GetNetInfo|"
End Sub

Sub tmrScriptTimer_Timer()
 iCount = iCount + 1
 If iCount >= CHECKDELAY Then
  CheckAll
  iCount = 0
 End If
End Sub

Sub Check(curUser, sData)
Dim lPos, iSlots, iHubs, iUpload, sMsg, info

 info = Split(sData, "$")
 If (UBound(info) = 2 And Not ALLOWNMDC2) Or (UBound(info) = 3 And Not ALLOWNMDC201) Then
   curUser.PrivateMessage CStr(BOTNAME), "NMDC version 2 and/or 2.01 is not allowed here. User NMDC 1.0091 version or latest version of DC++"
   frmHub.DoEventsForMe
   frmHub.lstPermban.AddItem CStr(curUser.IP)
   curUser.Kick
   Exit Sub
 End If

 iSlots = CInt(info(0))
 iHubs = CInt(info(1))
 If UBound(info) = 3 Then iUpload = CInt(info(3))

 Select Case True
  Case iHubs > MAXHUBS: sMsg = "We require you to have less than " & CStr(MAXHUBS) & " connections here."
  Case iSlots < MINSLOTS: sMsg = "We require you to have more than " & CStr(MINSLOTS) & " open."
  Case (iSlots \ iHubs) < HSRATIO: sMsg = "We require you to have at least " & CStr(HSRATIO) & " slots open per hub."
  Case (iUpload < MINUPLOAD * 1024) And (UBound(info) = 3): sMsg = "We require you to have a bandwidth at least " & CStr(MINUPLOAD) & " KiloBytes per Second."
 End Select

 If LenB(sMsg) Then
  curUser.PrivateMessage CStr(BOTNAME), CStr(sMsg)
  frmHub.DoEventsForMe
  Select Case POLICY
  Case 1
     curUser.ForceMove frmHub.txtRedirect
     frmHub.DoEventsForMe
     curUser.Disconnect()
  Case 2
     curUser.Disconnect()
  Case 3
     curUser.Kick()
  Case 4
     frmHub.lstPermban.AddItem CStr(curUser.IP)
     CurUser.Kick()
  End Select
End If
End Sub

Sub CheckAll()
Dim oItem

 For Each oItem In oNetInfo.Items
   If colUsers.Online(CStr(oItem)) Then colUsers.ItemByName(CStr(oItem)).SendData "$GetNetInfo|" Else oNetInfo.Remove oItem
 Next
End Sub
Enjoy it :)

robbieboy
Posts: 3
Joined: 2003-02-07 04:50

thanks

Post by robbieboy » 2003-07-07 13:39

thanks for the help guys


THE SCRIPT SEEMS TO BE RUNNING SUPERB :)
tnks Atomic Jo and of couse TasMan :)

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-07-08 22:56

Atomic Jo wrote:Here is a mini script for the two latest NMDC versions (2 and 2.01)
See the "Const" list to configure the script, and please report bugs if you discover.
Note, NMDC 2.01 seems to send 0 as the upload value when there's no limit:

Code: Select all

0000: 00 50 04 D8 96 31 00 02 E3 02 9F D9 08 00 45 00 .P...1........E.
0010: 00 95 71 8E 40 00 80 06 05 6B C0 A8 01 11 C0 A8 [email protected]......
0020: 01 08 08 D9 01 9B C3 C4 F0 FA B3 FE 11 67 50 18 .............gP.
0030: FE FC E9 F6 00 00 24 56 65 72 73 69 6F 6E 20 31 ......$Version 1
0040: 2E 30 30 39 31 7C 24 47 65 74 4E 69 63 6B 4C 69 .0091|$GetNickLi
0050: 73 74 7C 24 4D 79 49 4E 46 4F 20 24 41 4C 4C 20 st|$MyINFO $ALL 
0060: 47 61 72 67 20 3C 44 43 20 56 3A 32 2E 30 31 2C Garg .DC V:2.01,
0070: 4D 3A 50 2C 48 3A 31 2F 30 2F 30 2C 53 3A 34 3E M:P,H:1/0/0,S:4.
0080: 24 20 24 44 53 4C 01 24 24 36 38 32 36 32 32 35 $ $DSL.$$6826225
0090: 24 7C 24 4E 65 74 49 6E 66 6F 20 34 24 31 24 50 $|$NetInfo 4$1$P
00A0: 24 30 7C                                        $0|
The hub disconnected my test install becaues it didn't meet the minimum cap. Zero ought to be a special case then?

Atomic Jo
Posts: 62
Joined: 2003-01-04 03:50
Location: Québec, Canada
Contact:

Post by Atomic Jo » 2003-07-09 00:06

Thanks Gargoyle for this bug :)

I tested it, and you are right.

Just replace the line :

Code: Select all

  Case (iUpload < MINUPLOAD * 1024) And (UBound(info) = 3):
by this one:

Code: Select all

  Case (iUpload > 0) And (iUpload < MINUPLOAD * 1024) And (UBound(info) = 3): 

cyberal
Posts: 360
Joined: 2003-05-16 05:42

Post by cyberal » 2003-07-09 01:06

Code: Select all

2=deconnect
:D
http://whyrar.omfg.se - Guide to RAR and DC behaviour!
http://bodstrom.omfg.se - Bodströmsamhället, Länksamling om hoten mot vår personliga integritet

Atomic Jo
Posts: 62
Joined: 2003-01-04 03:50
Location: Québec, Canada
Contact:

Post by Atomic Jo » 2003-07-09 02:42

Oups... sorry, bad translation from french to english.

Off course it was "Disconnect" (sure you guessed :) )

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-07-09 06:55

Atomic Jo wrote:Thanks Gargoyle for this bug :)
Thanks for the script, it enabled me to test $GetNetInfo/$NetInfo a bit. It's (seemingly) disabled in the client to client protocol, which is much easier for me to modify for testing purposes.

Atomic Jo
Posts: 62
Joined: 2003-01-04 03:50
Location: Québec, Canada
Contact:

Post by Atomic Jo » 2003-07-09 10:32

I noticed another (sic !) bug. Try and open several hub frame, note the slot in the S: tag, open and open, and when an user takes to you a slot, in hubs opened after this, the Slot tag decrease. Because it sends FREE Slots not TOTAL Slots. And in first opened hub, the tag is never updated (Hub Side). A total bug.

I think a very usefull script could be this one:

Code: Select all

Sub NewUserConnected(curUser)
  curUser.SendData "$GetNetInfo|"
End Sub

Sub DataArival(curUser, sData)
If LeftB(sData, 16) = "$NetInfo" Then
  curUser.PrivateMessage "NMDC2", "Version 2 and/or 2.01  Clients from Neo-Modus is not allowed here" + vbCrLf + "Come back when Jon will release a good client (bug free) or go to http://www.dcplusplus.com to download the latest version of DC++"
  frmHub.DoEventsForMe
  frmHub.lstPermban.AddItem CStr(curUser.IP)
  curUser.Kick
  Exit Sub
End If
End Sub
I'm sure this mini script will be appreciated :)

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-07-09 11:04

Atomic Jo wrote:I'm sure this mini script will be appreciated :)
Hehe, but probably not appreciated as much as a bug report. ;-)

MTW
Posts: 4
Joined: 2003-01-05 23:57

Post by MTW » 2003-07-10 14:26

Hi, thanks for a good script. But I have a problem with it.

If
client respond with: $NetInfo 1$1$P$30977 <-- limiter set to 30.25 KB/sec, all works fine.
client respond with: $NetInfo 1$1$P$33857 <-- limiter set to 33.06 KB/sec (or higher), kills the script.

Not just the MINUPLOAD check, but everything.

I have no idea why... any suggestions for a fix?

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-07-27 21:01

2.02 of NMDC is out. The format of $NetInfo seems the same as in the 2.01 - the upload portion is just blank on account of it being removed.

Has anyone else noticed the redefinition of the O: tag? It seems to be open slots. However, it's not broadcast very often (as watched through the NMDH window).

Locked