PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Jerry on 30 April, 2005, 15:49:03

Title: Please, help me
Post by: Jerry on 30 April, 2005, 15:49:03
Hi ppl,

what is wrong in this part of script?

["DC++"] = {"0.668",  Bot, "Please upgrade your client minimum allowed version is: <0.668>"},

This part doesn't work :(

Please help me!
Title:
Post by: ConejoDelMal on 30 April, 2005, 15:50:42
if you dont post the entire script, i doubt someone can help you
Title:
Post by: Jerry on 30 April, 2005, 16:08:17
It's blackwings's Basic 4.5:

-- BASIC v.4.5 LUA 5
-- Made by: blackwings
---------------------------------------------------------------------
--Functions:
----Minimum & Maximum slots check
----Minimum & Maximum share check
----Client checker (with bad version block) - thanx Herodes
----Dynamic anti-advertise (including many sign detect, not just ".")
----Safe Advertisment
----Disconnect?on of unknown clients
----Bad prefix check on username
----Anti-MLDC
----rmDC++ blocking
----Anti-External Search (aka MoGLO etc)
----BotINFO fucntion
----Redirection of disconnected clients
---------
---- (30/04-05) Tested on 17.03
--CHANGED: I optimized the Anti-MLDC.
--CHANGED: I optimized the BotINFO function
--ADDED: a on/off for RMDC blocking
--REMOVED: Bad Version function
--FIXED: the advertise function works to 100% :D
--CHANGED: Optimize the safe-advertise check a bit.
--ADDED: web url detection so it won't mistake those for advertisement.
---------------------------------------------------------------------
-- START OF CONFIGURATION -------------------------------------------
---------------------------------------------------------------------
Bot = "Police"
-- Put on this table all the prefix and nick you want to block
arrBadNick = {
"[OP]","(op)","[operator]","(operator)","[admin]","(admin)","[su]","(su)","[master]",
"(master)","[moderator]","(moderator)","[adm]","(adm)","[administrator]","(administrator)",
"[fc]","(fc)","%","^"
}
---------------------------------------------------------------------
---#START OF SLOT/SHARE CONFIGURATION#-------------------------------
-- Follow this pattern => ["Profile"] = {minSlot,maxSlot,minShare*GB,maxShare*TB},
-- if maxShare = 0, then maxShare check is disabled
bSetting = {
[0] = {1,30,0,2},
[1] = {1,30,0,2},
[2] = {5,30,50,2},
[3] = {3,30,12,2},
[-1] = {1,30,2,2},
}

-- **Choose what unit the share check should be on at line(s) 146&147

-- **if you change the unit, remeber the change it in the messages on line(s) 158&161

---#END OF SLOT/SHARE CONFIGURATION#---------------------------------
---------------------------------------------------------------------
---#START OF CLIENT CHECKER CONFIGURATION#---------------------------

-- Type 1 if unknown clients should be redirected instead of disconnected.

Clredrect = 0

-- Type the adresses which disconnected clients from tCl and tCl2 should be sent to

RedirectTo = "hub.dyndns.org"

-- If RMDC should be blocked, choose 1 or choose 0 if it should be allowed

-- (only ops can use RMDC if you choose to allow RMDC)

BlockRMDC = 1

-- Allowed clients, min version and message.

-- Type -- to the far left on the line for the client that shouldn't be allowed.
------
tCl = {

["DC++"] = {"0.401","*** Please upgrade your client, min version for in this hub is <0.401>"},

["zDC++"] = {"0.401","*** Please upgrade your client, min version for in this hub is <0.401>"},

["[BL]:"] = {"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>"},

}
-- Allowed clients, min version and message (for clients that has like 00, like 1.00).

-- Type -- to the far left on the line for the client that shouldn't be allowed.

