PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: 6Marilyn6Manson6 on 27 May, 2006, 15:11:23

Title: NEW AntiLeecherBlocker :D
Post by: 6Marilyn6Manson6 on 27 May, 2006, 15:11:23
--// Based Of AntiLeecherBlocker 0.1 made by 6Marilyn6Manson6 23/03/2006   /   28/04/2006
--// Added Right Click
--// Added OnError function
--// Added Tables to commands
--// Added: !block <ip> - Block IP Number
--//      !unblock <ip> - Unblock IP Number
--//      !sblocks - Show Blocked IP List
--//      !dop <on/off> - Block Users From Download From Ops On/Off
--//      !lversion - Show Script Version
--// Added Other function
------------------------------------------------------
KiB = 1024
MiB = 1024*1024
GiB = 1024*1024*1024
TiB = 1024*1024*1024*1024
------------------------------------------------------
tSet = {} --
tSet.BlockIPs = {} --
tSet.Version = "1.1 MaDe: 27/05/2006" -- Script Version, Don'T Touch This :P
tSet.Prefix = "!" --! + # ? -
tSet.BotName = "[ITA]Annihilator" --frmHub:GetHubBotName(),
tSet.BlockUsersFromOperators = 1 --
tSet.ActiveMinShareDownload = 400*GiB -- Minimun Share Active User For Enable Download
tSet.PassiveMinShareDownload = 800*GiB -- Minimun Share Passive User For Enable Download
tSet.ActiveMinShareSearch = 400*GiB -- Minimun Share Active User For Enable Search
tSet.PassiveMinShareSearch = 800*GiB -- Minimun Share Passive User For Enable Search
tSet.MaxHubs = 20 -- Max Hubs For Enable Download
tSet.MaxSlots = 20 -- Max Slots For Enable Download
tSet.MaxNormalHubs = 10 -- Max Normal Hubs For Enable Download
tSet.MaxRegHubs = 10 -- Max Registered / ViP Hubs For Enable Download
tSet.GiveCom={ -- Who gets rightclick commands 1/yes 0/no
[0]=1, -- Master
[1]=0, -- Operator
[2]=0, -- VIP
[3]=0, -- Registered
[4]=1, -- Moderator
[5]=1, -- Netfounder
[-1]=0, -- Unregistered
}
------------------------------------------------------
tSet.BlockProfiles={-- What profile you want blocked 1/yes 0/no
[0]=0, -- Master
[1]=0, -- Operator
[2]=1, -- VIP
[3]=1, -- Registered
[4]=0, -- Moderator
[5]=0, -- Netfounder
[-1]=1, -- Unregistered
}
------------------------------------------------------
tImmune = {
["6Marilyn6Manson6"] = 1,
["[ITA]6Marilyn6Manson6"] = 1,
}
------------------------------------------------------
tIPImmune = {
["192.168.*"] = 1,
["213.*"] = 1,
}
------------------------------------------------------
Main = function()
LoadFile("BlockedIPs.lst")
if tSet.BotName ~= frmHub:GetHubBotName() then
frmHub:RegBot(tSet.BotName, 1, "AntiLeecherBlocker "..tSet.Version.."", "")
end
end
OnExit = function()
SaveFile("BlockedIPs.lst")
end
------------------------------------------------------
NewUserConnected = function(usr)
SendCommands(usr)
usr:SendData(tSet.BotName,"This Script Is: AntiLeecherBlocker "..tSet.Version.." written by 6Marilyn6Manson6")
end

OpConnected = NewUserConnected
------------------------------------------------------
ChatArrival = function(usr,data)
if CmdArrival(Extra(usr,1),data) == 1 then
return 1
end
end
ToArrival = function(usr,data)
if CmdArrival(Extra(usr),data) == 1 then
return 1
end
end
------------------------------------------------------
CmdArrival = function(usr,data)
local s,e,cmd,arg = string.find(data, "%b<>%s*(%S+)%s*(.*)%|")
if cmd and tCommand[string.lower(cmd)] and usr.bOperator then
return tCommand[string.lower(cmd)](usr,arg)
end
end

