PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: Marco52 on 27 December, 2006, 16:49:51

Title: OpSecurity + IPblocker
Post by: Marco52 on 27 December, 2006, 16:49:51
Please add a function which allow me block several IP and when someone is blocked script should send the reason of block.
e.g "Your account was blocked - please contact with the administrator" .
The message should be different than the messages for operators.

-- OpSecurity 0.1 Lua5
-- Small Op Account Protection script
-- by ']['yphoon?
-- thx to Mutor for helping me when being blind/stupid
-- write dynip to disable the check on the user

tSetup={}
tSetup.Bot = "botname"
tSetup.Email = "secured@net.nl"
tSetup.OpSecurity = {
[""] = "",
["opnick"] = "88.88.88.88",
}


function OpConnected(user)
if tSetup.OpSecurity[user.sName] then
local Name = user.sName
if ((tSetup.OpSecurity[Name] == user.sIP) or (tSetup.OpSecurity[Name] == "dynip")) then
user:SendPM(tSetup.Bot,"You have passed the IP-Check !")
else
local msg = ""
msg = msg.."\r\n\t\tYou Have Been Banned For Using A Op Account That Don't Belong To You"
msg = msg.."\r\n\t\tIf YOU really are an Operator at this hub,and just got a new Ip"
msg = msg.."\r\n\t\tThen Mail to this address "..tSetup.Email
user:SendData(tSetup.Bot,msg)
user:Ban()
Unban(Name)
end
end
end

Thanks in advance.
Title: Re: OpSecurity + IPblocker
Post by: Snooze on 27 December, 2006, 20:56:32
I think this is what you asked for - else shout and I'll redo it :)

-- OpSecurity 0.1 Lua5
-- Small Op Account Protection script
-- by ']['yphoon?
-- thx to Mutor for helping me when being blind/stupid
-- write dynip to disable the check on the user

tSetup={}
tSetup.Bot = "botname"
tSetup.Email = "secured@net.nl"
tSetup.OpSecurity = {
[""] = "",
["opnick"] = "88.88.88.88",
}
tSetup.BlockedIP = { -- Blocked IPs
["22.22.22.22"] = 1,
["22.22.22.22"] = 1,
["22.22.22.22"] = 1,
}


function OpConnected(user)
if tSetup.BlockedIP[user.sIP] then
user:SendData(tSetup.Bot,"Your account was blocked - please contact with the administrator")
user:Disconnect()
return 1
end
if tSetup.OpSecurity[user.sName] then
local Name = user.sName
if ((tSetup.OpSecurity[Name] == user.sIP) or (tSetup.OpSecurity[Name] == "dynip")) then
user:SendPM(tSetup.Bot,"You have passed the IP-Check !")
else
local msg = ""
msg = msg.."\r\n\t\tYou Have Been Banned For Using A Op Account That Don't Belong To You"
msg = msg.."\r\n\t\tIf YOU really are an Operator at this hub,and just got a new Ip"
msg = msg.."\r\n\t\tThen Mail to this address "..tSetup.Email
user:SendData(tSetup.Bot,msg)
user:Ban()
Unban(Name)
end
end
end


-Snooze (http://www.dixbot.com)

/Edit
Removed localhost to avoid confusion
Title: Re: OpSecurity + IPblocker
Post by: Marco52 on 29 December, 2006, 01:34:39
Script is blocking only IP profile OP.
Is not blocking ip user: Vip, registered, unregistered.  :(
Title: Re: OpSecurity + IPblocker
Post by: Snooze on 29 December, 2006, 02:29:18
Now includes all Profiles..

-- OpSecurity 0.1 Lua5
-- Small Op Account Protection script
-- by ']['yphoon?
-- thx to Mutor for helping me when being blind/stupid
-- write dynip to disable the check on the user
-- few modifications by Snooze

tSetup={}
tSetup.Bot = "botname"
tSetup.Email = "secured@net.nl"
tSetup.OpSecurity = {
[""] = "",
["opnick"] = "88.88.88.88",
}
tSetup.BlockedIP = { -- Blocked IPs
["22.22.22.22"] = 1,
["22.22.22.22"] = 1,
["22.22.22.22"] = 1,
}


OpConnected = function(user)
doBlockedIp(user)
if tSetup.OpSecurity[user.sName] then
local Name = user.sName
if ((tSetup.OpSecurity[Name] == user.sIP) or (tSetup.OpSecurity[Name] == "dynip")) then
user:SendPM(tSetup.Bot,"You have passed the IP-Check !")
else
local msg = ""
msg = msg.."\r\n\t\tYou Have Been Banned For Using A Op Account That Don't Belong To You"
msg = msg.."\r\n\t\tIf YOU really are an Operator at this hub,and just got a new Ip"
msg = msg.."\r\n\t\tThen Mail to this address "..tSetup.Email
user:SendData(tSetup.Bot,msg)
user:Ban()
Unban(Name)
end
end
end

NewUserConnected = function(user)
doBlockedIp(user)
end


doBlockedIp = function(user)
if tSetup.BlockedIP[user.sIP] then
user:SendData(tSetup.Bot,"Your account was blocked - please contact with the administrator") --<-- This is the message the blocked user will get!
user:Disconnect()
return 1
end
end


Greets,
Snooze (http://www.dixbot.com)
Title: Re: OpSecurity + IPblocker
Post by: Marco52 on 29 December, 2006, 23:19:10
Script works well  :)
Thank you very much, Snooze.
Title: Re: OpSecurity + IPblocker
Post by: Snooze on 30 December, 2006, 00:21:36
You're welcome :)

-Snooze (http://www.dixbot.com)