tCl2 = {

["StrongDC++"] = {"1.00","Please upgrade your client, min version for in this hub is <1.00>"}
}
--Clients that should be blocked
------
tClBad = {

{"<.P>", "PhantomDC++","cccc"},

{"
{"
{"reverseconnect.sf.net","ReverseConnect","cccc"},

{"www.RevConnect.com","ReverseConnect","cccc"},

{"[BL]:","BCDC++","<.P>"},

}

---#END OF CLIENT CHECKER CONFIGURATION#-----------------------------

---------------------------------------------------------------------

---#START OF ANTI-ADVETISE CONFIGURATION#----------------------------

-- How many times a user gets tempbanned before getting a permban

adverKill = 3

-- Type 1 if the "kill" messages should be shown to everyone in main chat

ShowAllinMain = 0

-- Put the whole adress of adresses that should be safe.

nosafeAdver={

"safe1.no-ip.com",

"safe2.no-ip.com",

"safe3.no-ip.com",

}

DNS01={

"no-ip","mine","zapto","ath","homeip","gotdns","kicks-ass","dyndns","myftp","serveftp",

"dnsalias","dynalias","hopto","staticip","orgdns","myftpsite","homeunix","homelinux","dns2go",

"is-a-geek","isa-geek","bounceme","dynip","d2g","sytes","servehttp","servehalflife","servequake",

"servecounterstrike","xs4all","servebeer","tropico","lysekil","udgnet","servemp3","servegame",

"ipactive","idlegames","flamenap","clanpimp","ip","uni","depecheconnect","unusualperson","ciscofreak",

"deftonzs","point2this","stufftoread","dynu","darkdata","ipme","e-net","newgnr","bst","bsd","ods",

"x-host","myvnc","kyed","lir","finx","sheckie","vizvaz","nerdcamp","cicileu","3utilities",

"redirectme","serveirc","servepics","damnserver","ditchyourip","dnsiskinky","geekgalaxy",

"net-freaks","securityexploits","securitytactics","servehumour","servep2p","servesarcasm",

"workisboring"

}

DNS02={"com","net","org","nu","se","cx","us","it","co.uk","info","biz","cc","de","tv","nl","dk","lv"}

--###################################################################

-- END OF CONFIGURATION ---------------------------------------------

--###################################################################

adverCounter = 0

KB = 1024

MB = 1048576

GB = 1073741824

TB = 1099511627776

function MyINFOArrival(user,data)

if bSetting[user.iProfile] then

local minSlot = bSetting[user.iProfile][1]

local maxSlot = bSetting[user.iProfile][2]

local minShare = bSetting[user.iProfile][3]*GB

local maxShare = bSetting[user.iProfile][4]*TB

local minNr1 = bSetting[user.iProfile][3]

local minNr2 = bSetting[user.iProfile][4]

if user.iSlots < minSlot then

user:SendData(Bot, "You MUST have minimum "..minSlot.." slots open in this hub!!!")

user:Disconnect()

elseif user.iSlots > maxSlot then

user:SendData(Bot, "Maximum allowed open slots is <"..maxSlot..">!!!")

user:Disconnect()

end

if user.iShareSize < minShare then

user:SendData(Bot, "The minimum share is "..minNr1.." GB in this hub!!")

user:Disconnect()

elseif user.iShareSize > maxShare and maxShare ~= 0 then

user:SendData(Bot, "The maximum share is "..minNr2.." TB in this hub!!")

user:Disconnect()

end

end

if not user.bRegistered then

for h=1, table.getn(arrBadNick) do

if (string.len(user.sName) >= string.len(arrBadNick[h])) then

if (string.sub(string.lower(user.sName),1,string.len(arrBadNick[h])) == string.lower(arrBadNick[h])) then

user:SendData(Bot,"Remove this from you username = "..arrBadNick[h])

user:Disconnect()

end

end

end

end

if user.bRegistered==nil then

if string.find(user.sDescription,"mld(%S+)") or string.find(user.sDescription,"edonk(%S+)") then

user:Disconnect()

return 1

end

end

if not user.bOperator then

for i=1,table.getn(tClBad) do

tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")

if string.find(user.sDescription,tClBad[i][1]) and not string.find(user.sDescription,tClBad[i][3]) then

local Client=tClBad[i][2]
user:SendData(Bot,"------------------------------------------------------------------------------")

user:SendData(Bot,"*** The Client <"..Client.."> isn't allowed in this hub.")

user:SendData(Bot,"*** Use Original DC++, NMDC, oDC or DCGUI")

user:SendData(Bot,"------------------------------------------------------------------------------")

user:Disconnect()

end

end

end

end

function SupportsArrival(curUser, sData)

if BlockRMDC == 1 then

if not curUser.bOperator then

if string.sub(sData, 10, 11) == "  " then

curUser:SendData(Bot,"Buggy client, go away!")

curUser:Disconnect()

return 1

end

end

end

end

function NewUserConnected(curUser)

if curUser.bHasTag then

if 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 tCl2[curUser.sClient] then

if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then

curUser:SendData(tCl2[curUser.sClient][2])

curUser:Disconnect()

return 1

end

else

if Clredrect == 1 then

curUser:SendData(Bot, "Because of unknow client, you're redirected to: "..RedirectTo.."|$ForceMove "..RedirectTo.."|")

end

curUser:Disconnect()

end

end

end

function adverSmashing(user)

if not user.bOperator then

adverCounter = adverCounter + 1

tmpBanLeft = adverKill - adverCounter

if adverCounter < adverKill then

user:SendPM(Bot, "You are tempbanned because of advertiseing.")

user:SendPM(Bot, "Number of tempban before permban = "..tmpBanLeft)

user:TempBan()

SendPmToOps(Bot, "User <"..user.sName.."> was tempbanned for advertising, wrote = "..advDetect)

if ShowAllinMain == 1 then

SendToAll(Bot, "User <"..user.sName.."> was tempbanned for advertising")

end

elseif adverCounter == adverKill and adverKill ~= 0 then

user:SendData(Bot, "You are PERMBANNED because of advertiseing")

user:Ban()

SendPmToOps(Bot, "User <"..user.sName.."> was PERMBANNED for advertising, wrote = "..advDetect)

if ShowAllinMain == 1 then

SendToAll(Bot, "User <"..user.sName.."> was PERMBANNED for advertising")

adverCounter = 0

end

adverCounter = 0

end

end

end

function ChatArrival(user,data)

local adverFind = "%p[^%.]+%p%S+"

local s,e,webSafe1 = string.find(data, "%b<>%s(.*)[URL]http://[/URL]([^%.]*%.*[^%.]+%.%S+)(.*)$")

local s,e,webSafe2 = string.find(data, "%b<>%s(.*)www(%.[^%.]+%.%S+)(.*)$")

if adverFind and not(webSafe1 or webSafe2) then

return detectAdver(user,data)

end

end

function ToArrival(user,data)

local adverFind = "%p[^%.]+%p%S+"

local s,e,webSafe1 = string.find(data, "%b<>%s(.*)[URL]http://[/URL]([^%.]*%.*[^%.]+%.%S+)(.*)$")

local s,e,webSafe2 = string.find(data, "%b<>%s(.*)www(%.[^%.]+%.%S+)(.*)$")

if adverFind and not(webSafe1 or webSafe2) then

return detectAdver(user,data)

end

end

function detectAdver(user,data)

local MSigns={".","_","-","+","?","&","*","=","!","#","|","?","?","?","?","@","$","%","^"}

for key8, value8 in MSigns do

tSigns = string.lower(value8)

for key, value in DNS01 do

tPart01 = string.lower(value)

for key2, value2 in DNS02 do

tPart02 = string.lower(value2)
--
advDetect = tSigns..tPart01..tSigns..tPart02
--
if(string.find(data, advDetect,1,1))  then

local saferFind = "%p[^%.]+%p%S+"

if saferFind then

for key3, value3 in nosafeAdver do

if (string.find(data,string.lower(value3), 1, 1)) then

return nil

end

end

end

return adverSmashing(user)

end

end

end

end

end

function ValidateNickArrival(curUser, sData)

nick = string.sub(sData, 14, -2);

if string.find(string.lower(nick), "search", 1) then

curUser:SendData(Bot,"*** External Search isn't allowed in this hub. Go somewhere else! ***")

curUser:Disconnect()

return 1

end

end


function BotINFOArrival(curUser, sData)

local minshare = frmHub:GetMinShare()*1024*1024

curUser:SendData("$HubINFO "..frmHub:GetHubName().."$"..frmHub:GetHubAddress()..":"..frmHub:GetHubPort().."$"..frmHub:GetHubDescr().."$"..frmHub:GetMaxUsers().."$"..minshare.."$"..frmHub:GetMinSlots().."$"..frmHub:GetMaxHubs().."$PtokaX$")

return 1

end

But I want, change this part:    ["DC++"] = {"0.401","*** Please upgrade your client, min version for in this hub is <0.401>"}  ---> to ["DC++"] = {"0.668", Bot, "Please upgrade your client, min version for in this hub is <0.668>"}  -> but this doesn't work :(
Title:
Post by: jiten on 30 April, 2005, 16:11:56
Try this:
["DC++"] = {"0.668","*** Please upgrade your client minimum allowed version is: <0.668>"},Cheers
Title:
Post by: Jerry on 30 April, 2005, 16:17:46
QuoteOriginally posted by jiten
Try this:
["DC++"] = {"0.668","*** Please upgrade your client minimum allowed version is: <0.668>"},Cheers

Thanks!

But at the moment, write it:*** Please upgrade your client minimum allowed version is: <0.668>

so I want: *** Please upgrade your client minimum allowed version is: <0.668>    ;)
Title:
Post by: jiten on 30 April, 2005, 16:21:08
Hum, change ur NewUserConnected function to this:
function NewUserConnected(curUser)
if curUser.bHasTag then
if tCl[curUser.sClient] then
if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) 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
curUser:SendData(Bot,tCl[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tCl2[curUser.sClient] then
if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
curUser:SendData(Bot,tCl2[curUser.sClient][2])
curUser:Disconnect()
return 1
end
else
if Clredrect == 1 then
curUser:SendData(Bot, "Because of unknow client, you're redirected to: "..RedirectTo.."|$ForceMove "..RedirectTo.."|")
end
curUser:Disconnect()
end
end
end
Title:
Post by: Jerry on 30 April, 2005, 16:50:18
Thank you very much jiten!!!
It's working great at the moment!
Title:
Post by: 6Marilyn6Manson6 on 30 April, 2005, 17:07:36
QuoteOriginally posted by jiten
Hum, change ur NewUserConnected function to this:
function NewUserConnected(curUser)
if curUser.bHasTag then
if tCl[curUser.sClient] then
if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) 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
curUser:SendData(Bot,tCl[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tCl2[curUser.sClient] then
if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
curUser:SendData(Bot,tCl2[curUser.sClient][2])
curUser:Disconnect()
return 1
end
else
if Clredrect == 1 then
curUser:SendData(Bot, "Because of unknow client, you're redirected to: "..RedirectTo.."|$ForceMove "..RedirectTo.."|")
end
curUser:Disconnect()
end
end
end


I things this code is correct because version 0.4032, 0.4033 and 0.4034 exist:

function NewUserConnected(curUser)
if curUser.bHasTag then
if tCl[curUser.sClient] then
if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
if badVer == 1 then
if ((tonumber(curUser.sClientVersion) >= 0.4035) and (tonumber(curUser.sClientVersion) <= 0.665)) then
curUser:SendData("------------------------------------------------------------------------------")
curUser:SendData("Clients with version numbers 4035-665 isn't allowed in this hub.")
curUser:SendData("------------------------------------------------------------------------------")
curUser:Disconnect()
end
end
curUser:SendData(Bot,tCl[curUser.sClient][2])
curUser:Disconnect()
return 1
end
elseif tCl2[curUser.sClient] then
if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
curUser:SendData(Bot,tCl2[curUser.sClient][2])
curUser:Disconnect()
return 1
end
else
if Clredrect == 1 then
curUser:SendData(Bot, "Because of unknow client, you're redirected to: "..RedirectTo.."|$ForceMove "..RedirectTo.."|")
end
curUser:Disconnect()
end
end
end

c ya ;)