PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: [ES]latinmusic on 15 December, 2003, 12:40:02

Title: ClientChecker V: 1.0
Post by: [ES]latinmusic on 15 December, 2003, 12:40:02
-- ClientChecker by [ES]latinmusic V: 1.0
-- Thanks plop for always answer my questions and teach me a little or more than a little
-- The array "isClient" contains the list of clients who can connect to the server
-- You can add more or remove some to fit your needs
-- There are some lines not really requiered but putted inside the script because last problems with MyInfoString in the latests betas of ptokax
-- Enjoy
botName = "ClientChecker"
function NewUserConnected(curUser)
CheckClient(curUser)
end
function OpConnected(curUser)
CheckClient(curUser)
end
function CheckClient(curUser)
local Found = nil
local isClient = { " if curUser.sMyInfoString then
for i,v in isClient do
if strfind(curUser.sMyInfoString, v) then Found = 1 break end
end
if Found == nil then
curUser:SendData(botName, "You are using a forbidden client in this HUB.")
curUser:SendData(botName, "List of allowed Clients.:")
curUser:SendData(botName,"==============================================")
curUser:SendData(botName, "DC++\t-->http://dcplusplus.sourceforge.net")
curUser:SendData(botName, "oDC++\t-->http://www.gempond.com/odc/")
curUser:SendData(botName, "DCGUI\t-->http://dc.ketelhot.de/")
curUser:SendData(botName, "DC:PRO\t-->http://www.gempond.com/odc/")
curUser:SendData(botName,"==============================================")
curUser:SendData(botName, "Disconnecting.....")
curUser:Disconnect()
return 1
end
else
return 1
end
end
Title:
Post by: egm47 on 15 January, 2004, 19:34:00
I get this, and am new to it, so if someone can help

Syntax Error: `end' expected (to close `function' at line 14);
  last token read: `' at line 37 in file `C:\Program Files\PtokaX-0.326.TestDrive4\scripts\ClientChecker.lua'
Title:
Post by: pHaTTy on 15 January, 2004, 20:36:48
i wudnt have a return 1 there, change to sumit like user:Disconnect()

i think mldc will sit on conenction with return 1, *i think*
Title:
Post by: egm47 on 15 January, 2004, 20:50:03
Nope still get same error :baby:
Title:
Post by: pHaTTy on 15 January, 2004, 20:55:21
QuoteOriginally posted by egm47
Nope still get same error :baby:

lol no that was not for error that was just a little tip

and it works for me fine, make sure you dont copy code*
Title:
Post by: egm47 on 15 January, 2004, 21:28:11
Sorry, I'm really an ediot at this stuff

good news it works tho now.

thank you

Will this block Hacked DC++ clients?

Thanks again
Title:
Post by: [NL]trucker on 16 January, 2004, 09:15:05
i dont think this will blocjk hacked clients
as it only looks at the tag the clients are giving.

and as we all know hacked clients kan emulate all kinds of tags if they use the right line.
Title:
Post by: Caleblost on 16 January, 2004, 09:54:26
I'm searching for a script to kick dc++ Stealth users.
A friend of mine told me that exists only one script that ask for an inexistant file and dc stealth answer with : No slots avaiable (instead of File not avaiable) does anyone has this script?
Title: DC++ Stealth Kicker
Post by: Cp6uja on 07 June, 2004, 11:12:17
-Celeblost:"I'm searching for a script to kick dc++ Stealth users. "
+Cp6uja:"I'm searching for a script to kick dc++ Stealth users TOO "
Title:
Post by: Cp6uja on 07 June, 2004, 11:13:30
I hvae download this DC++ Stalth !!!
Title: Celeblost use this script !!!
Post by: Cp6uja on 07 June, 2004, 11:15:48
Nice script from NightLitch  :D

-- CLIENT CHECKER
--=================
-- Ver.: 0.7
-- By: NightLitch
-- Date: 2004/01/22
--=================
AllowClient = {
["++"] = "DC++",
["><"] = "oDC",
["oDC"] = "oDC",
["DC"] = "NeoModus",
["DCGUI"] = "DcGui",
["http://dc.ketelhot.de"] = "DcGui",
["DC:PRO"] = "DcPro",
}

function ParseMyInfo(MyInfo)
   local s,e,vTag = strfind( MyInfo, "^%$MyINFO %$ALL [^ ]+ [^$]*%s([^$<>]+)>%$" )
   local s,e,vSpeed,sShare = strfind( MyInfo, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $([^$]+)[^$]%$[^$]*%$%s*(%d+)%$" )
   local vShare = tonumber(sShare)
   local vShare = vShare / (1024 * 1024 * 1024)
   local vShare = format("%.2f",vShare)
   for t,n in AllowClient do
      if strfind(MyInfo,t) then
         vClient = n
      end
   end
   return vClient, vTag, vSpeed, vShare
end

function GetTagInfo(vTag)
   local _,_,DcVer = strfind(vTag, "V:(%x+.%x*)")
   local _,_,Mode = strfind(vTag, "M:([S,A,P,5])")
   local _,_,Hubs = strfind(vTag, "H:(%d+/%d+/%d+)")
   local _,_,Slots = strfind(vTag, "S:(%d+)")
   if strfind(vTag, "L:(%d+)") then
      local _,_,Ls = strfind(vTag, "L:(%d+)")
      Bwidh = Ls
   elseif strfind(vTag, "B:(%d+)") then
      local _,_,Bs = strfind(vTag, "B:(%d+)")
      Bwidh = Bs
   elseif strfind(vTag, "F:(%d+)/%d+") then
      local _,_,Fs = strfind(vTag, "F:(%d+)/%d+")
      Bwidh = Fs
   else
      Bwidh = "unlimited"
   end

   if Hubs == nil then
      FakeClient = 1
   else
      local _,_,Hub,RegHub,OpHub = strfind(Hubs, "(%d+)/(%d+)/(%d+)")
   end
   return DcVer, Mode, Slots, Hub, RegHub, OpHub, Bwidh
end

function NewUserConnected(curUser)
   local vClient, vTag, vSpeed, vShare = ParseMyInfo(curUser.sMyInfoString)

   if vClient == nil then
      curUser:SendData("Client-Check",curUser.sName.." Your Client is not allowed here!")
      curUser:Disconnect()
   elseif vTag == nil then
      curUser:SendData("No-Tag",curUser.sName.." you are hidding your Tag!")
      curUser:Disconnect()
   end

   local DcVer, Mode, Slots, Hub, RegHub, OpHub, Bwidh = GetTagInfo(vTag)
   
   if FakeClient == 1 then
      curUser:SendData("Faker",curUser.sName.." you are using a Fake Client")
      curUser:Disconnect()
      FakeClient = 0
   end
end
--------------------------------------------------------------------------------


Checking slots, hubs, versions will come later.

NOTE! This is in User Connect so this is just to show my upcoming script.

Will be rewritten in Data Arrival soon!!

Hope you all like it.

And Plop, Chilla, Phatty, Tezlo and others,
Tell me what I can think of in this script, my point is to
fakers now.
And improvments.
Title:
Post by: plop on 07 June, 2004, 15:31:43
QuoteOriginally posted by Caleblost
I'm searching for a script to kick dc++ Stealth users.
A friend of mine told me that exists only one script that ask for an inexistant file and dc stealth answer with : No slots avaiable (instead of File not avaiable) does anyone has this script?
this isn't done by a script but by dc++k CDM / IDC and some more CDM mods.

plop