Here is an alternative script to use to block IPs to download and block users ( -1 ) to download from operators in hub.
--//-------------------------------------------------------//--
--// Download Blocker by NightLitch
--// Version:
--// 0.1: created bot
--// 0.2: added commands
--// 0.3: fixed send message bug
--// 0.4: added mode check ( Active in RevConnect, reported to Ops )
--//-------------------------------------------------------//--
--// Available commands:
--// !block - Block IP number
--// !unblock - Unblock IP number
--// !sblocks - Show Blocked IP list
--// !dop - Block users from download from ops On/Off
--//-------------------------------------------------------//--
tSet = {}
tSet.BotName = frmHub:GetHubBotName()
tSet.BlockUsersFromOperators = 1
tSet.BlockSpecificIPs = 1
--//-------------------------------------------------------//--
--// Don't edit if you don't have a clue at all what you are doing ;-)
--//-------------------------------------------------------//--
tSet.BlockIPs = {}
function Main()
LoadFile("BlockedIPs.lst")
end
function OnExit()
SaveFile("BlockedIPs.lst")
end
function NewUserConnected(sUser)
sUser:SendData(tSet.BotName, "This hub is running version 0.4 of Download Blocker created by NightLitch (2005)")
end
OpConnected = NewUserConnected
function ChatArrival(sUser,sData)
if CmdArrival(Extra(sUser,1),sData) == 1 then return 1 end
end
function ToArrival(sUser,sData)
if CmdArrival(Extra(sUser),sData) == 1 then return 1 end
end
function ConnectToMeArrival(sUser,sData)
if CheckUserIP(sUser.sIP) then sUser:SendPM(tSet.BotName, "*** You are not allowed to download in this hub") return 1 end
local _,_,sName = string.find(sData, "(%S+)%s+%S+|$")
local tUser = GetItemByName(sName)
if CheckOP(tUser) then sUser:SendPM(tSet.BotName, "*** You are not allowed to download from operators") return 1 end
end
function RevConnectToMeArrival(sUser, sData)
if CheckUserIP(sUser.sIP) then sUser:SendPM(tSet.BotName, "*** You are not allowed to download in this hub") return 1 end
if CheckMode(sUser.sMode) then SendPmToOps(frmHub:GetOpChatName(), "*** User "..sUser.sName.." states Active mode, but are using Passive Commands") end
local _,_,sName = string.find(sData, "(%S+)|$")
local tUser = GetItemByName(sName)
if CheckOP(tUser) then sUser:SendPM(tSet.BotName, "*** You are not allowed to download from operators") return 1 end
end
function CheckOP(tUser)
if tUser then
if (tUser.bOperator and tSet.BlockUsersFromOperators == 1) then return 1 end
end
return
end
function CheckUserIP(ip)
if tSet.BlockIPs[ip] then return 1 else return end
end
function CheckMode(mode)
if mode == "A" then return 1 else return end
end
function CmdArrival(sUser,sData)
local s,e,cmd,arg = string.find(sData, "%b<>%s*(%S+)%s*(.*)%|")
if cmd and tCommand[string.lower(cmd)] and sUser.bOperator then
return tCommand[string.lower(cmd)](sUser,arg)
end
end
tCommand = {}
tCommand["!block"] = function(sUser,sArg)
if sArg == "" then
sUser:Send(tSet.BotName, "*** Syntax: !block ")
elseif string.find(sArg, "%d+%.%d+%.%d+%.%d+") then
if tSet.BlockIPs[sArg] then
sUser:Send(tSet.BotName, "*** IP ( "..sArg.." ) is allready in block list")
else
tSet.BlockIPs[sArg] = 1
SaveFile("BlockedIPs.lst")
sUser:Send(tSet.BotName, "*** IP ( "..sArg.." ) is added to block list")
end
else
sUser:Send(tSet.BotName, "*** Enter a valid IP number")
end
return 1
end
tCommand["!unblock"] = function(sUser,sArg)
if sArg == "" then
sUser:Send(tSet.BotName, "*** Syntax: !unblock ")
elseif string.find(sArg, "%d+%.%d+%.%d+%.%d+") then
if tSet.BlockIPs[sArg] then
tSet.BlockIPs[sArg] = nil
SaveFile("BlockedIPs.lst")
sUser:Send(tSet.BotName, "*** IP ( "..sArg.." ) is removed from block list")
else
sUser:Send(tSet.BotName, "*** IP ( "..sArg.." ) is not found in block list")
end
else
sUser:Send(tSet.BotName, "*** Enter a valid IP number")
end
return 1
end
tCommand["!sblocks"] = function(sUser,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 to remove IP from list \r\n"
list = list .."-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----\r\n"
sUser:Send(tSet.BotName, list)
return 1
end
tCommand["!dop"] = function(sUser,sArg)
if sArg == "" then
sUser:Send(tSet.BotName, "*** Syntax: !dop ")
elseif string.lower(sArg) == "on" then
tSet.BlockUsersFromOperators = 1
sUser:Send(tSet.BotName, "*** Users can not download from operators")
elseif string.lower(sArg) == "off" then
tSet.BlockUsersFromOperators = 0
sUser:Send(tSet.BotName, "*** Users can download from operators")
else
sUser:Send(tSet.BotName, "*** Invalid paramenter")
end
return 1
end
function SaveFile(filename)
local file = io.open(filename, "w")
for ip,_ in tSet.BlockIPs do file:write(ip.."\n") end
file:close()
end
function LoadFile(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
function Extra(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
--// NightLitch
Enjoy !!
// NightLitch
Eheheh... Night superstarrrrrrrrrrrrrrrrr Night is superstarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr :D
Any ideas what is missing or requests ???
If not, this script will probobly not be dev. any longer.
well, maybe u could add, !imune ip or nick, & !remimune
!showimune, etc
QuoteOriginally posted by Dessamator
well, maybe u could add, !imune ip or nick, & !remimune
!showimune, etc
it is easy to say add that and that, in what purpose, what should the imune IP/Nick be imune from ???
QuoteOriginally posted by NightLitch
QuoteOriginally posted by Dessamator
well, maybe u could add, !imune ip or nick, & !remimune
!showimune, etc
it is easy to say add that and that, in what purpose, what should the imune IP/Nick be imune from ???
hmm, well imune to the download blocker pr the !block :)
QuoteOriginally posted by Dessamator
QuoteOriginally posted by NightLitch
QuoteOriginally posted by Dessamator
well, maybe u could add, !imune ip or nick, & !remimune
!showimune, etc
it is easy to say add that and that, in what purpose, what should the imune IP/Nick be imune from ???
hmm, well imune to the download blocker pr the !block :)
Oh ok, well Am going to add so both Nick and IP will fit in the list. Also will add a list the other way around.
now current User is blocked.
Will add so no one can download from IP/Nick if not in a maybe Imune list.
Block passive search response and save some bw
QuoteOriginally posted by kepp
Block passive search response and save some bw
Good Idea // Thx
nice script NightLitch ;) can you put and right click menu for this? if it's possiblle of course :) thx anyway
Added rightclick commands with profile
--//-------------------------------------------------------//--
--// Download Blocker by NightLitch
--// Version:
--// 0.1: created bot
--// 0.2: added commands
--// 0.3: fixed send message bug
--// 0.4: added mode check ( Active in RevConnect, reported to Ops )
--//-------------------------------------------------------//--
--// Available commands:
--// !block - Block IP number
--// !unblock - Unblock IP number
--// !sblocks - Show Blocked IP list
--// !dop - Block users from download from ops On/Off
--//-------------------------------------------------------//--
tSet = {}
tSet.BotName = frmHub:GetHubBotName()
tSet.BlockUsersFromOperators = 1
tSet.BlockSpecificIPs = 1
tSet.GiveCom = { -- Who gets rightclick commands 1/yes 0/no
[0] = 1, -- Master
[1] = 0, -- Operator
[4] = 1, -- Moderator
[5] = 1, -- Netfounder
}
--//-------------------------------------------------------//--
--// Don't edit if you don't have a clue at all what you are doing ;-)
--//-------------------------------------------------------//--
tSet.BlockIPs = {}
function Main()
LoadFile("BlockedIPs.lst")
end
function OnExit()
SaveFile("BlockedIPs.lst")
end
function NewUserConnected(sUser)
SendCommands(sUser)
sUser:SendData(tSet.BotName, "This hub is running version 0.4 of Download Blocker created by NightLitch (2005)")
end
OpConnected = NewUserConnected
function ChatArrival(sUser,sData)
if CmdArrival(Extra(sUser,1),sData) == 1 then return 1 end
end
function ToArrival(sUser,sData)
if CmdArrival(Extra(sUser),sData) == 1 then return 1 end
end
function ConnectToMeArrival(sUser,sData)
if CheckUserIP(sUser.sIP) then sUser:SendPM(tSet.BotName, "*** You are not allowed to download in this hub") return 1 end
local _,_,sName = string.find(sData, "(%S+)%s+%S+|$")
local tUser = GetItemByName(sName)
if CheckOP(tUser) then sUser:SendPM(tSet.BotName, "*** You are not allowed to download from operators") return 1 end
end
function RevConnectToMeArrival(sUser, sData)
if CheckUserIP(sUser.sIP) then sUser:SendPM(tSet.BotName, "*** You are not allowed to download in this hub") return 1 end
if CheckMode(sUser.sMode) then SendPmToOps(frmHub:GetOpChatName(), "*** User "..sUser.sName.." states Active mode, but are using Passive Commands") end
local _,_,sName = string.find(sData, "(%S+)|$")
local tUser = GetItemByName(sName)
if CheckOP(tUser) then sUser:SendPM(tSet.BotName, "*** You are not allowed to download from operators") return 1 end
end
function CheckOP(tUser)
if tUser then
if (tUser.bOperator and tSet.BlockUsersFromOperators == 1) then return 1 end
end
return
end
function CheckUserIP(ip)
if tSet.BlockIPs[ip] then return 1 else return end
end
function CheckMode(mode)
if mode == "A" then return 1 else return end
end
function CmdArrival(sUser,sData)
local s,e,cmd,arg = string.find(sData, "%b<>%s*(%S+)%s*(.*)%|")
if cmd and tCommand[string.lower(cmd)] and sUser.bOperator then
return tCommand[string.lower(cmd)](sUser,arg)
end
end
tCommand = {}
tCommand["!block"] = function(sUser,sArg)
if sArg == "" then
sUser:Send(tSet.BotName, "*** Syntax: !block ")
elseif string.find(sArg, "%d+%.%d+%.%d+%.%d+") then
if tSet.BlockIPs[sArg] then
sUser:Send(tSet.BotName, "*** IP ( "..sArg.." ) is allready in block list")
else
tSet.BlockIPs[sArg] = 1
SaveFile("BlockedIPs.lst")
sUser:Send(tSet.BotName, "*** IP ( "..sArg.." ) is added to block list")
end
else
sUser:Send(tSet.BotName, "*** Enter a valid IP number")
end
return 1
end
tCommand["!unblock"] = function(sUser,sArg)
if sArg == "" then
sUser:Send(tSet.BotName, "*** Syntax: !unblock ")
elseif string.find(sArg, "%d+%.%d+%.%d+%.%d+") then
if tSet.BlockIPs[sArg] then
tSet.BlockIPs[sArg] = nil
SaveFile("BlockedIPs.lst")
sUser:Send(tSet.BotName, "*** IP ( "..sArg.." ) is removed from block list")
else
sUser:Send(tSet.BotName, "*** IP ( "..sArg.." ) is not found in block list")
end
else
sUser:Send(tSet.BotName, "*** Enter a valid IP number")
end
return 1
end
tCommand["!sblocks"] = function(sUser,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 to remove IP from list \r\n"
list = list .."-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----+=+-----\r\n"
sUser:Send(tSet.BotName, list)
return 1
end
tCommand["!dop"] = function(sUser,sArg)
if sArg == "" then
sUser:Send(tSet.BotName, "*** Syntax: !dop ")
elseif string.lower(sArg) == "on" then
tSet.BlockUsersFromOperators = 1
sUser:Send(tSet.BotName, "*** Users can not download from operators")
elseif string.lower(sArg) == "off" then
tSet.BlockUsersFromOperators = 0
sUser:Send(tSet.BotName, "*** Users can download from operators")
else
sUser:Send(tSet.BotName, "*** Invalid paramenter")
end
return 1
end
function SaveFile(filename)
local file = io.open(filename, "w")
for ip,_ in tSet.BlockIPs do file:write(ip.."\n") end
file:close()
end
function LoadFile(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
function Extra(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
function SendCommands(sUser)
if tSet.GiveCom[sUser.iProfile] == 1 and sUser.bUserCommand then
sUser:SendData("$UserCommand 0 3")
sUser:SendData("$UserCommand 1 3 Download Blocker\\Block ip$<%[mynick]> !block %[line:IP]|")
sUser:SendData("$UserCommand 1 3 Download Blocker\\Unblock IP number$<%[mynick]> !unblock %[line:IP]|")
sUser:SendData("$UserCommand 1 3 Download Blocker\\Show Blocked IP list$<%[mynick]> !sblocks|")
sUser:SendData("$UserCommand 1 3 Download Blocker\\Block users from download from ops On/Off$<%[mynick]> !dop %[line:On/Off]|")
end
end
--// NightLitch
Hi!
And is it possible to have a line to specify a reason for blocking user ???
Thank you
tried this script works good a little too good can !allowip be added so ops,vip's can dl from each other ?
QuoteHere is an alternative script to use to block IPs to download and block users ( -1 ) to download from operators in hub.
QuoteAnd is it possible to have a line to specify a reason for blocking user ???
Where do i make this change ? is it here
tSet.BlockUsersFromOperators = 1
I change it to this but same results
tSet.BlockUsersFromOperators = -1
QuoteOriginally posted by chettedeboeuf
QuoteAnd is it possible to have a line to specify a reason for blocking user ???
Yes, although it would require an extra table to store that.
and @ slick :
!dop - Block users from download from ops On/Off
Somehow I feel i'm not getting my point across when i put the script in active mode: !dop op's can't DL from each other vip's can't DL from ops this isn't what i'm looking for, what i'm looking for is this: when script is active unregged can d/l from each other but cannot dl from higher profiles, vips and up can d/l from anyone I know the lua 4 script of leechblocker did this but i can't seem to find it in lua 5. If there is something in this script i'm missing please point it out to me cause i'm starting to feel like a fool :)