tCommand = {}
tCommand["!block"] = function(usr,sArg)
if sArg == "" then
usr:Send(tSet.BotName, "*** Syntax: !block <ip>")
elseif string.find(sArg, "%d+%.%d+%.%d+%.%d+") then
if tSet.BlockIPs[sArg] then
usr:Send(tSet.BotName, "*** IP ( "..sArg.." ) is allready in block list")
else
tSet.BlockIPs[sArg] = 1
SaveFile("BlockedIPs.lst")
usr:Send(tSet.BotName, "*** IP ( "..sArg.." ) is added to block list")
end
else
usr:Send(tSet.BotName, "*** Enter a valid IP number")
end
return 1
end
tCommand["!unblock"] = function(usr,sArg)
if sArg == "" then
usr:Send(tSet.BotName, "*** Syntax: !unblock <ip>")
elseif string.find(sArg, "%d+%.%d+%.%d+%.%d+") then
if tSet.BlockIPs[sArg] then
tSet.BlockIPs[sArg] = nil
SaveFile("BlockedIPs.lst")
usr:Send(tSet.BotName, "*** IP ( "..sArg.." ) is removed from block list")
else
usr:Send(tSet.BotName, "*** IP ( "..sArg.." ) is not found in block list")
end
else
usr:Send(tSet.BotName, "*** Enter a valid IP number")
end
return 1
end
tCommand["!sblocks"] = function(usr,sArg)
local list,c = "\r\n\r\n", 0
list = list .."-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----\r\n"
list = list .." \t Blocked IP numbers \r\n"
list = list .."-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----\r\n"
for ip,_ in tSet.BlockIPs do
c = c + 1
list = list .. "\t" .. c .. ".   " .. ip .. "\r\n"
end
list = list .."\r\n\t !unblock <ip> to remove IP from list \r\n"
list = list .."-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----\r\n"
usr:Send(tSet.BotName, list)
return 1
end
tCommand["!dop"] = function(usr,sArg)
if sArg == "" then
usr:Send(tSet.BotName, "*** Syntax: !dop <on/off>")
elseif string.lower(sArg) == "on" then
tSet.BlockUsersFromOperators = 1
usr:Send(tSet.BotName, "*** Users can not download from operators")
elseif string.lower(sArg) == "off" then
tSet.BlockUsersFromOperators = 0
usr:Send(tSet.BotName, "*** Users can download from operators")
else
usr:Send(tSet.BotName, "*** Invalid paramenter")
end
return 1
end
tCommand["!lversion"] = function(usr,data)
SendToOps(tSet.BotName,"This Script Is: AntiLeecherBlocker "..tSet.Version.." written by 6Marilyn6Manson6")
return 1
end
Title: Re: NEW AntiLeecherBlocker :D
Post by: 6Marilyn6Manson6 on 27 May, 2006, 15:12:31
------------------------------------------------------
CheckOP = function(tUser)
if tUser then
if (tUser.bOperator and tSet.BlockUsersFromOperators == 1) then
return 1
end
end
return
end
CheckUserIP = function(ip)
if tSet.BlockIPs[ip] then
return 1
else
return
end
end
CheckMode = function(mode)
if mode == "A" then
return 1
else
return
end
end
------------------------------------------------------
DoShareUnits = function(intSize)
if intSize ~= 0 then
local tUnits = { "Bytes", "KiB", "MiB", "GiB", "TiB" }
intSize = tonumber(intSize);
local sUnits;
for index = 1, table.getn(tUnits) do
if(intSize < 1024) then sUnits = tUnits[index]; break; else intSize = intSize / 1024; end
end
return string.format("%0.3f %s",intSize, sUnits);
else
return "0 Bytes"
end
end
------------------------------------------------------
ConnectToMeArrival = function(usr,data)
if CheckUserIP(usr.sIP) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download Here ;). You'Re IP Is Blocked")
return 1
end
if CheckOP(tUser) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download From Operators ;)")
return 1
end
if not tIPImmune[usr.sIP] then
if not tImmune[usr.sName] then
if tSet.BlockProfiles[usr.iProfile] == 1 then
if usr.bActive and usr.iShareSize < tSet.ActiveMinShareDownload then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You are in Active mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum is: "..DoShareUnits(tSet.ActiveMinShareDownload)..". Check It Please ;)"),1
elseif not usr.bActive and usr.iShareSize < tSet.PassiveMinShareDownload then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You are in Passive mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum is: "..DoShareUnits(tSet.PassiveMinShareDownload)..". Check It Please ;)"),1
elseif usr.iHubs > tSet.MaxHubs then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iHubs.." OPen HuBs, maximum is: "..tSet.MaxHubs.." .Check It Please ;)"),1
elseif usr.iSlots > tSet.MaxSlots then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iSlots.." OPen Slots, maximum is: "..tSet.MaxSlots.." .Check It Please ;)"),1
elseif usr.iNormalHubs > tSet.MaxNormalHubs then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iNormalHubs.." OPen Normal HuBs, maximum is: "..tSet.MaxNormalHubs.." .Check It Please ;)"),1
elseif usr.iRegHubs > tSet.MaxRegHubs then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iRegHubs.." OPen Registered/Vip HuBs, maximum is: "..tSet.MaxRegHubs.." .Check It Please ;)"),1
end
end
end
end
end

