Ban Remover
 

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

Ban Remover

Started by nEgativE, 29 March, 2005, 11:31:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nEgativE

Hi, this script it's not working now.. becouse the new file format (xml) i think.. could someone help, please.. tks

--Requested by blackwings 
--Made by nErBoS

sBot = "BOT"

fPermBan = "../cfg/Banlist.xml"
arrAux = {}
sec = 1000
min = 60*sec
hour = 60*min
iTime = 1*hour	-- Checking Time

function Main()
	--frmHub:RegBot(sBot)
	SetTimer(iTime)
	StartTimer()
end

function OnTimer()
	CheckForBan()
	CleanBan()
end

function CheckForBan()

	handle = io.open(fPermBan)
	while 1 do
	local sLine = handle:read() 
	if (sLine == nil) then
	break
	else
	local s,e,ip,reason = string.find(sLine, "(%S+)|(%S+%s+%S+%s+%S+)")
	if (ip ~= nil and reason ~= nil and reason == "3x bad password") or (ip ~= nil and reason ~= nil) then
	arrAux[ip] = 1
end
end
end
	handle:flush()
	handle:close()
end

function CleanBan()

	local ip,aux
	for ip, aux in arrAux do
	Unban(ip)
end
end

Also have this funtion on another script.. do i need to change ?

function OpenRegisterdUsersFile()

	local handle = io.open("../cfg/RegisteredUsers.xml","r")
	for a,b in LEVELSTOT do
	LEVELSTOT[a]=0
end
	while 1 do
	local line = handle:read()
	local level 
	if line == nil then 
	handle:flush()
	handle:close()
	break 
end
	s,e,level = string.find(line,".+|.+|(.+)")
	if LEVELSTOT[level] then
	LEVELSTOT[level] = LEVELSTOT[level] +1
end
end  
end

*edited*

Jelf

The first script wont work anyways, cos its still in Lua 4,
Gonna look into readin the xml now

(NL)waarom

-- made by ??
-- converted to lua 5 by Typhoon?
-- by request by AmsterdamBulldogs


sBot = "Testing"

fPermBan = "../PermBan.dat"
arrAux = {}
sec = 1000
min = 60*sec
hour = 60*min
iTime = 30*min   -- Checking Time  set timer here

function Main()
   frmHub:RegBot(sBot)
   SetTimer(iTime)
   StartTimer()
end

function OnTimer()
   CheckForBan()
   CleanBan()
end

function CheckForBan()
   local file = io.input(fPermBan)
   for sLine in file:lines() do
      if (sLine == nil) then
         break
      else
         local s,e,ip,reason = string.find(sLine, "(%S+)|(%S+%s+%S+%s+%S+)")
         if (ip ~= nil and reason ~= nil and reason == "3x bad password") then
            arrAux[ip] = 1
         end
      end
   end
   file:close()
end

function CleanBan()
   local ip,aux
   for ip, aux in arrAux do
      Unban(ip)
   end
end
-----------------------------------------------------------------------
that's the lua 5 version of it but its not working in pto 16.09

jiten

(NL)waarom, that's because of the new file format (.xml) for the old .dat files.

Light

plz someone help with thet script......

(NL)waarom

(NL)waarom, that's because of the new file format (.xml) for the old .dat files.
--------------------------------------------------------------------

I no thats for the old .dat files.
but its not working when i replace  "../PermBan.dat" for
"../cfg/Banlist.xml" this why script whont give errors.
but its olso not working. ;)

jiten

Yups, it won't be solved by only renaming the files.
This script needs some extra coding. Check this to see the changes.

Best regards.

johny

#7
hi guy's
 could use some help with the next script

sBot = "Bad Password Cleaner"

sec = 1000
min = 60*sec
hour = 60*min
iTime = 1*min-- Checking Time

function Main()
	SetTimer(iTime)
	StartTimer()
end

function OnTimer()
	local t = XMLFiletoTable();
	for i,v in t.perm do
		if (v.ip and v.nick) then
			if (v.nick == "3x bad password") then
				UnBan(v.ip)
			end
		end
	end
end

