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*
The first script wont work anyways, cos its still in Lua 4,
Gonna look into readin the xml now
-- 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
(NL)waarom, that's because of the new file format (.xml) for the old .dat files.
plz someone help with thet script......
(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. ;)
Yups, it won't be solved by only renaming the files.
This script needs some extra coding. Check this (http://board.univ-angers.fr/thread.php?threadid=4082&boardid=4&sid=3d410bb9c33de29e244a9dc838062d12) to see the changes.
Best regards.
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, "^(.-)"..sTag..">(.*)$");
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) ~= " end; f:close(); return m
end
local function getFin( tbl )
return { ["perm"] = tbl.BanList.PermBans.Ban, ["temp"] = tbl.BanList.TempBans.Ban }
end
return getFin(get_Inner(FileToString("../cfg/BanList.xml")));
end
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)
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, "^(.-)"..sTag..">(.*)$")
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) ~= " end
f:close()
return m
end
local function getFin(tbl)
return {["perm"] = tbl.BanList.PermBans.Ban, ["temp"] = tbl.BanList.TempBans.Ban}
end
return getFin(get_Inner(FileToString("../cfg/BanList.xml")))
end