RevConnectToMeArrival = function(usr,data)
if CheckUserIP(usr.sIP) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download Here ;). You'Re IP Is Blocked")
return 1
end
if CheckUserIP(usr.sMode) then
SendPmToOps(frmHub:GetOpChatName(), "*** Attention! User: "..usr.sName.." States Active mode, But Are Using Passive Commands")
end
if CheckOP(tUser) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download From Operators ;)")
return 1
end
end

SearchArrival = function(usr,data)
if CheckUserIP(usr.sIP) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Search Here ;). You'Re IP Is Blocked")
return 1
end
if not tIPImmune[usr.sIP] then
if not tImmune[usr.sName] then
if tSet.BlockProfiles[usr.iProfile] == 1 then
if usr.bActive and usr.iShareSize < tSet.ActiveMinShareSearch then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Search Here ;). You are in Active mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum for use Search is: "..DoShareUnits(tSet.ActiveMinShareSearch)..". Check It Please ;)"),1
elseif not usr.bActive and usr.iShareSize < tSet.PassiveMinShareSearch then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Search Here ;). You are in Passive mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum for use Search is: "..DoShareUnits(tSet.PassiveMinShareSearch)..". Check It Please ;)"),1
end
end
end
end
end
------------------------------------------------------
Extra = function(this,mode)
if mode then
function this:Send(from,message) this:SendData(from,message) end
else
function this:Send(from,message) this:SendPM(from,message) end
end
return this
end
------------------------------------------------------
SendCommands = function(usr)
if tSet.GiveCom[usr.iProfile] == 1 and usr.bUserCommand then
usr:SendData("$UserCommand 0 3")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Block IP Number$<%[mynick]> !block %[line:IP]&#124;")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Unblock IP Number$<%[mynick]> !unblock %[line:IP]&#124;")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Show Blocked IP List$<%[mynick]> !sblocks&#124;")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Block Users From Download From Ops On/Off$<%[mynick]> !dop %[line:On/Off]&#124;")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Show Script Version$<%[mynick]> !lversion&#124;")
end
end
------------------------------------------------------
SaveFile = function(filename)
local file = io.open(filename, "w")
for ip,_ in tSet.BlockIPs do file:write(ip.."\n") end
file:close()
end
LoadFile = function(filename)
local file,err = io.open(filename, "r")
if err then SaveFile(filename) return 1 end
for line in file:lines() do tSet.BlockIPs[line] = 1 end
file:close()
end
------------------------------------------------------
OnError = function(ErrorMsg)
if ErrorMsg then
SendPmToOps(tSet.BotName, "AntiLeecherBlocker "..tSet.Version.." Error: "..ErrorMsg)
end
end
----------------------------------------------------
MultiConnectToMeArrival = ConnectToMeArrival
SRArrival = SearchArrival
UDPSRArrival = SearchArrival
--// 6Marilyn6Manson6
Title: Re: NEW AntiLeecherBlocker :D :P
Post by: eyklidis on 27 May, 2006, 15:21:37
Hi Marilyn Just tried the new script but couldnt make it work? :-\
[16:14:00] Private message from [ITA]Annihilator: <[ITA]Annihilator> AntiLeecherBlocker 1.0 MaDe: 27/05/2006 Error: ... εργασίας\Φάκελος\0.3.4.0.dbg\scripts\blockshare.lua:203: bad argument #1 to `find' (string expected, got nil)
On maichat i get the above message and in the scripts the below 
[16:14] Syntax ... εργασίας\Φάκελος\0.3.4.0.dbg\scripts\blockshare.lua:203: bad argument #1 to `find' (string expected, got nil)
[16:14] Syntax ... εργασίας\Φάκελος\0.3.4.0.dbg\scripts\blockshare.lua:298: bad argument #1 to `open' (string expected, got nil)
[16:14] Fatal error in script blockshare.lua ! Script stopped!!


Thanks in advance
Title: Re: NEW AntiLeecherBlocker :D
Post by: 6Marilyn6Manson6 on 27 May, 2006, 15:36:44
Post update, thanks
Title: Re: NEW AntiLeecherBlocker :D
Post by: eyklidis on 27 May, 2006, 15:44:03
np man
Just one question though ..
All ops masters and moderators need to be in the immune list ?
Title: Re: NEW AntiLeecherBlocker :D
Post by: 6Marilyn6Manson6 on 27 May, 2006, 15:51:48
Quote from: eyklidis on 27 May, 2006, 15:44:03
np man
Just one question though ..
All ops masters and moderators need to be in the immune list ?


tSet.BlockProfiles={-- What profile you want blocked 1/yes 0/no
[0]=1, -- Profile #0 (Registered)
[1]=1, -- Profile #1 (VIP)
[2]=0, -- Profile #2 (Operator)
[3]=0, -- Profile #3 (Moderator)
[4]=0, -- Profile #4 (Master)
[5]=0, -- Profile #5 (Netfounder)
[-1]=1, -- Profile #-1 (Unregistered)
}


