RangeFucker by bastya_elvtars
 

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

RangeFucker by bastya_elvtars

Started by bastya_elvtars, 24 May, 2005, 14:24:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bastya_elvtars

Many requests arrived to me... So fiant voluntates tuae (plural!!!) and here you go.

(Also, I was told that I am just jawing here but doing nothing productive... :D)

 Basically you have to do nothing, set the commands and play with OP protection. More things are in the comments.

-- range fucker by bastya_elvtars (the rock n' roll doctor)
-- it was standalone, but got into lawmaker as well.
-- some code from easyranger by tezlo
-- checks if ips are valid and if ranges are really ranges :D
-- thx go out to Herodes for IP validation, Typhoon for paying attention, and plop for finding the bug i couldn't
-- also thx to NightLitch, i always wanna make same scripts as him but much bettter ones :D
-- and to nerbos for his ranger ;)
-- at the moment ONLY Masters with profile 0 can use this. Will change l8r on. :)
-- enjoy

--v1.0:released
--v1.1: fixed some shit ;)
--v1.2: converted to lua5
--v 1.3RC: small fixes and optimizations

-- TODO: optimize command parsing and make user rights management as I usually do :P

-- prefixes:!+#

cmd1="banrange"

cmd2="showranges"

cmd3="unbanrange"

cmd4="rangehelp"

Bot="---===Ranger===---"

opsips=1 -- set 0 to protect OPs

function ChatArrival(user,data)
	data=string.sub(data,1,string.len(data)-1)
	local _,_,cmd=string.find(data,"%b<>%s+[%!%+%#](%S+)")
	if cmd==cmd1 and user.iProfile==0 then
		checknban(user,data) return 1
	elseif cmd==cmd2 and user.iProfile==0 then
		user:SendPM(Bot,showipranges()) return 1
	elseif cmd==cmd3 and user.iProfile==0 then
		unbanrange(user,data) return 1
	elseif cmd==cmd4 and user.iProfile==0 then
		help(user) return 1
	elseif cmd==cmd1 or cmd==cmd2 or cmd==cmd3 or cmd==cmd4 and user.iProfile~=0 then
		user:SendData(Bot,"You dont have suficiebt rights to use this command.")
		return 1
	end
end

function checknban(user,data)
	local _,_,ip1,ip2=string.find(data,"%b<>%s+%S+%s+(%d+%.%d+%.%d+%.%d+)%-(%d+%.%d+%.%d+%.%d+)")
	if ip1 and ip2 then
		if ipchk(ip1)~="shit" then
			if ipchk(ip2)~="shit" then
				if calculate(ip1)=calculate(a) and calculate(user.sIP)<=calculate(b) then
			user:SendData(Bot,"Your IP range ("..a.."-"..b..") is banned in here...")
			user:Disconnect()
			return 1
		end
	end
	collectgarbage()
	io.flush()
end

-- old function, left 4 experimenting
--function ipchk(ip)
--	gsub(ip,"(%d+)",function(ipp)
--						if tonumber(ipp)>255 then
--							return "shit"
--						end
--					end)
--end

function ipchk(ip)
	local tIP = {}
	_,_,tIP.a,tIP.b,tIP.c,tIP.d= string.find(ip, "(%d+)%.(%d+)%.(%d+)%.(%d+)")
	for a,b in tIP do 
		if tonumber(b)<0 or tonumber(b)> 255 then
			return "shit"
		end
	end
	tIP=nil
	collectgarbage()
	io.flush()
end

function unbanrange(user,data)
	local _,_,ip1,ip2=string.find(data,"%b<>%s+%S+%s+(%d+%.%d+%.%d+%.%d+)%-(%d+%.%d+%.%d+%.%d+)")
	if ip1 and ip2 then
		if ipranges[ip1]==ip2 then
			user:SendData(Bot,"Range "..ip1.."-"..ip2.." unbanned.")
			ipranges[ip1]=nil
			save(ipranges)
			ipranges=loadipranges()
		else
			user:SendData(Bot,"Range was not banned...")
		end
	else
		user:SendData(Bot,"Bad usage! Usage: !"..cmd3.." xxx.xxx.xxx.xxx-yyy.yyy.yyy.yyy")
	end
end

function showipranges()
	local msg="All banned IP ranges:\r\n=============================\r\n"
	for a,b in ipranges do
		msg=msg..a.." - "..b.."\r\n"
	end
	msg=msg.."=============================\r\n"
	return msg
end


function Main()
	frmHub:RegBot(Bot)
	ipranges=loadipranges()
	if opsips==1 then
		OpConnected=NewUserConnected
	end
end

function help(user)
	local msg="Bot usage:\r\n\r\n"..
	cmd1.." \t\tAdd an IP range to banlist.\r\n"..
	cmd2.."\t\tShow a list of currently banned IP ranges.\r\n"..
	cmd3.." \tUnbans an IP range.\r\n"..
	cmd4.."\t\t\tThis help screen ;)\r\n"
	user:SendPM(Bot,msg)
end
Everything could have been anything else and it would have just as much meaning.

TTB

Nice one... Maybe ppl like also to add a reason why the range is banned... just an idea.
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

bastya_elvtars

QuoteOriginally posted by TTB
Nice one... Maybe ppl like also to add a reason why the range is banned... just an idea.

Yes, and banned nick too...
Everything could have been anything else and it would have just as much meaning.

witch

QuoteOriginally posted by bastya_elvtars
Many requests arrived to me... So fiant voluntates tuae (plural!!!) and here you go.

(Also, I was told that I am just jawing here but doing nothing productive... :D)

 Basically you have to do nothing, set the commands and play with OP protection. More things are in the comments.
hola, sorry me not a scripter. i would like to run this script, but i can't understend how i should set up the cmds, please can u show the example?

i tryed to add perflexes on cmd, but still nothing works  ?(

please help  :P



bastya_elvtars

QuoteOriginally posted by witch
hola, sorry me not a scripter. i would like to run this script, but i can't understend how i should set up the cmds, please can u show the example?

i tryed to add perflexes on cmd, but still nothing works  ?(

please help  :P

Do not use it, I will post a much les reource demanding version when the appropriate library gets released by bluebear.
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk