here is the standalone version of the ConnectToMe filter from deflood converted 2 lua 5.
tiny bit enhanced, ip's are linked 2 nicks.
but only 1 nick per IP.
--------------------------------
-- LUA 5.
--------------------------------
-- standalone CTM filter.
-- kicks wrong of private IP's.
-- you need a folder called "deflood".
--------------------------------
-- by plop.
--------------------------------
tSet = {
---- the name of the bot.
Bot = "Deflood_5.0",
---- how long the time ban takes.
iTimeBan = 10,
---- don't check the next IP's on fake $ConnectToMe's.
---- (for hub owners who are behind a NAT router)
-- ["ip"] = "nickname",
tIPs = {
["127.0.0.1"] = "certainnick",
["127.0.0.2"] = "othernick",
}
}
------ DON"T TOUCH THE NEXT TABLE.
tPriv = {
[3232235520] = 3232301055,
[2886729728] = 2887778303,
[167772160] = 184549375
}
------ ok you can start touching below here again.
function ConnectToMeArrival(user, data)
local sUser = user.sName
local s,e,ip = string.find(data, "(%S+):%d+|$")
if ip and tSet.tIPs[user.sIP] ~= user.sName then
if ip ~= user.sIP then
local s,e,dIP1,dIP2,dIP3,dIP4 = string.find(ip, "(%d+)%.(%d+)%.(%d+)%.(%d+)")
if dIP1 and dIP2 and dIP3 and dIP4 then
dIP1 = (tonumber(dIP1) * 16777216) + (tonumber(dIP2) *65536) + (tonumber(dIP3) * 256) + (tonumber(dIP4))
for a,b in tPriv do
if dIP1 >= a and dIP1 <= b then
local sLog = (os.date("%X").." - "..sUser.." - "..user.sIP.." private IP.")
StoreLog(sLog)
SendPmToOps(tSet.Bot, sLog)
local sSend = "You either left the IP box from your active settings empty or you placed a private IP"..
"in there by accident!\r\nIP's like this will not resolve outside your local network, change it for "..user.sIP
user:SendData(tSet.Bot, sSend)
user:Disconnect()
return 1
end
end
local sSend = "You have the wrong IP in the active settings from your DC client!!\r\n"..
"You have set it to "..ip..", the IP you should have set it on is: "..user.sIP..".\r\n"..
"For Safety reasons you are now banned for minutes\r\n"..
"For more info about how to setup active mode you should look at the next website's:\r\n"..
"Default router setup manual: ---> [URL]http://www.plop.nl/lua_tools/dc-active.zip\r\n[/URL]"..
"Specialized router manuals: ---> [URL]http://www.portforward.com\r\n[/URL]"..
"Official dc++ faq: ---> [URL]http://dcplusplus.sourceforge.net/faq/faq.php?display=faq&faqnr=11&catnr=2&prog=1&lang=en&onlynewfaq=1[/URL]"
local sLog = os.date("%X").." - "..sUser.." - "..user.sIP.." wrong IP."
StoreLog(sLog)
SendPmToOps(tSet.Bot, sLog)
user:SendData(tSet.Bot, sSend)
user:TimeBan(tSet.iTimeBan)
else
local sLog = (os.date("%X").." - "..sUser.." - "..user.sIP.." incomplete/faulty IP.")
StoreLog(sLog)
SendPmToOps(tSet.Bot, sLog)
local sSend = "An IP contains 4 numbers seperated by 3 dots. Your correct IP is "..user.sIP
user:SendData(tSet.Bot, sSend)
user:Disconnect()
end
return 1
end
end
end
function StoreLog(msg)
local sDate = string.gsub(os.date("%x"), "%D", "-")
local fFile = io.open("deflood/"..sDate..".log", "a+")
fFile:write(msg.."\n")
fFile:close()
end
plop
Could you please modify this so it would work silently.
Thank you in advance.
QuoteOriginally posted by Jaakko
Could you please modify this so it would work silently.
Thank you in advance.
If you want to make it completely silent for everyone (user/OPs) comment the lines starting with "user:SendData" and "SendPmToOps".
If only for Ops just those beginning with "SendPmToOps".
Cheers
i use 2 clients from the same internal ip i have 2 diferent names but when you put the internal ip and names in only alows 1 the other one gets d/c can you change it to alow the use of 2 names on the same internal ip
then try setting 1 client with 127.0.0.1 and the other with whatever IP your network card has like 192.168.1.1 or so
otherwise in the script you can also set ips not to be checked
You can try 127.0.0.2 or so.
i have put in the names and the ip's not to be checked the first name in the list is d/c and time banned. my internaml ip is 192.168.0.2 it worked for both when deflood was stand alone before it was built into ptokax
QuoteOriginally posted by damo
i have put in the names and the ip's not to be checked the first name in the list is d/c and time banned. my internaml ip is 192.168.0.2 it worked for both when deflood was stand alone before it was built into ptokax
Try also adding 192.168.0.x to tIPs and see what happens.
Cheers
still the same as before no change at all
QuoteOriginally posted by damo
still the same as before no change at all
For example, if this is your table:
tIPs = {
["127.0.0.1"] = "localnick",
["192.168.0.2"] = "netnick",
}
Then, connect with "localnick" to 127.0.0.1 and "netnick" to 192.168.0.2
It must work this way.
Cheers
still aint working doing it that way to :(
QuoteOriginally posted by damo
still aint working doing it that way to :(
I tested it earlier and it worked. Didn't get disconnected.
The IP and nicks in the scripts and clients have to exactly the same.
--------------------------------
--LUA 5.
--------------------------------
-- standalone CTM filter.
-- kicks wrong of private IP's.
-- you need a folder called "deflood".
--------------------------------
-- by plop.
--------------------------------
-- Modded by Madman
-- Added a counter, at the 5 warnign msg, they will get tempbanned
-- Requested by Pothead
tSet = {
---- the name of the bot.
Bot = "Deflood_5.0",
---- how long the time ban takes.
iTimeBan = 10,
---- don't check the next IP's on fake $ConnectToMe's.
---- (for hub owners who are behind a NAT router)
-- ["ip"] = "nickname",
tIPs = {
["127.0.0.1"] = "certainnick",
["127.0.0.2"] = "othernick",
}
}
------ DON"T TOUCH THE NEXT TABLE.
tPriv = {
[3232235520] = 3232301055,
[2886729728] = 2887778303,
[167772160] = 184549375
}
------ ok you can start touching below here again.
-- Table to store the Warnings
WarnLog = {}
function ConnectToMeArrival(user, data)
local sUser = user.sName
local s,e,ip = string.find(data, "(%S+):%d+|$")
if ip and tSet.tIPs[user.sIP] ~= user.sName then
if ip ~= user.sIP then
local s,e,dIP1,dIP2,dIP3,dIP4 = string.find(ip, "(%d+)%.(%d+)%.(%d+)%.(%d+)")
if dIP1 and dIP2 and dIP3 and dIP4 then
dIP1 = (tonumber(dIP1) * 16777216) + (tonumber(dIP2) *65536) + (tonumber(dIP3) * 256) + (tonumber(dIP4))
for a,b in tPriv do
if dIP1 >= a and dIP1 <= b then
local sLog = (os.date("%X").." - "..sUser.." - "..user.sIP.." private IP.")
StoreLog(sLog)
SendPmToOps(tSet.Bot, sLog)
local sSend = "You either left the IP box from your active settings empty or you placed a private IP"..
"in there by accident!\r\nIP's like this will not resolve outside your local network, change it for "..user.sIP
user:SendData(tSet.Bot, sSend)
user:Disconnect()
return 1
end
end
sSend = "You have the wrong IP in the active settings from your DC client!!\r\n"..
"You have set it to "..ip..", the IP you should have set it on is: "..user.sIP..".\r\n"..
"For more info about how to setup active mode you should look at the next website's:\r\n"..
"Default router setup manual: ---> [URL]http://www.plop.nl/lua_tools/dc-active.zip\r\n[/URL]"..
"Specialized router manuals: ---> [URL]http://www.portforward.com\r\n[/URL]"..
"Official dc++ faq: ---> [URL]http://dcplusplus.sourceforge.net/faq/faq.php?display=faq&faqnr=11&catnr=2&prog=1&lang=en&onlynewfaq=1\r\n[/URL]"
if WarnLog[user.sName] == nil then
WarnLog[user.sName] = 1
else
WarnLog[user.sName] = WarnLog[user.sName] + 1
end
if WarnLog[user.sName] >= 5 then
sSend = sSend.."For Safety reasons you are now banned for " ..tSet.iTimeBan.. " minutes\r\n"
user:TimeBan(tSet.iTimeBan)
WarnLog[user.sName] = nil
end
local sLog = os.date("%X").." - "..sUser.." - "..user.sIP.." wrong IP."
StoreLog(sLog)
SendPmToOps(tSet.Bot, sLog)
user:SendData(tSet.Bot, sSend)
else
local sLog = (os.date("%X").." - "..sUser.." - "..user.sIP.." incomplete/faulty IP.")
StoreLog(sLog)
SendPmToOps(tSet.Bot, sLog)
local sSend = "An IP contains 4 numbers seperated by 3 dots. Your correct IP is "..user.sIP
user:SendData(tSet.Bot, sSend)
user:Disconnect()
end
return 1
end
end
end
function StoreLog(msg)
local sDate = string.gsub(os.date("%x"), "%D", "-")
local fFile = io.open("deflood/"..sDate..".log", "a+")
fFile:write(msg.."\n")
fFile:close()
end
A small mod ;)
Give 4 warnigns, at 5th it tempbans
Hi Ppl .. G Morning..
its can be convert to lua 5.1 ? ::)
tnx ;D
Change:
for a,b in tPriv do
Whit:
for a,b in pairs(tPriv) do
Good Morning :D
Thanks you Very Much 6Marilyn6Manson6 !!! :-*
Good Morning and welcome :D