PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: blackwings on 12 October, 2004, 03:35:54

Title: deny clients...
Post by: blackwings on 12 October, 2004, 03:35:54
I don't really need help, I just wanted to here what you more skilled scripters think(heh, I'm a pure newbie) about my script that blocks certian clients. It's made to use together with RoboCop 9.0b.

Do you guys think this script is slow?
Do you guys think that it's check is bad?
Is there a better way to make a simple client block script?


Anyway, here is the code =-- ??????????????????????????????????????????????????????????????
-- ? Deny Client's Checker 1.0 - Made by: blackwings            ?
-- ?------------------------------------------------------------?
-- ? A personlized deny client's bot. To be fast as             ?
-- ? possible(with my little lua scripting knowledge), I didn't ?
-- ? make a fancy config option in the beginning of the script. ?
-- ?            --------------------------------------          ?
-- ? This Script blocks: BCDC++,nDC++, iDC++,StrongDC++,CZDC++, ?
-- ? DC@fe++,rmDC++,ReverseConnect                   ?
-- ?            --------------------------------------          ?
-- ? The Script doesn't check Ops and VIP's                     ?
-- ?            --------------------------------------          ?
-- ? I made this script to use it with RoboCop 9.0b             ?
-- ??????????????????????????????????????????????????????????????


Bot="Client-Checker"

Client =""

function Main()
frmHub:RegBot(Bot)
end