0 = Profile Not Is Blocked
1 = Profile Is Blocked

Actually all Operator, Moderator, Master, Netfounder are in ImmuneList ;)
Title: Re: NEW AntiLeecherBlocker :D
Post by: eyklidis on 27 May, 2006, 15:53:41
tSet.MaxHubs = 15                  -- Max Hubs For Enable Download
tSet.MaxSlots = 10                  -- Max Slots For Enable Download
tSet.MaxNormalHubs = 15               -- Max Normal Hubs For Enable Download
tSet.MaxRegHubs = 50               -- Max Registered / ViP Hubs For Enable Download

and also plz this one :P
Whats the difference with the MaxHubs and MaxNormalHubs ?  ::)
Title: Re: NEW AntiLeecherBlocker :D
Post by: eyklidis on 27 May, 2006, 15:57:27
I just put my nick in here, i am as master in the hub
------------------------------------------------------
tImmune = {
["EYkliDiSa"] = 1,
["[ITA]6Marilyn6Manson6"] = 1,
}

If i dont have my nick here i get this

<?WaTchER?> *** Attention! You Not Are Good For Download Here . You are in Active mode and you Have: 32.658 MiB, minimum is: 2.000 GiB. Check It Please
Title: Re: NEW AntiLeecherBlocker :D
Post by: 6Marilyn6Manson6 on 27 May, 2006, 15:58:43
Quote from: eyklidis on 27 May, 2006, 15:53:41
tSet.MaxHubs = 15                  -- Max Hubs For Enable Download
tSet.MaxSlots = 10                  -- Max Slots For Enable Download
tSet.MaxNormalHubs = 15               -- Max Normal Hubs For Enable Download
tSet.MaxRegHubs = 50               -- Max Registered / ViP Hubs For Enable Download

and also plz this one :P
Whats the difference with the MaxHubs and MaxNormalHubs ?? ::)

This is traditional TaG of DC++: <++ V:0.674,M:A,H:X/Y/Z,S:A>
MaxHubs = X+Y+Z
MaxNormalHubs = X

Example: <++ V:0.674,M:A,H:2/10/2,S:4>
MaxHubs = 14
MaxNormalHubs = 2

That's all :D
Title: Re: NEW AntiLeecherBlocker :D
Post by: eyklidis on 27 May, 2006, 16:05:28
Right!!  ;D  Thanks alot man you are great  8)
Title: Re: NEW AntiLeecherBlocker :D
Post by: 6Marilyn6Manson6 on 27 May, 2006, 16:10:07
Quote from: eyklidis on 27 May, 2006, 15:57:27
I just put my nick in here, i am as master in the hub
------------------------------------------------------
tImmune = {
["EYkliDiSa"] = 1,
["[ITA]6Marilyn6Manson6"] = 1,
}

If i dont have my nick here i get this

<?WaTchER?> *** Attention! You Not Are Good For Download Here . You are in Active mode and you Have: 32.658 MiB, minimum is: 2.000 GiB. Check It Please

------------------------------------------------------
CheckOP = function(tUser)
if tUser then
if (tUser.bOperator and tSet.BlockUsersFromOperators == 1) then
return 1
end
end
return
end
CheckUserIP = function(ip)
if tSet.BlockIPs[ip] then
return 1
else
return
end
end
CheckMode = function(mode)
if mode == "A" then
return 1
else
return
end
end
------------------------------------------------------
DoShareUnits = function(intSize)
if intSize ~= 0 then
local tUnits = { "Bytes", "KiB", "MiB", "GiB", "TiB" }
intSize = tonumber(intSize);
local sUnits;
for index = 1, table.getn(tUnits) do
if(intSize < 1024) then sUnits = tUnits[index]; break; else intSize = intSize / 1024; end
end
return string.format("%0.3f %s",intSize, sUnits);
else
return "0 Bytes"
end
end
------------------------------------------------------
ConnectToMeArrival = function(usr,data)
if CheckUserIP(usr.sIP) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download Here ;). You'Re IP Is Blocked")
return 1
end
if CheckOP(tUser) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download From Operators ;)")
return 1
end
if not ((tIPImmune[usr.sIP]) or (tImmune[usr.sName])) and tSet.BlockProfiles[usr.iProfile] == 1 then
if usr.bActive and usr.iShareSize < tSet.ActiveMinShareDownload then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You are in Active mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum is: "..DoShareUnits(tSet.ActiveMinShareDownload)..". Check It Please ;)"),1
elseif not usr.bActive and usr.iShareSize < tSet.PassiveMinShareDownload then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You are in Passive mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum is: "..DoShareUnits(tSet.PassiveMinShareDownload)..". Check It Please ;)"),1
elseif usr.iHubs > tSet.MaxHubs then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iHubs.." OPen HuBs, maximum is: "..tSet.MaxHubs.." .Check It Please ;)"),1
elseif usr.iSlots > tSet.MaxSlots then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iSlots.." OPen Slots, maximum is: "..tSet.MaxSlots.." .Check It Please ;)"),1
elseif usr.iNormalHubs > tSet.MaxNormalHubs then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iNormalHubs.." OPen Normal HuBs, maximum is: "..tSet.MaxNormalHubs.." .Check It Please ;)"),1
elseif usr.iRegHubs > tSet.MaxRegHubs then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iRegHubs.." OPen Registered/Vip HuBs, maximum is: "..tSet.MaxRegHubs.." .Check It Please ;)"),1
end
end
end

