PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: blackwings on 03 March, 2005, 21:26:27

Title: Minimum Client Version Script (LUA 5)
Post by: blackwings on 03 March, 2005, 21:26:27
After getting help from Herodes and made the script work, I decided the post this in the finshed script section.
My solution of blocking bad clients is maybe not the best, but anyone is free to improve it :) And why I didn't
use the same method to block bad clients as detecting min version, well because client like DCDM doesn't
has it's "identification" in the usual tag, but instead in the description. Anyway, here is the code = -- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED:version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked

tCl = {
["DC++"] = {"0.301","Please upgrade your client, min version for in this hub is <0.401>"},
["oDC"] = {"5.0","Please upgrade your client, min version for in this hub is <5.0>"},
["DCGUI"] = {"0.2.20","Please upgrade your client, min version for in this hub is <0.2.20>"},
["NMDC2"] = {"2.02","Please upgrade your client, min version for in this hub is <2.02>"},
["iDC"] = {"1.03", "Please upgrade your client, min version for in this hub is <1.03>"},
}

tClBad = {
{"<%.%P>","Phantom DC++","cccc"},
{"{"{"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[BL]:","BCDC++","<%.%P>"},
}

function NewUserConnected(curUser)
if not curUser.bOperator then
if curUser.bHasTag and tCl[curUser.sClient] then
if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
curUser:SendData(tCl[curUser.sClient][2])
curUser:Disconnect()
return 1
end
end
end
end


function MyINFOArrival(User , data)
if not User.bOperator then
for i=1,table.getn(tClBad) do
tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
local Client=tClBad[i][2]
User:SendData("------------------------------------------------------------------------------")
User:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
User:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
User:SendData("------------------------------------------------------------------------------")
User:Disconnect()
end
end
end
end

Title:
Post by: bastya_elvtars on 03 March, 2005, 21:33:46
This is a very nice detector, blackwings. Can i send you some more? ;)