function DataArrival(User , data)
if strsub(data, 1, 7) == "$MyINFO"  and not User.bOperator  and User.iProfile ~= 2 then
if strfind(data,"V:(0.%d+)") then
if strfind(data, "[BL]:") then
Client="BCDC++"
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
elseif strfind(data, "v%[") then
Client="nDC++"
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
elseif strfind(data, "V:0.%d+%a") then
Client="CZDC++"
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
elseif strfind(data, " Client="DC@fe++"
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
elseif strfind(data, " Client="rmDC++"
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
elseif strfind(data, "reverseconnect.sf.net" ) or strfind(data,"www.RevConnect.com") then
Client="ReverseConnect"
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
end
else
if strfind(data, " Client="iDC++"
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
elseif strfind(data, " Client="StrongDC++"
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
end
end
end
end
Title:
Post by: imby on 12 October, 2004, 05:03:57
i thought you was one of the 'big dogs' mutor
Title:
Post by: nErBoS on 12 October, 2004, 09:22:28
Hi,

Fast answers....

"Do you guys think this script is slow? "

No i don't think so, but it could be faster  :))

"Do you guys think that it's check is bad?"

It will fail on checking iDC since iDC has the DC++ tag then he will enter in the condition "if strfind(data,"V:(0.%d+)") then"

"Is there a better way to make a simple client block script? "

Yes. Check out for NightLitch Parse Info and Client Checker.


Best regards, nErBoS
Title:
Post by: Herodes on 12 October, 2004, 12:46:15
I think that u would need to check the tag and only the tag ...

you need to find a way to grab it ...
and as soon as u grab it check that ...
just to make it a lil bit better ...
Title:
Post by: blackwings on 12 October, 2004, 13:25:56
@Herodes: I don't quite follow what you mean, grasp them in what way? Something else then strfind(data,"")??
   
Maybe I have optimized it a bit more now, but I think that maybe the table thingie I use isn't needed.
Heh, it's just me trying out things while I'm learning lua :P

-- ??????????????????????????????????????????????????????????????
-- ? Deny Client's Checker 2.0 - Made by: blackwings            ?
-- ?------------------------------------------------------------?
-- ? A personlized deny client's bot. To be fast as             ?
-- ? possible(with my little lua scripting knowledge), I didn't ?
-- ? make a fancy config option in the beginning of the script. ?
-- ?            --------------------------------------          ?
-- ? This Script blocks: BCDC++,nDC++, iDC++,StrongDC++,CZDC++, ?
-- ? DC@fe++,rmDC++,ReverseConnect                   ?
-- ?            --------------------------------------          ?
-- ? The Script doesn't check Ops and VIP's                     ?
-- ?            --------------------------------------          ?
-- ? I made this script to use it with RoboCop 9.0b             ?
-- ?            --------------------------------------          ?
-- ? Changed: Maybe Optimized the script :S                     ?
-- ??????????????????????????????????????????????????????????????

Bot="Client-Checker"

C={
[1]="BCDC++",
[2]="nDC++",
[3]="CZDC++",
[4]="DC@fe++",
[5]="rmDC++",
[6]="iDC++",
[7]="ReverseConnect",
[8]="StrongDC++",
}

Client=""

function Main()
frmHub:RegBot(Bot)
end

function BlockedUser(User)
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
end

function DataArrival(User , data)
if strsub(data, 1, 7) == "$MyINFO"  and not User.bOperator  and User.iProfile ~= 2 then
if strfind(data,"V:(0.%d+)") then
if strfind(data, "[BL]:") then
Client=C[1]
return BlockedUser(User)
elseif strfind(data, "v%[") then
Client=C[2]
return BlockedUser(User)
elseif strfind(data, "V:0.%d+%a") then
Client=C[3]
return BlockedUser(User)
elseif strfind(data, " Client=C[4]
return BlockedUser(User)
elseif strfind(data, " Client=C[5]
return BlockedUser(User)
elseif strfind(data, " Client=C[6]
return BlockedUser(User)
elseif strfind(data, "reverseconnect.sf.net" ) or strfind(data,"www.RevConnect.com") then
Client=C[7]
return BlockedUser(User)
end
else -- having this one alone for future additions
if strfind(data, " Client=C[8]
User:SendData(Bot,"The Client <"..sClient.."> isn't allowed in this hub.")
User:Disconnect()
end
end
end
end
Title:
Post by: Optimus on 12 October, 2004, 14:15:46
Keep on going m8, btw a nice link with some more info = http://www.dslreports.com/faq/6529

But maybe you know it allready

Greetingz Optimus ;)
Title:
Post by: blackwings on 12 October, 2004, 17:04:45
By hard thinking about my current deny client script, checking in the LUA Guide etc, I made this. I rewrote most of the code and I think it's much faster then the other 2 I made earlier.

I think the script works properly, but please, if anyone of you skilled scripters see anything weird in my script, tell me about it

EDIT: Updated the code (added a table)
EDIT 2: Added few more clients to the table
-- ??????????????????????????????????????????????????????????????
-- ? Deny Client's Checker 3.1                                  ?
-- ? Made by: blackwings                                        ?
-- ?------------------------------------------------------------?
-- ? This Script blocks: StrongDC++,Phantom DC++,iDC++,MS++V,   ?
-- ? DC++K CDM,rmDC++,DC@fe++,DC++ DCDM,BCDC++,nDC++,CZDC++,    ?
-- ? ReverseConnect,zY++,xR++                                   ?
-- ?            --------------------------------------          ?
-- ? The Script doesn't check Ops and VIP's                     ?
-- ?            --------------------------------------          ?
-- ? I made this script to use it with RoboCop 9.0b             ?
-- ?            --------------------------------------          ?
-- ? Changed: Maybe Optimized the script :S                     ?
-- ? Changed: I rewrote most of the script, much better now     ?
-- ? Added: A table for clients that I don't know the version   ?
-- ?        description off                                     ?
-- ? Added: A few more clients to the table                     ?
-- ??????????????????????????????????????????????????????????????

Bot="Client-Checker"

C = {
{"{"<.P>","V:(0.%d+)","Phantom DC++"},
{"{"{"{"{"DC@fe++","V:(0.%d+)","DC@fe++"},
{"{"[BL]:","V:(0.%d+)","BCDC++"},
{"v%[","V:(0.%d+)","nDC++"},
{"V:0.%d+%a","V:(0.%d+)","CZDC++"},
{"reverseconnect.sf.net","V:(0.%d+)","ReverseConnect"},
{"www.RevConnect.com","V:(0.%d+)","ReverseConnect"},
}

U = {
{"{"}

Client=""

function Main()
frmHub:RegBot(Bot)
end

function BlockedUser(User)
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
end

function DataArrival(User , data)
if strsub(data, 1, 7) == "$MyINFO"  and not User.bOperator  and User.iProfile ~= 2 then
for i=1,getn(C) do
C[i][1] = gsub(C[i][1], "<" , "")
if strfind(data, C[i][1]) and strfind(data, C[i][2]) then
Client=C[i][3]
return BlockedUser(User)
end
end
for j=1,getn(U) do
U[j][1] = gsub(U[j][1], "<" , "")
if strfind(data, U[j][1]) then
Client=U[j][2]
return BlockedUser(User)
end
end
end
end
Title:
Post by: BoJlk on 13 October, 2004, 20:08:15
Got a question :

to integrate this script with the RoboCop
i have to disable the RoboCop's ClientCheck feature
or organize the scripts that this one will come before the RoboCop's?
Title:
Post by: bastya_elvtars on 13 October, 2004, 20:11:51
QuoteOriginally posted by BoJlk
Got a question :

to integrate this script with the RoboCop
i have to disable the RoboCop's ClientCheck feature
or organize the scripts that this one will come before the RoboCop's?

disable check in rc and let it come AFTER rc imho
Title:
Post by: Typhoon on 13 October, 2004, 22:23:30
No need to check for those they are not public and will never be , besides they can stealth that tag...

U = {
{"{"}

just some info and now you can make it even shorter now :)

Typhoon?
Title:
Post by: blackwings on 14 October, 2004, 04:25:23
I did the thing Typhoon pointed out =-- ??????????????????????????????????????????????????????????????????
-- ? Deny Client's Checker 3.5.2                                    ?
-- ? Made by: blackwings                                            ?
-- ?----------------------------------------------------------------?
-- ? This Script blocks: DCGUI,zDC++,StrongDC++,Phantom DC++,iDC++, ?
-- ? MS++V,DC++K CDM,rmDC++,DC@fe++,DC++ DCDM,BCDC++,nDC++,CZDC++,  ?
-- ? ReverseConnect                                                 ?
-- ?            --------------------------------------              ?
-- ? The Script doesn't check Ops and VIP's                         ?
-- ?            --------------------------------------              ?
-- ? I made this script to use it with RoboCop 9.0b                 ?
-- ? (remeber to name the script so it comes after RC when ptokax   ?
-- ? loads it)                                                      ?
-- ?            --------------------------------------              ?
-- ? Changed: Maybe Optimized the script :S                         ?
-- ? Changed: I rewrote most of the script, much better now         ?
-- ? Added: A table for clients that I don't know the version       ?
-- ?        description off                                         ?
-- ? Added: A few more clients to the table                         ?
-- ? Removed: The check on the clients zY++ and xR++ (after Typhoon ?
-- ? pointed it out), which make the script shorter and faster      ?
-- ? Added: DCGUI and zDC++ to the deny table                       ?
-- ? Fixed: A small bug in the client table                         ?
-- ??????????????????????????????????????????????????????????????????

Bot="Client-Checker"

C = {
{"{"zDC++","V:(0.%d+)","zDC++"},
{"{"<.P>","V:(0.%d+)","Phantom DC++"},
{"{"{"{"{"DC@fe++","V:(0.%d+)","DC@fe++"},
{"{"[BL]:","V:(0.%d+)","BCDC++"},
{"v%[","V:(0.%d+)","nDC++"},
{"V:0.%d+%a","V:(0.%d+)","CZDC++"},
{"reverseconnect.sf.net","V:(0.%d+)","ReverseConnect"},
{"www.RevConnect.com","V:(0.%d+)","ReverseConnect"},
}

Client=""

function Main()
-- Remove "frmHub:RegBot(Bot)" if you don't want this bot to appear in the userlist
frmHub:RegBot(Bot)
end

function BlockedUser(User)
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
end

function DataArrival(User , data)
if strsub(data, 1, 7) == "$MyINFO"  and not User.bOperator  and User.iProfile ~= 2 then
for i=1,getn(C) do
C[i][1] = gsub(C[i][1], "<" , "")
if strfind(data, C[i][1]) and strfind(data, C[i][2]) then
Client=C[i][3]
return BlockedUser(User)
end
end
end
end
Title:
Post by: Typhoon on 14 October, 2004, 09:43:39
just Remember to add DCGUI to your list to , a very good client in my oppinion ..
looks great so far keep it up m8 :)

Typhoon?
Title:
Post by: blackwings on 14 October, 2004, 11:41:51
QuoteOriginally posted by blackwings
QuoteOriginally posted by bastya_elvtars
disable check in rc . Let it come AFTER rc imho
@bastya_elvtars: didn't you mean = "don't disable the check in rc and let this script come AFTER rc imho"

Can some other well known client that isn't in my script table, be mistaken and blocked by my script?
Anyway, I have updated the script in my post before this one. I added DCGUI and zDC++.
Title:
Post by: Optimus on 14 October, 2004, 12:50:52
I think (haven't tested) that it works but at the moment you add DC++ tag you will get in troubles i think. Then you need todo it maybe in a other way.

Optimus
Title:
Post by: blackwings on 14 October, 2004, 16:04:08
The script has been updated again(version 3.5.2), I fixed a small bug in the client table.

The script seems to work perfectly now. I have tested it with RC 9.0b ClientChecker activated and it seems to work.

@Optimus: heh, I tested to block Phantom DC in both RC and in my script. Even if my script is loaded after RC in the list, my script blocks Phantom DC, not RC :P  Probably because my script is faster on blocking it :]
Title:
Post by: Optimus on 14 October, 2004, 17:04:10
QuoteProbably because my script is faster on blocking it
Lol i don't think that has anything todo with it, mine is just not loaded directly at the beginning. There are some other checks first.
Title:
Post by: Typhoon on 14 October, 2004, 19:06:57
small scripts dedicated to do only 1 thing , should be faster , but compare your hub with RC on then turn RC off, and see what crap gets allowed to enter  ;)  
and as optimus said RC dont only check the client ..
but also share , slots , hubs , do logging and so on.. thats why yours seem to work faster


Typhoon?
Title:
Post by: blackwings on 14 October, 2004, 22:56:15
Ok. I have now updated the script again. I improved the "search info" (Thanx Optimus) and added allot of clients.

Anyway, if someone sees something wierd in the "search infos"/strings of the new clients, please post about it.

Here is the updated code =-- ??????????????????????????????????????????????????????????????????
-- ? Deny Client's Checker 4                                        ?
-- ? Made by: blackwings                                            ?
-- ?----------------------------------------------------------------?
-- ? This Script blocks: DCGUI,zDC++,StrongDC++,Phantom DC++,iDC++, ?
-- ? MS++V,DC++K CDM,rmDC++,DC@fe++,DC++ DCDM,BCDC++,nDC++,CZDC++,  ?
-- ? ReverseConnect,oDC,NMDC,DC:PRO,RDC++,[X]DC,YETI++,DHDc++,      ?
-- ? MORIA++,LDC++,TiDc++,R2++,Chp++,SdDC++                         ?
-- ?            --------------------------------------              ?
-- ? The Script doesn't check Ops and VIP's                         ?
-- ?            --------------------------------------              ?
-- ? I made this script to use it with RoboCop 9.0b                 ?
-- ? (remeber to name the script so it comes after RC when ptokax   ?
-- ? loads it)                                                      ?
-- ?            --------------------------------------              ?
-- ? Changed: Maybe Optimized the script :S                         ?
-- ? Changed: I rewrote most of the script, much better now         ?
-- ? Added: A table for clients that I don't know the version       ?
-- ?        description off                                         ?
-- ? Added: A few more clients to the table                         ?
-- ? Removed: The check on the clients zY++ and xR++ (after Typhoon ?
-- ? pointed it out), which make the script shorter and faster      ?
-- ? Added: DCGUI and zDC++ to the deny table                       ?
-- ? Fixed: A small bug in the client table                         ?
-- ? Added: Allot of new clients                                    ?
-- ? Improved: some of search info, so that some clients won't get  ?
-- ? confused with other clients. (Thanx Optimus)                   ?
-- ??????????????????????????????????????????????????????????????????

Bot="Client-Checker"

-- To remove a client from the deny table, simple delete the line
C = {
{"{"{"{"{"<%.%P>","V:(0.%d+)","Phantom DC++"},
{"[BL]:","V:(0.%d+)","BCDC++"},
{"zDC%+%+","V:(0.%d+)","zDC++"},
{"{"V:0.%d+%a","V:(0.%d+)","CZDC++"},
{"{"{"{"{"{"DC@fe%+%+","V:(0.%d+)","DC@fe++"},
{"v%[","V:(0.%d+)","nDC++"},
{"reverseconnect.sf.net","V:(0.%d+)","ReverseConnect"},
{"www.RevConnect.com","V:(0.%d+)","ReverseConnect"},
{"{"{"<[X]DC","V:(0.%d+)","[X]DC"},
{"{"{"{"{"{"{"{"{"}

Client=""

function Main()
-- Remove "frmHub:RegBot(Bot)" if you don't want this bot to appear in the userlist
frmHub:RegBot(Bot)
end

function BlockedUser(User)
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:Disconnect()
end

function DataArrival(User , data)
if strsub(data, 1, 7) == "$MyINFO"  and not User.bOperator  and User.iProfile ~= 2 then
for i=1,getn(C) do
C[i][1] = gsub(C[i][1], "<" , "")
if strfind(data, C[i][1]) and strfind(data, C[i][2]) then
Client=C[i][3]
return BlockedUser(User)
end
end
end
end
Title:
Post by: Optimus on 15 October, 2004, 00:19:35
Maybe a good idea is to make a swith for everyclient. (1=on,0=off) so that people don't have to remove the clients from list. Cause if they do remove them the could forget what the tag was when they want to put it back or sum like that.
Title:
Post by: Optimus on 15 October, 2004, 00:23:41
{"
and
if C[i][4] == 1 then
Client=C[i][3]
return BlockedUser(User)
end
Title:
Post by: blackwings on 15 October, 2004, 12:27:43
Another update(version 4.2)

I have added on/off setting, so that you don't need to delete the lines in the table(Thanx for the idea Optimus).

I have also added another field in each string, so that you can add a info that shouldn't be found example = for BCDC++, I have in the fourth field added <%.%P> and. This function works well I think and I hope by doing this, there won't be any confusion in the checking.

 For the moment I have in the other strings just added "cccc" in the fourth field. Anyone can give a sugestion of a better info or that you know a client that you think should have a certian info in the fourth field just like BCDC++-- ??????????????????????????????????????????????????????????????????
-- ? Deny Client's Checker 4.2.1                                    ?
-- ? Made by: blackwings                                            ?
-- ?----------------------------------------------------------------?
-- ? This Script blocks: DCGUI,zDC++,StrongDC++,Phantom DC++,iDC++, ?
-- ? MS++V,DC++K CDM,rmDC++,DC@fe++,DC++ DCDM,BCDC++,nDC++,CZDC++,  ?
-- ? ReverseConnect,oDC,NMDC,DC:PRO,RDC++,[X]DC,YETI++,DHDc++,      ?
-- ? MORIA++,LDC++,TiDc++,R2++,Chp++,SdDC++,FInDC                   ?
-- ?            --------------------------------------              ?
-- ? The Script doesn't check Ops and VIP's                         ?
-- ?            --------------------------------------              ?
-- ? I made this script to use it with RoboCop 9.0b                 ?
-- ? (remeber to name the script so it comes after RC when ptokax   ?
-- ? loads it)                                                      ?
-- ?            --------------------------------------              ?
-- ? Changed: Maybe Optimized the script :S                         ?
-- ? Changed: I rewrote most of the script, much better now         ?
-- ? Added: A table for clients that I don't know the version       ?
-- ?        description off                                         ?
-- ? Added: A few more clients to the table                         ?
-- ? Removed: The check on the clients zY++ and xR++ (after Typhoon ?
-- ?          pointed it out), which make the script shorter        ?
-- ?      and faster                                            ?
-- ? Added: DCGUI and zDC++ to the deny table                       ?
-- ? Fixed: A small bug in the client table                         ?
-- ? Added: Allot of new clients (Thanx Optimus)                    ?
-- ? Improved: some of search info, so that some clients won't get  ?
-- ?           confused with other clients. (Thanx Optimus)         ?
-- ? Added: A on/off setting for each client (Thanx Optimus)        ?
-- ? Improved: I made the table and the way it search better,       ?
-- ?           so now there is no confusion in the checking         ?
-- ??????????????????????????????????????????????????????????????????

Bot="Client-Checker"

-- To make the bot not block a certain client, you should
-- then change the number at the end from 1 to 0
C = {
{"{"{"{"{"<%.%P>","V:(0.%d+)","Phantom DC++","cccc", 1},
{"[BL]:","V:(0.%d+)","BCDC++","<%.%P>", 1},
{"zDC%+%+","V:(0.%d+)","zDC++","cccc", 1},
{"{"V:0.%d+%a","V:(0.%d+)","CZDC++","cccc", 1},
{"{"{"{"{"{"DC@fe%+%+","V:(0.%d+)","DC@fe++","cccc", 1},
{"v%[","V:(0.%d+)","nDC++","cccc", 1},
{"reverseconnect.sf.net","V:(0.%d+)","ReverseConnect","cccc", 1},
{"www.RevConnect.com","V:(0.%d+)","ReverseConnect","cccc", 1},
{"{"{"<[X]DC","V:(0.%d+)","[X]DC","cccc", 1},
{"{"{"{"{"{"{"{"{"}

function Main()
-- Remove "frmHub:RegBot(Bot)" if you don't want this bot to appear in the userlist
frmHub:RegBot(Bot)
end

function BlockedUser(User,Client)
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:SendData(Bot,"Use Original DC++, NMDC, oDC or DCGUI")
User:Disconnect()
end

function DataArrival(User , data)
if strsub(data, 1, 7) == "$MyINFO"  and not User.bOperator  and User.iProfile ~= 2 then
for i=1,getn(C) do
C[i][1] = gsub(C[i][1], "<" , "")
if strfind(data, C[i][1]) and strfind(data, C[i][2]) and not strfind(data, C[i][4]) then
if C[i][5] == 1 then
local Client=C[i][3]
return BlockedUser(User,Client)
end
end
end
end
end
Title:
Post by: nErBoS on 15 October, 2004, 14:12:30
Hi,

You could also avoid on using a global var "Client" on making the Blocked function reciving the client. For eg:

local Client=C[i][3]
return BlockedUser(User,Client)

Best regards, nErBoS
Title:
Post by: blackwings on 15 October, 2004, 15:28:28
The Script is updated!-Version 4.2.1- (Check the post before this one to find the script)

I followed nErBoS advice and changed the variabel Client from Global to local.
Title:
Post by: Optimus on 15 October, 2004, 15:45:23
I wonder what will be the next stepp, lol