--[[ -------------------------------------------------------------------------------
Author: Herodes
Thanks : RambitWombat for the Lua 4 XMLtoTable func

Usage : 
	table, time = XMLFiletoTable ( f ) 
		'table' is the file signified by 'f' as a table, 
		'time' the time took for parsing it (usually 0.00xxx s)
		'f' can be 1 =BanList.xml / 2 =Profiles.xml / 3 =RegisteredUsers.xml / 4 =ReservedNicks.xml / 5 =Scripts.xml
--]] -------------------------------------------------------------------------------
function XMLFiletoTable()
	local function get_Inner( sString, b ) --- based on the XMLtoTable provided by RambitWombat in the Lua Board
					if( not sString ) then return ""; end
					local s,e, sTag, sTemp = string.find(sString, "^%s*<([^>]+)>(.*)$");
					local sInner;
					-- we have a tag
					if (sTag) then
						sString = sTemp;
						local tTable = {};
						while sTag do
							s,e, sTag = string.find(sTag, "^(%S+)");
							s,e, sInner, sTemp = string.find(sString, "^(.-)(.*)$");
							if( not tTable[sTag] ) then tTable[sTag] = {}; end
							table.insert( tTable[sTag], get_Inner( sInner ) );
							if sTemp then
								s, e, sTag, sString = string.find( sTemp, "^%s*<([^>]-)>(.*)$");
							end
						end
						if table.getn(tTable) == 1 then return tTable[1]; end
						return tTable;
					else -- we have data
						return sString;
					end
				end

	local function FileToString( file )
			local m = ""; local f = io.open( file, "r");
			for line in f:lines() do
				if string.sub( line, 1, 5) ~= "

it gives me still an error on the next line

         return { ["perm"] = tbl.BanList.PermBans.Ban, ["temp"] = tbl.BanList.TempBans.Ban }

Syntax D:\Robocop 10.01c\scripts\3XBadPassWord.xml.lua5.lua:66: attempt to index field `PermBans' (a nil value)

The_Fox

#8
Hey, johny!
I didn't have much time (and I won't until the end of school year), so I played with the script only a bit, but even from that bit I've learned that there are some issues with the get_Inner function:

The XML parser you've used doesn't expect an empty XML (I don't mean entirely empty now, just XML containing an empty BanList) and freezes in a recursive neverending loop in case of empty banlist.

When the banlist isn't empty, it seems to still have problems with parsing... it's either a problem with an empty temp-ban/perm-ban list, or there's an even more serious bug. Sorry I can't help more ATM, work seems to be flowing from all directions :-/.

Btw. I've changed the code a bit, so it looked more LUA-like (less C-like), I'll paste it for those, who keep getting lost in the previous code ;-)...

sBot = "Bad Password Cleaner"

sec = 1000
min = 60*sec
hour = 60*min
iTime = 1*min --Checking Time

function Main()
	SetTimer(iTime)
	StartTimer()
end

function OnTimer()
	local t = XMLFiletoTable()
	for i, v in pairs(t.perm) do
		if v.ip and v.nick then
			if v.nick == "3x bad password" then UnBan(v.ip) end
		end
	end
end

--------------------------------------------------------------------------------------------------------------------
-- Author: Herodes
-- Thanks : RambitWombat for the Lua 4 XMLtoTable func

-- Usage : 
--	table, time = XMLFiletoTable (f) 
--		'table' is the file signified by 'f' as a table, 
--		'time' the time took for parsing it (usually 0.00xxx s)
--		'f' can be 1 =BanList.xml / 2 =Profiles.xml / 3 =RegisteredUsers.xml / 4 =ReservedNicks.xml / 5 =Scripts.xml
--------------------------------------------------------------------------------------------------------------------
function XMLFiletoTable()
	local function get_Inner(sString) --- based on the XMLtoTable provided by RambitWombat in the Lua Board
      if not sString then return "" end
		local s, e, sTag, sTemp = string.find(sString, "^%s*<([^>]+)>(.*)$")
		local sInner
		--we have a tag
		if sTag then
			sString = sTemp
			local tTable = {}
			while sTag do
				s, e, sTag = string.find(sTag, "^(%S+)")
				s, e, sInner, sTemp = string.find(sString, "^(.-)(.*)$")
				if not tTable[sTag] then tTable[sTag] = {} end
				table.insert(tTable[sTag], get_Inner(sInner))
				if sTemp then s, e, sTag, sString = string.find( sTemp, "^%s*<([^>]-)>(.*)$") end
         end
			if table.getn(tTable) == 1 then return tTable[1] end
			return tTable
		else --we have data
			return sString
		end
	end

	local function FileToString(file)
		local m = ""
      local f = io.open(file, "r")
		for line in f:lines() do
			if string.sub(line, 1, 5) ~= "

SMF spam blocked by CleanTalk