dcpp={
[" [" ["reverseconnect.sf.net"]={"ReverseConnect","V:(0.%d+)"},
["www.RevConnect.com"]={"ReverseConnect","V:(0.%d+)"},
[" [" [" ["MS++V"]={"MS++V","V:(0.%d+)"},
[" ["zDC++"]={"zDC++","V:(0.%d+)"},
[" ["<.P>"]={".PhantomDC++","V:(0.%d+)"},
[" [" ["v%["]={"neXtDC++","V:(0.%d+)"},
["[BL]:"]={"BCDC++","V:(0.%d+)"},
["%[%d+%s*sl%]"]={"BCDC++","V:(0.%d+)"},
["%[%d+[kM]%]"]={"BCDC++","V:(0.%d+)"},
["V:%[Sasser.+"]={"Sasser","Sasser%s+(0.%d+)" }
}
Title:
Post by: blackwings on 03 March, 2005, 21:42:02
QuoteOriginally posted by bastya_elvtars
This is a very nice detector, blackwings. Can i send you some more? ;)
hmm, you want that table converted and added to my bad client block ?(
Title:
Post by: blackwings on 03 March, 2005, 23:14:12
Added a option to block DC versions 0.403-0.665(not tested, but it should work) = -- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED:version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1

tCl = {
["DC++"] = {"0.301","Please upgrade your client, min version for in this hub is <0.401>"},
["oDC"] = {"5.0","Please upgrade your client, min version for in this hub is <5.0>"},
["DCGUI"] = {"0.2.20","Please upgrade your client, min version for in this hub is <0.2.20>"},
["NMDC2"] = {"2.02","Please upgrade your client, min version for in this hub is <2.02>"},
["iDC"] = {"1.03", "Please upgrade your client, min version for in this hub is <1.03>"},
}

tClBad = {
{"<%.%P>","Phantom DC++","cccc"},
{"{"{"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[BL]:","BCDC++","<%.%P>"},
}

function NewUserConnected(curUser)
if not curUser.bOperator then
if curUser.bHasTag and tCl[curUser.sClient] then
if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
if badVer == 1
if((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
curUser:SendData(tCl[curUser.sClient][2])
curUser:Disconnect()
end
end
curUser:SendData(tCl[curUser.sClient][2])
curUser:Disconnect()
return 1
end
end
end
end


function MyINFOArrival(User , data)
if not User.bOperator then
for i=1,table.getn(tClBad) do
tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
local Client=tClBad[i][2]
User:SendData("------------------------------------------------------------------------------")
User:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
User:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
User:SendData("------------------------------------------------------------------------------")
User:Disconnect()
end
end
end
end
Title:
Post by: Madman on 04 March, 2005, 03:21:47
Really nice script =)

However, when i was testing it, i got an error (see changelog) beacuse i use StrongDC++
Since i had nothing better to do i fixed it...
also noticed that CDM was detcted as Phantom, manage to fix that as well =)

Hope u dont mind =)

-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED: version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
-- FIXED: badVer, it only checked if client version was below 401

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1

tCl = {
["DC++"] = {"0.401","Please upgrade your client, min version for in this hub is <0.401>"},
["oDC"] = {"5.0","Please upgrade your client, min version for in this hub is <5.0>"},
["DCGUI"] = {"0.2.20","Please upgrade your client, min version for in this hub is <0.2.20>"},
["NMDC2"] = {"2.02","Please upgrade your client, min version for in this hub is <2.02>"},
["iDC"] = {"1.03", "Please upgrade your client, min version for in this hub is <1.03>"},
}

tCl2 = {
["StrongDC++"] = {"1.00", "Please upgrade your client, min version for in this hub is <1.00>"}
}

tClBad = {
{"<.P>", "PhantomDC++","cccc"},
{" {" {"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[BL]:","BCDC++","<%.%P>"},
}

function NewUserConnected(curUser)
if curUser.bHasTag then
if badVer == 1 then
if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
if tCl2[curUser.sClient] then
if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
curUser:SendData(tCl2[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tCl[curUser.sClient] then
if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
curUser:SendData(tCl[curUser.sClient][2])
curUser:Disconnect()
return 1
end
end
end
end

--OpConnected = NewUserConnected --Uncomment to check op as well

function MyINFOArrival(curUser , data)
if not curUser.bOperator then
for i=1,table.getn(tClBad) do
tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
local Client=tClBad[i][2]
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
curUser:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
end
end

*edit*

And a suggestion...
DCPlusPlus = "0.401"

tCl = {
["DC++"] = {DCPlusPlus,"Please upgrade your client, min version for in this hub is " ..DCPlusPlus},
}

that way we dont need to type the version numbcer twice....
yup, i'm lazy.... ;p

*edit2*
-- FIXED: badVer, it only checked if client version was below 401
Title:
Post by: blackwings on 04 March, 2005, 04:18:41
QuoteOriginally posted by madman
Really nice script =)

However, when i was testing it, i got an error (see changelog) beacuse i use StrongDC++
Since i had nothing better to do i fixed it...
also noticed that CDM was detcted as Phantom, manage to fix that as well =)

Hope u dont mind =)

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
I don't mind you making changes :D

It's nice when people help you improve the scripts :D

About the first thing you change, I didn't see that miss :P
2nd change= doesn't it work to just type "1.0"? Or doesn't that work or is it because its user friendly?
3rd change= Why is that needed?
4th change= Heh, your right, made a little mistake in copy (I had that code in MyInfoArrival first) :)
5th change= hmm, I didn't experience that when I tested it. And shouldn't you also change this line ;) = {"[BL]:","BCDC++","<%.%P>"},
QuoteOriginally posted by madman
And a suggestion...
DCPlusPlus = "0.401"

tCl = {
["DC++"] = {DCPlusPlus,"Please upgrade your client, min version for in this hub is " ..DCPlusPlus},
}

that way we dont need to type the version numbcer twice....
yup, i'm lazy.... ;p
well, thats extra code :P, but you can make the change if you want to :)
Title:
Post by: Madman on 04 March, 2005, 04:49:23
QuoteOriginally posted by blackwings
QuoteOriginally posted by madman
-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
I don't mind you making changes :D

It's nice when people help you improve the scripts :D

About the first thing you change, there is no "then" missing, I checked.
2nd change= doesn't it work to just type "1.0"? Or doesn't that work or is it because its user friendly?
3rd change= Why is that needed?
4th change= Heh, your right, made a little mistake in copy (I had that code in MyInfoArrival first)
5th change= hmm, I didn't experience that when I tested it. And shouldn't you also change this line = {"[BL]:","BCDC++","<%.%P>"},

1st change: look again ;)
Yours...
if badVer == 1
if((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
curUser:SendData(tCl[curUser.sClient][2])
curUser:Disconnect()
end
end

Mine...
if badVer == 1 then
if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
see the badVer line? =)
2nd change: if i write 1.00 in your table i get
attempt to compare number with nil
thats beacuse the entire version is 1.00 RC9
so, beacuse of the RC we cant have tonumber, ther for i added tCl2
3rd change: maybe it wasent.. but i thougt it was better to have same "user" in the whole script =)
5th change: weird... well atlest it works...
as for the bcdc part... it seems to work as it is....

as for my sugestion... maybe... if i'm not to lazy ;)
Title:
Post by: Madman on 04 March, 2005, 16:42:47
i relly need something else to do in my spare time... ;p

-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED: version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
-- FIXED: badVer, it only checked if client version was below 401

-- FIXED: StrongDC++ giving error on badVer check
-- CHANGED: BCDC stuff =)
-- ADDED: Table to block unwanted clients
-- UPDATED: Minver for strongdc is now 1.00 RC5, 1.00 RC5 = 0.401

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1

tCl = {
["DC++"] = { "0.401" , "Please upgrade your client, min version for in this hub is <0.401>" },
["oDC"] = { "5.0" , "Please upgrade your client, min version for in this hub is <5.0>" },
["DCGUI"] = { "0.2.20" , "Please upgrade your client, min version for in this hub is <0.2.20>" },
["NMDC2"] = { "2.02" , "Please upgrade your client, min version for in this hub is <2.02>" },
["iDC"] = { "1.03" , "Please upgrade your client, min version for in this hub is <1.03>" },
}

tCl2 = {
["StrongDC++"] = { "1.00 RC5" , "Please upgrade your client, min version for in this hub is <1.00 RC5>" }
}

tClBad = {
{"<.P>", "PhantomDC++","cccc"},
{" {" {"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[BL]:","BCDC++","<.P>"},
}

tClBad2 = {
["Client"] = { "Your client isn't allowed in this hub" },
}

function NewUserConnected(curUser)
if curUser.bHasTag then
if badVer == 1 then
if curUser.sClient == "StrongDC++" then
if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
else
if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
end
if tCl2[curUser.sClient] then
if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
curUser:SendData(tCl2[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tCl[curUser.sClient] then
if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
curUser:SendData(tCl[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tClBad2[curUser.sClient] then
curUser:SendData(tClBad2[curUser.sClient][1])
curUser:Disconnect()
return 1
end
end
end

--OpConnected = NewUserConnected --Uncomment to check op as well

function MyINFOArrival(curUser , data)
if not curUser.bOperator then
for i=1,table.getn(tClBad) do
tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
local Client=tClBad[i][2]
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
curUser:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
end
end
Title:
Post by: Herodes on 04 March, 2005, 17:14:26
You ppl have been scripting this baby nicely keep it up...

Good to watch it grow pps ;)
Title:
Post by: Honey on 20 July, 2005, 11:07:19
Hi guys,


Can anybode help me with this, please?

How can I edit this script, more accurately this line: if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then
So if I want connect into my hub with StrongDC++ 1.00 RC10 cvs120 (Tag:

Thank you in advance for help!
Title:
Post by: Madman on 20 July, 2005, 16:34:07
QuoteOriginally posted by Honey
Hi guys,


Can anybode help me with this, please?

How can I edit this script, more accurately this line: if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then
So if I want connect into my hub with StrongDC++ 1.00 RC10 cvs120 (Tag:

Thank you in advance for help!

You dont need to change any line to allow RC10 to enter...

If you want to have RC 10 as min version change RC5 to RC10 in this line

["StrongDC++"] = { "1.00 RC5" , "Please upgrade your client, min version for in this hub is <1.00 RC5>" }
Title:
Post by: Honey on 21 July, 2005, 10:46:23
QuoteOriginally posted by madman
You dont need to change any line to allow RC10 to enter...

Hi,

Hmm I think that you are wrong, because if I set as min. version StrongDC: RC7 then users with StrongDC++ RC10 cvs xxx didn't connected in this hub.

But if I set as min. version StrongDC: RC10 then users with StrongDC++ RC10 cvs xxx connect in this hub.

So I want set as min. version: StrongDC++ RC7 and I want that users with StrongDC++ RC10 cvs xxx connect in this hub too.

It is possible to edit this script?

THX in advance!
Title:
Post by: Madman on 21 July, 2005, 18:48:51
-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED: version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
-- FIXED: badVer, it only checked if client version was below 401

-- FIXED: StrongDC++ giving error on badVer check
-- CHANGED: BCDC stuff =)
-- ADDED: Table to block unwanted clients
-- UPDATED: Minver for strongdc is now 1.00 RC5, 1.00 RC5 = 0.401

-- ADDED: Kill/Allow StrongDC++ 1.00 RC10 (Request by Honey)

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1
KillStrong10 = nil -- 1 for disconnect, nil for allow

tCl = {
["DC++"] = { "0.401" , "Please upgrade your client, min version for in this hub is <0.401>" },
["oDC"] = { "5.0" , "Please upgrade your client, min version for in this hub is <5.0>" },
["DCGUI"] = { "0.2.20" , "Please upgrade your client, min version for in this hub is <0.2.20>" },
["iDC"] = { "1.03" , "Please upgrade your client, min version for in this hub is <1.03>" },
}

tCl2 = {
["StrongDC++"] = { "1.00 RC5" , "Please upgrade your client, min version for in this hub is <1.00 RC5>" }
}

tClBad = {
{"<.P>", "PhantomDC++","cccc"},
{" {" {"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[B]:","BCDC++","<.P>"},
}

tClBad2 = {
["Client"] = { "Your client isn't allowed in this hub" },
["NMDC2"] = { "Your client isn't allowed in this hub" },
}

function NewUserConnected(curUser)
if curUser.bHasTag then
if badVer == 1 then
if curUser.sClient == "StrongDC++" then
if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
else
if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
end
if curUser.sClient == "StrongDC++" then
if string.find(curUser.sClientVersion, "1.00 RC10") then
if KillStrong10 then
curUser:SendData("StrongDC++ 1.00 RC10 is not wanted here")
curUser:Disconnect()
else
return 1
end
end
end
if tCl2[curUser.sClient] then
if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
curUser:SendData(tCl2[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tCl[curUser.sClient] then
if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
curUser:SendData(tCl[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tClBad2[curUser.sClient] then
curUser:SendData(tClBad2[curUser.sClient][1])
curUser:Disconnect()
return 1
end
end
end

OpConnected = NewUserConnected --Uncomment to check op as well

function MyINFOArrival(curUser, data)
if not curUser.bOperator then
for i=1,table.getn(tClBad) do
tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
local Client=tClBad[i][2]
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
curUser:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
end
end

This should work... =)
Title:
Post by: Honey on 22 July, 2005, 10:57:13
QuoteOriginally posted by madman
This should work... =)

Yes, It's OK at now! :D
Thank you very much Madman!  :)
Title:
Post by: Madman on 22 July, 2005, 13:39:06
np... =)
Title:
Post by: chettedeboeuf on 22 July, 2005, 18:06:56
Thank you Madman

Is it possible to have a report of the kicked client to only one nick (me)

ex : was kicked for using

Thank you
Title:
Post by: Madman on 22 July, 2005, 22:20:18
-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED: version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
-- FIXED: badVer, it only checked if client version was below 401

-- FIXED: StrongDC++ giving error on badVer check
-- CHANGED: BCDC stuff =)
-- ADDED: Table to block unwanted clients
-- UPDATED: Minver for strongdc is now 1.00 RC5, 1.00 RC5 = 0.401

-- ADDED: Kill/Allow StrongDC++ 1.00 RC10 (Request by Honey)
-- ADDED: PM to hubowner (request by chettedeboeuf)

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1
KillStrong10 = nil -- 1 for disconnect, nil for allow
HubOwner = "chettedeboeuf"

tCl = {
["DC++"] = { "0.401" , "Please upgrade your client, min version for in this hub is <0.401>" },
["oDC"] = { "5.0" , "Please upgrade your client, min version for in this hub is <5.0>" },
["DCGUI"] = { "0.2.20" , "Please upgrade your client, min version for in this hub is <0.2.20>" },
["iDC"] = { "1.03" , "Please upgrade your client, min version for in this hub is <1.03>" },
}

tCl2 = {
["StrongDC++"] = { "1.00 RC5" , "Please upgrade your client, min version for in this hub is <1.00 RC5>" }
}

tClBad = {
{"<.P>", "PhantomDC++","cccc"},
{" {" {"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[B]:","BCDC++","<.P>"},
}

tClBad2 = {
["Client"] = { "Your client isn't allowed in this hub" },
["NMDC2"] = { "Your client isn't allowed in this hub" },
}

function NewUserConnected(curUser)
if curUser.bHasTag then
if badVer == 1 then
if curUser.sClient == "StrongDC++" then
if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
else
if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
end
if curUser.sClient == "StrongDC++" then
if string.find(curUser.sClientVersion, "1.00 RC10") then
if KillStrong10 then
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
curUser:SendData("StrongDC++ 1.00 RC10 is not wanted here")
curUser:Disconnect()
else
return 1
end
end
end
if tCl2[curUser.sClient] then
if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
curUser:SendData(tCl2[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tCl[curUser.sClient] then
if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
curUser:SendData(tCl[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tClBad2[curUser.sClient] then
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
curUser:SendData(tClBad2[curUser.sClient][1])
curUser:Disconnect()
return 1
end
end
end

OpConnected = NewUserConnected --Uncomment to check op as well

function MyINFOArrival(curUser, data)
if not curUser.bOperator then
for i=1,table.getn(tClBad) do
tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
local Client=tClBad[i][2]
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
curUser:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
end
end

Done... it now notify one every thing... if you dont want some pm...  
add 2 - to this line SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion..)

This
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
to this
--SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
Title:
Post by: chettedeboeuf on 23 July, 2005, 01:43:21
Thank you
Title:
Post by: chettedeboeuf on 23 July, 2005, 02:01:32
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion.. )

should I replace by

SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)

??
Title:
Post by: Madman on 23 July, 2005, 02:23:32
Heh.. yes... remove the last 2 dots.. Or just Copy the script again..

Made the script to fast.. ;p

And if you dont want pm's add 2 - lines infront of the SendPmToNick lines...
That will make it comment... so it wi'll stop bug you...
Title:
Post by: chettedeboeuf on 23 July, 2005, 02:29:27
Thank you Madman
Title: Yo
Post by: lyte on 02 August, 2005, 12:38:00
Hello dude,
may u change this script to allow only ppl with BCDC++ 0.674
can join the hub, ppl with other clients cant join :) and checks all without master.
I hope wont be problem for U :)
U da man!
Title:
Post by: Madman on 02 August, 2005, 17:47:37
There's a problem...
Only way to detect bcdc is if the user has the limter on...
so.. if i make the script... it will block all users, untill they turn on there Limter..

Then the script can see bcdc.. so if you still want the script... i'll make an new one and include a check for minimum limting...
But that means.. all your users are going to have limter on there upload...
Title: woha
Post by: lyte on 02 August, 2005, 18:33:53
U da man! sure i want it
only bcdc++ users can join and with max upload 50kB thats all checkin without master
"this hub will run in local network thats way only this clinet wif that speed other way speed will kill this network"
I will be so grateful for this script
so make it, u da pwnz0r :))
Title:
Post by: Madman on 02 August, 2005, 18:49:16
BCDC++ Only (http://board.univ-angers.fr/thread.php?threadid=5092&boardid=26&styleid=1&sid=3ccea55998141514eac164973a2c7d70)

There you go =)