PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: NightLitch on 23 August, 2004, 21:24:50

Title: ->-> The Ultimate Client Checker <-<-
Post by: NightLitch on 23 August, 2004, 21:24:50
Here only the client check part from THoR 2.0 ThunderRage, think this is the first best client checker released ( Official ) source code... Enjoy!

-------------------------------------------------------------------------------
-- The Ultimated Client-Checker Around I think that will be Official
-------------------------------------------------------------------------------
-- Ripped from THoR 2.0 ThunderRage
-------------------------------------------------------------------------------
-- Only Client Check Part, If u want Slots, Hubs, Bandwidth etc.
-- U need to do it yourself for now...
-------------------------------------------------------------------------------
-- By: NightLitch
-------------------------------------------------------------------------------
BotName = "-Client-Check-"
-------------------------------------------------------------------------------
KB = 1024
MB = KB*KB
GB = KB*KB*KB
TB = KB*KB*KB*KB
-------------------------------------------------------------------------------
--// User Settings
-------------------------------------------------------------------------------
USER_CHECK_CLIENT = 1
-------------------------------------------------------------------------------
--// Registered User Settings
-------------------------------------------------------------------------------
REG_CHECK_CLIENT = 1
-------------------------------------------------------------------------------
--// VIP User Settings
-------------------------------------------------------------------------------
VIP_CHECK_CLIENT = 1
-------------------------------------------------------------------------------
--// Operator Settings
-------------------------------------------------------------------------------
OPR_CHECK_CLIENT = 1
-------------------------------------------------------------------------------
--// Administrator Settings
-------------------------------------------------------------------------------
ADM_CHECK_CLIENT = 1
-------------------------------------------------
-- Connection Speed Check --
-------------------------------------------------
Allow_28 = 0
Allow_33 = 0
Allow_56 = 0
Allow_ISDN = 0
Allow_DSL = 1
Allow_Cable = 1
Allow_LANT1 = 1
Allow_LANT3 = 1
Allow_Sat = 0
-------------------------------------------------
-- Allow Client --
-------------------------------------------------
-- DC++
AllowDCPP = 1
VerDCPP = "0.301"
-- ODC
AllowODC = 1
VerODC = "5.0"
-- DC:PRO
AllowDCPRO = 1
VerDCPRO = "0.2.2.10"
-- DCGUI
AllowDCGUI = 1
VerDCGUI = "0.2.20"
--DCTC
AllowDCTC = 1
VerDCTC = "0"
-- NMDC2
AllowNMDC2 = 1
VerNMDC2 = "2.02"
-- Strong DC++
AllowSDC = 1
VERSDC = "1.00"
-- iDC++
AllowIDC = 1
VerIDC = "1.03"
-- MS++
AllowMSPP = 1
VerMSPP = "0"
-- DCDM++
AllowDCDM = 1
VerDCDM = "2.8"
-- Phantom DC++
AllowPHMDC = 1
VerPHMDC = "0.301"
--BCDC++
AllowBCDC = 1
VerBCDC = "0.305"
-- CZDC++
AllowCZDC = 1
VerCZDC = "0.303"
-- RMDC++
AllowRMDC = 1
VerRMDC = "0.305"
-- DC@fe++
AllowDCAFE = 1
VerDCAFE = "0.400"
-- DC++ DCDM
AllowDCDCDM = 1
VerDCDCDM = "0.030"
-- zY++
AllowZYPP = 1
VerZYPP = "1.00"
-- xR++
AllowXRPP = 1
VerXRPP = "0.10"
-------------------------------------------------
-- Profile Setup --
-------------------------------------------------
Profiles = {
[-1] = 1, -- regular user
[3] = 2, -- registered user
[2] = 3,  -- vip user
[1] = 4, -- operator
[0] = 5, -- master/admin
}
-- Setting up the profile checkings numbers is the number from the SET table, then just add your profile Slot, Hub... here
Checks = {
[1] = {[1] = USER_CHECK_CLIENT},
[2] = {[1] = REG_CHECK_CLIENT},
[3] = {[1] = VIP_CHECK_CLIENT},
[4] = {[1] = OPR_CHECK_CLIENT},
[5] = {[1] = ADM_CHECK_CLIENT},
}