RevConnectToMeArrival = function(usr,data)
if CheckUserIP(usr.sIP) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download Here ;). You'Re IP Is Blocked")
return 1
end
if CheckUserIP(usr.sMode) then
SendPmToOps(frmHub:GetOpChatName(), "*** Attention! User: "..usr.sName.." States Active mode, But Are Using Passive Commands")
end
if CheckOP(tUser) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download From Operators ;)")
return 1
end
end

SearchArrival = function(usr,data)
if CheckUserIP(usr.sIP) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Search Here ;). You'Re IP Is Blocked")
return 1
end
if not ((tIPImmune[usr.sIP]) or (tImmune[usr.sName])) and tSet.BlockProfiles[usr.iProfile] == 1 then
if usr.bActive and usr.iShareSize < tSet.ActiveMinShareSearch then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Search Here ;). You are in Active mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum for use Search is: "..DoShareUnits(tSet.ActiveMinShareSearch)..". Check It Please ;)"),1
elseif not usr.bActive and usr.iShareSize < tSet.PassiveMinShareSearch then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Search Here ;). You are in Passive mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum for use Search is: "..DoShareUnits(tSet.PassiveMinShareSearch)..". Check It Please ;)"),1
end
end
end
------------------------------------------------------
Extra = function(this,mode)
if mode then
function this:Send(from,message) this:SendData(from,message) end
else
function this:Send(from,message) this:SendPM(from,message) end
end
return this
end
------------------------------------------------------
SendCommands = function(usr)
if tSet.GiveCom[usr.iProfile] == 1 and usr.bUserCommand then
usr:SendData("$UserCommand 0 3")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Block IP Number$<%[mynick]> !block %[line:IP]&#124;")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Unblock IP Number$<%[mynick]> !unblock %[line:IP]&#124;")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Show Blocked IP List$<%[mynick]> !sblocks&#124;")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Block Users From Download From Ops On/Off$<%[mynick]> !dop %[line:On/Off]&#124;")
usr:SendData("$UserCommand 1 3 AntiLeecherBlocker\\Show Script Version$<%[mynick]> !lversion&#124;")
end
end
------------------------------------------------------
SaveFile = function(filename)
local file = io.open(filename, "w")
for ip,_ in tSet.BlockIPs do file:write(ip.."\n") end
file:close()
end
LoadFile = function(filename)
local file,err = io.open(filename, "r")
if err then SaveFile(filename) return 1 end
for line in file:lines() do tSet.BlockIPs[line] = 1 end
file:close()
end
------------------------------------------------------
OnError = function(ErrorMsg)
if ErrorMsg then
SendPmToOps(tSet.BotName, "AntiLeecherBlocker "..tSet.Version.." Error: "..ErrorMsg)
end
end
----------------------------------------------------
MultiConnectToMeArrival = ConnectToMeArrival
SRArrival = SearchArrival
UDPSRArrival = SearchArrival
--// 6Marilyn6Manson6


Update second part of script and in first part change:

tSet.BlockProfiles={-- What profile you want blocked 1/yes 0/no

with

tSet.BlockProfiles = {-- What profile you want blocked 1/yes 0/no

and try
Title: Re: NEW AntiLeecherBlocker :D
Post by: eyklidis on 27 May, 2006, 16:30:32
no man still the same  :(

[17:26:49] <?WaTchER?> *** Attention! You Not Are Good For Download Here . You are in Active mode and you Have: 32.658 MiB, minimum is: 2.000 GiB. Check It Please
Title: Re: NEW AntiLeecherBlocker :D
Post by: Markitos on 27 May, 2006, 16:42:37
Why dont update the script to PXDB???
Title: Re: NEW AntiLeecherBlocker :D
Post by: 6Marilyn6Manson6 on 28 May, 2006, 01:04:02
Quote from: Markitos on 27 May, 2006, 16:42:37
Why dont update the script to PXDB???

Hello, I'm back now.. Mmm I not use PXDB in this script because not is fundamental ;). I check error now
Title: Re: NEW AntiLeecherBlocker :D
Post by: 6Marilyn6Manson6 on 30 May, 2006, 10:58:48
New Version:

--// Based Of AntiLeecherBlocker 0.1 made by 6Marilyn6Manson6 23/03/2006   /   28/04/2006
--// Added 4 Tables: tImmune, tIPImmune, BlockProfiles, GiveCom
--// Added OnTimer, OnExit, NewUserConnected, OpConnected, ChatArrival, ToArrival, CmdArrival function
--// Added CheckOP, CheckUserIP, CheckMode, Extra, Save, Load, OnError function
--// Added Right Click
--// Added: !block <ip> - Block IP Number
--//      !unblock <ip> - Unblock IP Number
--//      !sblocks - Show Blocked IP List
--//      !dop <on/off> - Block Users From Download From Ops On/Off
--//      !lversion - Show Script Version
--// FiXeD Error In $ConnectToMeArrival   30/05/2006
------------------------------------------------------
--// Time Units
tTime = {}
tTime["Sec"]   = 1000
tTime["Min"]   = 60*tTime.Sec
tTime["Hour"]  = 60*tTime.Min
tTime["Day"]   = 24*tTime.Hour
tTime["Week"]  = 7*tTime.Day
tTime["Month"] = 30*tTime.Day
tTime["Year"]  = 365*tTime.Day
tTime["Interval"] = 1 -- Changed Interval Here
--//
------------------------------------------------------
KiB = 1024 -- Don'T Touch This :P
MiB = 1024*1024 -- Don'T Touch This :P
GiB = 1024*1024*1024 -- Don'T Touch This :P
TiB = 1024*1024*1024*1024 -- Don'T Touch This :P
PiB = 1024*1024*1024*1024*1024 -- Don'T Touch This :P
------------------------------------------------------
tSet = {} -- Don'T Touch This :P
tSet.BlockIPs = {} -- Don'T Touch This :P
------------------------------------------------------
tSet.BlockDownload = 1 -- Don'T Touch This :P
tSet.BlockSearch = 1 -- Don'T Touch This :P
tSet.BlockUsersFromOperators = 1 -- Don'T Touch This :P
tSet.ClearIPs = 1 -- Don'T Touch This :P
tSet.Version = "1.11 MaDe: 30/05/2006" -- Script Version, Don'T Touch This :P
------------------------------------------------------
tSet.Prefix = "!" -- ! + # ? -
tSet.BotName = "[ITA]Annihilator" -- frmHub:GetHubBotName(),
tSet.ActiveMinShareDownload = 300*GiB -- Minimun Share Active User For Enable Download
tSet.PassiveMinShareDownload = 600*GiB -- Minimun Share Passive User For Enable Download
tSet.ActiveMinShareSearch = 300*GiB -- Minimun Share Active User For Enable Search
tSet.PassiveMinShareSearch = 600*GiB -- Minimun Share Passive User For Enable Search
tSet.MaxHubs = 20 -- Max Hubs For Enable Download
tSet.MaxSlots = 20 -- Max Slots For Enable Download
tSet.MaxNormalHubs = 5 -- Max Normal Hubs For Enable Download
tSet.MaxRegHubs = 15 -- Max Registered / ViP Hubs For Enable Download
------------------------------------------------------
tImmune = {
["6Marilyn6Manson6"] = 1,
["[ITA]6Marilyn6Manson6"] = 1,
}
------------------------------------------------------
tIPImmune = {
["192.168.*"] = 1,
["213.*"] = 1,
}
------------------------------------------------------
BlockProfiles = { -- What profile you want blocked 1/yes 0/no
[-1] = 1, -- Unregistered
[0] = 0, -- Master
[1] = 0, -- Operator
[2] = 0, -- VIP
[3] = 1, -- Registered
[4] = 0, -- Moderator
[5] = 0, -- Netfounder
}
------------------------------------------------------
GiveCom = { -- Who gets rightclick commands 1/yes 0/no
[0]=1, -- Master
[1]=0, -- Operator
[2]=0, -- VIP
[3]=0, -- Registered
[4]=1, -- Moderator
[5]=1, -- Netfounder
[-1]=0, -- Unregistered
}
------------------------------------------------------
Main = function()
LoadFile("BlockedIPs.lst")
if tSet.BotName ~= frmHub:GetHubBotName() then
frmHub:RegBot(tSet.BotName, 1, "LeecherBlocker "..tSet.Version.."", "")
end
if tSet.ClearIPs == 1 then
SetTimer(tTime.Interval*tTime.Week)
StartTimer()
end
end

OnTimer = function()
tSet.BlockIPs = {}
end

OnExit = function()
SaveFile("BlockedIPs.lst")
end
------------------------------------------------------
NewUserConnected = function(usr)
SendCommands(usr)
end

OpConnected = function(usr)
SendCommands(usr)
usr:SendData(tSet.BotName,"This Script Is: LeecherBlocker "..tSet.Version.." written by 6Marilyn6Manson6")
end
------------------------------------------------------
ChatArrival = function(usr,data)
if CmdArrival(Extra(usr,1),data) == 1 then
return 1
end
end

ToArrival = function(usr,data)
if CmdArrival(Extra(usr),data) == 1 then
return 1
end
end
------------------------------------------------------
CmdArrival = function(usr,data)
local s,e,cmd,arg = string.find(data, "%b<>%s*(%S+)%s*(.*)%|")
if cmd and tCommand[string.lower(cmd)] and usr.bOperator then
return tCommand[string.lower(cmd)](usr,arg)
end
end

tCommand = {}
tCommand["!block"] = function(usr,sArg)
if sArg == "" then
usr:Send(tSet.BotName, "*** Syntax: !block <ip>")
elseif string.find(sArg, "%d+%.%d+%.%d+%.%d+") then
if tSet.BlockIPs[sArg] then
usr:Send(tSet.BotName, "*** IP ( "..sArg.." ) is allready in block list")
else
tSet.BlockIPs[sArg] = 1
SaveFile("BlockedIPs.lst")
usr:Send(tSet.BotName, "*** IP ( "..sArg.." ) is added to block list")
end
else
usr:Send(tSet.BotName, "*** Enter a valid IP number")
end
return 1
end
tCommand["!unblock"] = function(usr,sArg)
if sArg == "" then
usr:Send(tSet.BotName, "*** Syntax: !unblock <ip>")
elseif string.find(sArg, "%d+%.%d+%.%d+%.%d+") then
if tSet.BlockIPs[sArg] then
tSet.BlockIPs[sArg] = nil
SaveFile("BlockedIPs.lst")
usr:Send(tSet.BotName, "*** IP ( "..sArg.." ) is removed from block list")
else
usr:Send(tSet.BotName, "*** IP ( "..sArg.." ) is not found in block list")
end
else
usr:Send(tSet.BotName, "*** Enter a valid IP number")
end
return 1
end
tCommand["!sblocks"] = function(usr,sArg)
local list,c = "\r\n\r\n", 0
list = list .."-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----\r\n"
list = list .." \t Blocked IP numbers \r\n"
list = list .."-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----\r\n"
for ip,_ in tSet.BlockIPs do
c = c + 1
list = list .. "\t" .. c .. ".   " .. ip .. "\r\n"
end
list = list .."\r\n\t !unblock <ip> to remove IP from list \r\n"
list = list .."-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----\r\n"
usr:Send(tSet.BotName, list)
return 1
end
tCommand["!dop"] = function(usr,sArg)
if sArg == "" then
usr:Send(tSet.BotName, "*** Syntax: !dop <on/off>")
elseif string.lower(sArg) == "on" then
tSet.BlockUsersFromOperators = 1
usr:Send(tSet.BotName, "*** Users can not download from operators")
elseif string.lower(sArg) == "off" then
tSet.BlockUsersFromOperators = 0
usr:Send(tSet.BotName, "*** Users can download from operators")
else
usr:Send(tSet.BotName, "*** Invalid paramenter")
end
return 1
end
tCommand["!lversion"] = function(usr,data)
SendToOps(tSet.BotName,"This Script Is: LeecherBlocker "..tSet.Version.." written by 6Marilyn6Manson6")
return 1
end
Title: Re: NEW AntiLeecherBlocker :D
Post by: 6Marilyn6Manson6 on 30 May, 2006, 10:59:25
------------------------------------------------------
CheckOP = function(tUser)
if tUser then
if (tUser.bOperator and tSet.BlockUsersFromOperators == 1) then
return 1
end
end
return
end

CheckUserIP = function(ip)
if tSet.BlockIPs[ip] then
return 1
else
return
end
end

CheckMode = function(mode)
if mode == "A" then
return 1
else
return
end
end
------------------------------------------------------
DoShareUnits = function(intSize)
if intSize ~= 0 then
local tUnits = { "Bytes", "KiB", "MiB", "GiB", "TiB" }
intSize = tonumber(intSize);
local sUnits;
for index = 1, table.getn(tUnits) do
if(intSize < 1024) then sUnits = tUnits[index]; break; else intSize = intSize / 1024; end
end
return string.format("%0.3f %s",intSize, sUnits);
else
return "0 Bytes"
end
end
------------------------------------------------------
ConnectToMeArrival = function(usr,data)
if tSet.BlockDownload then
if CheckUserIP(usr.sIP) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download Here ;). You'Re IP Is Blocked")
return 1
end
if CheckOP(tUser) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download From Operators ;)")
return 1
end
if not tImmune[usr.sName] then
if not tIPImmune[usr.sIP] then
if BlockProfiles[usr.iProfile] == 1 then
if usr.bActive and usr.iShareSize < tSet.ActiveMinShareDownload then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You are in Active mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum is: "..DoShareUnits(tSet.ActiveMinShareDownload)..". Check It Please ;)"),1
elseif not usr.bActive and usr.iShareSize < tSet.PassiveMinShareDownload then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You are in Passive mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum is: "..DoShareUnits(tSet.PassiveMinShareDownload)..". Check It Please ;)"),1
elseif usr.iHubs > tSet.MaxHubs then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iHubs.." OPen HuBs, maximum is: "..tSet.MaxHubs.." .Check It Please ;)"),1
elseif usr.iSlots > tSet.MaxSlots then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iSlots.." OPen Slots, maximum is: "..tSet.MaxSlots.." .Check It Please ;)"),1
elseif usr.iNormalHubs > tSet.MaxNormalHubs then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iNormalHubs.." OPen Normal HuBs, maximum is: "..tSet.MaxNormalHubs.." .Check It Please ;)"),1
elseif usr.iRegHubs > tSet.MaxRegHubs then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Download Here ;). You Have: "..usr.iRegHubs.." OPen Registered/Vip HuBs, maximum is: "..tSet.MaxRegHubs.." .Check It Please ;)"),1
end
end
end
end
end
end

