OpSecurity + IPblocker
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

OpSecurity + IPblocker

Started by Marco52, 27 December, 2006, 16:49:51

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marco52

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.

Snooze

#1
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

/Edit
Removed localhost to avoid confusion

Marco52

Script is blocking only IP profile OP.
Is not blocking ip user: Vip, registered, unregistered.  :(

Snooze

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

Marco52

Script works well  :)
Thank you very much, Snooze.


SMF spam blocked by CleanTalk