-------------------------------------------------
-------------------------------------------------
-- SCRIPT STARTS HERE --
-------------------------------------------------
-------------------------------------------------
UNIT = {[KB] = "Kb",[MB] = "Mb",[GB] = "Gb",[TB] = "Tb"}
Client = {
{"<++",AllowDCPP,VerDCPP, "DC++"},
{"{"{"{"{"{"{"{"{"{"{"<.P>",AllowPHMDC, VerPHMDC, "Phantom DC++"},
{"{"DC@fe++",AllowDCAFE,VerDCAFE, "DC@fe++"},
{"{"{"}
OtherClients = {
["Bear Claw DC++"]={AllowBCDC,VerBCDC},
["CZDC++"]={AllowCZDC,VerCZDC},
}
SPEED = {
["28.8Kbps"] = Allow_28,
["33.6Kbps"] = Allow_33,
["56Kbps"] = Allow_56,
["ISDN"] = Allow_ISDN,
["DSL"] = Allow_DSL,
["Cable"] = Allow_Cable,
["LAN(T1)"] = Allow_LANT1,
["LAN(T3)"] = Allow_LANT3,
["Satellite"] = Allow_Sat,
}

function DataArrival(sUser,sData)
if (strsub(sData,1,7) == "$MyINFO") then
Tag,Speed,Share = ParseMyInfo(sData)
ClientCheck(Tag["C"],Tag["V"],sUser)
end
end

function ProfileCheck(sUser)
return Profiles[sUser.iProfile]
end

function ParseMyInfo(MyINFO)
hubs = 0
local s,e,Descr,Tag,Speed,Share = strfind(MyINFO, "^%$MyINFO %$ALL [^ ]+ ([^$]*)(%b<>)%$ $([^$]*)[^$]%$[^$]*%$%s*(%d*)%$")
Tag = Tag or ""
Descr = Descr or ""
if Speed==nil or Share==nil then _,_,Speed,Share = strfind(MyINFO, "%$ $([^$]*)[^$]%$[^$]*%$%s*(%d*)%$") end
local _,_,xTag = strfind(Descr, "(%b<>)")
xTag = xTag or ""
Descr = gsub(Descr, xTag, "")
local Tag = xTag..Tag
local _,_,xC,xV,C,V,M,H,S,B = strfind(Tag, "<*(%A*%a*)%s*([%.%d]*)>*<(%S*)%s*V:([%.%d]*)%s*%S*,M:([5SAP]),H:([%d%/]*),S:([%d%*]*),*[BLUF]*:*([%.%d*]*)%S*>$")
if S=="" or M =="" or H==nil or V =="" or C=="" then C = "Tag Error" V = "0" M = "P" H = 0 S = 0 end
if tonumber(H) == nil then gsub(H, "(%d+)", function (num) hubs = hubs +tonumber(num) end) else hubs = tonumber(H) end
local ClientCheck, ClientMinVer = 0,"0"
sClt,sChk,sMiV = cTag(C)
if sClt == nil then C = "Fake Client" else C = sClt ClientCheck = sChk ClientMinVer = sMiV end
if xC~="" then
dClt,dChk,dMiV = cTag(xC)
if dClt~=nil and C ~= "Fake Client" then
C = dClt
if xV~="" then V = xV end
ClientCheck = dChk
ClientMinVer = dMiV
else
C = "Invalid Double Tag"
ClientCheck = 0
ClientMinVer = 0
end
end
if strfind(Tag, "V:%a+") then C = "Fake Clients / NoTag Clients" V = "0" ClientCheck, ClientMinVer = 0,"0" end
if C=="DCGUI" and tonumber(B) then B = B * S end
if strfind(Tag, "L:") then
if C~="Strong DC++" then C = "CZDC++" ClientCheck = OtherClients[C][1] ClientMinVer = OtherClients[C][2] end
elseif strfind(Tag, "B:") then
if C ~= "rmDC++" and C~="Phantom DC++" then C = "Bear Claw DC++" ClientCheck = OtherClients[C][1] ClientMinVer = OtherClients[C][2] end
end
if B =="" then B = "Unlimited" end
MODE = {["5"] = "Socket5", ["A"] = "Active", ["P"] = "Passive",["S"] = "Socket"}
_TAG = {["C"] = {C,ClientCheck,ClientMinVer},["V"] = V, ["M"] = tostring(MODE[M]), ["H"] = hubs, ["S"] = S, ["B"] = B,["T"] = Tag,["D"] = Descr}
return _TAG,Speed,Share
end

function cTag(tag)
local clt,chk,minv = nil,nil,nil,nil
for i=1,getn(Client) do
Client[i][1] = gsub(Client[i][1], "<" , "")
if tag == Client[i][1] then
chk = Client[i][2]
minv = Client[i][3]
clt = Client[i][4]
end
end
return clt,chk,minv
end

function ClientCheck(sClient,sVersion,sUser)
if Checks[Profiles[sUser.iProfile]][1]==1 then
if sClient[2] == 1 then
if sVersion < sClient[3] then
SendPmToNick(sUser.sName,BotName, "You are using "..sClient[1].." version ( "..sVersion.." )")
SendPmToNick(sUser.sName,BotName, "The oldest "..sClient[1].." version allowed is ( "..sClient[3].." ), you may download the latest "..sClient[1].." at [URL]http://www.dslreports.com/faq/6513[/URL]")
sUser:Disconnect()
return 0
end
return 1
else
SendPmToNick(sUser.sName,BotName, sClient[1].." is not allowed here!!")
sUser:Disconnect()
return 0
end
end

return 1
end

If your gonna use this for your own coding make sure to set my name of this source...!

Best Regards / NightLitch
Title:
Post by: BottledHate on 23 August, 2004, 21:59:11
oooooooo that looks nice :) i'll be able to use this for sure!
Title:
Post by: witch on 23 August, 2004, 22:12:19
Thanx NightLitch...grate script!
Just one think i woundering about.....is it resenble to use it if i use RC?

thanx  :))
Title: ok
Post by: Peura on 24 August, 2004, 07:32:53
This it is.... THX
Title:
Post by: witch on 24 August, 2004, 12:24:00
Syntax error: attempt to index global `Check' (a nil value)
stack traceback:
   1:  function `ClientCheck' at line 467 [file `D:\PtokaX\NEW\scripts\ClientCheck.lua']
   2:  function `DataArrival' at line 339 [file `D:\PtokaX\NEW\scripts\ClientCheck.lua']

thanx in advince  :))
Title:
Post by: NightLitch on 24 August, 2004, 14:30:28
Error should be fixed...

And DO remember if u add more profiles to add them in the script to....

Cheers / NightLitch
Title:
Post by: ((UKSN))shad_dow on 24 August, 2004, 19:16:14
Syntax error: attempt to index a nil value
stack traceback:
   1:  function `ClientCheck' at line 233 [file `...\Ptokax0.330.b15.25.dbg\scripts\clientcheck.lua']
   2:  function `DataArrival' at line 169 [file `...\Ptokax0.330.b15.25.dbg\scripts\clientcheck.lua']

sorry NL , now getting this error from the code Above , have not added any more Profiles , just tryed it stright

yours

shad
Title:
Post by: NightLitch on 24 August, 2004, 23:35:03
Just noticed the bug and it is fixed... I really hope it works now... It is thought a fast Rip so... hehe

But try it now...

/NL
Title: great script
Post by: Peura on 24 August, 2004, 23:55:03
this is great script... THX
Title:
Post by: Herodes on 25 August, 2004, 00:27:53
Could you also add zDC++ to that list ;)
Title:
Post by: ((UKSN))shad_dow on 25 August, 2004, 03:13:23
cheers NL

yours

shad
Title:
Post by: witch on 25 August, 2004, 06:27:21
Thanx NL grate script  :))
Title:
Post by: [PT]CableGuy on 25 August, 2004, 12:44:29
QuoteOriginally posted by Herodes
Could you also add zDC++ to that list ;)