RevConnectToMeArrival = function(usr,data)
if tSet.BlockDownload then
if CheckUserIP(usr.sIP) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download Here ;). You'Re IP Is Blocked")
return 1
end
if CheckUserIP(usr.sMode) then
SendPmToOps(frmHub:GetOpChatName(), "*** Attention! User: "..usr.sName.." States Active mode, But Are Using Passive Commands")
end
if CheckOP(tUser) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Download From Operators ;)")
return 1
end
end
end

SearchArrival = function(usr,data)
if tSet.BlockSearch then
if CheckUserIP(usr.sIP) then
usr:SendPM(tSet.BotName, "*** Attention! You Not Are Good For Search Here ;). You'Re IP Is Blocked")
return 1
end
if not tImmune[usr.sName] then
if not tIPImmune[usr.sIP] then
if BlockProfiles[usr.iProfile] == 1 then
if usr.bActive and usr.iShareSize < tSet.ActiveMinShareSearch then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Search Here ;). You are in Active mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum for use Search is: "..DoShareUnits(tSet.ActiveMinShareSearch)..". Check It Please ;)"),1
elseif not usr.bActive and usr.iShareSize < tSet.PassiveMinShareSearch then
return usr:SendPM(tSet.BotName,"*** Attention! You Not Are Good For Search Here ;). You are in Passive mode and you Have: "..DoShareUnits(usr.iShareSize)..", minimum for use Search is: "..DoShareUnits(tSet.PassiveMinShareSearch)..". Check It Please ;)"),1
end
end
end
end
end
end
------------------------------------------------------
Extra = function(this,mode)
if mode then
function this:Send(from,message) this:SendData(from,message) end
else
function this:Send(from,message) this:SendPM(from,message) end
end
return this
end
------------------------------------------------------
SendCommands = function(usr)
if GiveCom[usr.iProfile] == 1 and usr.bUserCommand then
usr:SendData("$UserCommand 0 3")
usr:SendData("$UserCommand 1 3 LeecherBlocker\\Block IP Number$<%[mynick]> !block %[line:IP]&#124;")
usr:SendData("$UserCommand 1 3 LeecherBlocker\\Unblock IP Number$<%[mynick]> !unblock %[line:IP]&#124;")
usr:SendData("$UserCommand 1 3 LeecherBlocker\\Show Blocked IP List$<%[mynick]> !sblocks&#124;")
usr:SendData("$UserCommand 1 3 LeecherBlocker\\Block Users From Download From Ops On/Off$<%[mynick]> !dop %[line:On/Off]&#124;")
usr:SendData("$UserCommand 1 3 LeecherBlocker\\Show Script Version$<%[mynick]> !lversion&#124;")
end
end
------------------------------------------------------
SaveFile = function(filename)
local file = io.open(filename, "w")
for ip,_ in tSet.BlockIPs do file:write(ip.."\n") end
file:close()
end

LoadFile = function(filename)
local file,err = io.open(filename, "r")
if err then SaveFile(filename) return 1 end
for line in file:lines() do tSet.BlockIPs[line] = 1 end
file:close()
end
------------------------------------------------------
OnError = function(ErrorMsg)
if ErrorMsg then
SendPmToOps(tSet.BotName, "LeecherBlocker "..tSet.Version.." Error: "..ErrorMsg)
end
end
----------------------------------------------------
MultiConnectToMeArrival = ConnectToMeArrival
SRArrival = SearchArrival
UDPSRArrival = SearchArrival
--// 6Marilyn6Manson6