Could you also add PTDC v2 ? (http://www.p2p-pt.com/ptdc/) ....PLEEEEASE ?
Title:
Post by: Typhoon on 25 August, 2004, 13:34:14
QuoteOriginally posted by [PT]CableGuy
QuoteOriginally posted by Herodes
Could you also add zDC++ to that list ;)

Could you also add PTDC v2 ? (http://www.p2p-pt.com/ptdc/) ....PLEEEEASE ?


-- ptDC++
AllowPTDC = 1
VerPTDC = 2.0

{"


this should do it just fine..

? Your Status at this hub is : Guest
? Your IP is : 127.0.0.1
? You are using : ptDC.  Version : 2.0
? You are in : Active mode
? You are in : 1 hub(s)
? You have : 1 slot(s) open
? You have bandwidth limiter set to : Unlimited kB/s
? Your connection speed is : DSL
? You share : 15.75 GigaByte
? Your current Tag is : <++ V:0.305,M:A,H:1/0/0,S:1>

enjoy ..

*** Typhoon?
Title:
Post by: NightLitch on 25 August, 2004, 23:47:39
QuoteOriginally posted by Herodes
Could you also add zDC++ to that list ;)

Well first off all the double tag doesn't have inside <>, the second, I jsut tried the client, and I did NOT like it, damn that client did like 10 attempts to outcoming to several IP's I don't know and almost the same amount of incoming that I did NOT like...

so until that client gets then Am not gonna add it...

sorry Herodes...

/NL
Title:
Post by: Madman on 18 October, 2004, 16:49:38
i'm getting the error

Syntax error: table index is nil
stack traceback:
   1:  function `ClientCheck' at line 233 [file `...rogram\Ptokax\scripts\Ultimate Client Check.lua']
   2:  function `DataArrival' at line 169 [file `...rogram\Ptokax\scripts\Ultimate Client Check.lua']


i havent changed anything.....
Title:
Post by: Herodes on 18 October, 2004, 17:56:28
Nightlitch :   Would this (http://board.univ-angers.fr/thread.php?threadid=2332&boardid=4&page=2#39) helpat all  ?
Title:
Post by: Madman on 18 October, 2004, 18:20:27
lol! i found my error....

It was the fact i DIDNT change anything...
I use RoboCop so when my Netfounder logged in, he made the error...

Here are the code for those who run RC
Mod/netfounder has the same settings as Masters...

-------------------------------------------------
-- Profile Setup --
-------------------------------------------------
Profiles = {
[-1] = 1, -- regular user
[3] = 2, -- registered user
[2] = 3,  -- vip user
[1] = 4, -- operator
[0] = 5, -- master/admin
[4] = 6,   -- Moderator
[5] = 7,   -- NetFounder

}
-- Setting up the profile checkings numbers is the number from the SET table, then just add your profile Slot, Hub... here
Checks = {
[1] = {[1] = USER_CHECK_CLIENT},
[2] = {[1] = REG_CHECK_CLIENT},
[3] = {[1] = VIP_CHECK_CLIENT},
[4] = {[1] = OPR_CHECK_CLIENT},
[5] = {[1] = ADM_CHECK_CLIENT},
[6] = {[1] = ADM_CHECK_CLIENT},
[7] = {[1] = ADM_CHECK_CLIENT},
}

-------------------------------------------------
Title: Urgent!!! Thor!!!
Post by: Electrical_flame on 11 August, 2005, 12:37:42
Thor it's a trully great script but I have an old version! Nightlich please tell me where I can find the latest version of Thor that works with lua4!!! Help needed!!! ?(