PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Skyhawk on 11 May, 2004, 16:39:34

Title: Anti Double Login Bot (Stand-alone)
Post by: Skyhawk on 11 May, 2004, 16:39:34
Well my request is a simple:

I need a script/bot that automatically disconnects a nick/user if the same ip address is already in use on my hub. It should also be possible to manually scan for double logins after the script is running. Further, if possible, OP's and selected Nicks should be left unaffected by this script. OP's by default and slected users by a list which is controlled by commands like:

+addnick
+delnick
+rescan


Can anyone help me with this?

Thx in advance
Title:
Post by: ??????Hawk?????? on 11 May, 2004, 18:24:45
This one works pretty good m8

hope it helps




-- An easy DoublesKickBot by piglja - 26/04/03
-- Added a IP script by piglja - 29/04/03. IP Allow script by Don Leon, if I remember correct...

ip={}
oAllow={}

function Main()
oAllow["127.0.0.1"]=1 --Just an example;)
end

function NewUserConnected(user)
if not user.bOperator then
theIP=user.sIP
local a,b,c,d=splittip(theIP)
if ip[user.sIP] == nil then
ip[user.sIP]=user.sIP
elseif ((oAllow[a]==1)or(oAllow[b]==1)or(oAllow[c]==1)or(oAllow[d]==1)) then
else
SendToAll("!!!Alert Clone user kicked Nick:-  "..user.sName.."  IP:- "..user.sIP)
user:Kick("No doubles allowed!!!")
end
end
end

function UserDisconnected(user)
ip[user.sIP]=nil
end

function splittip(IP)
r,g,a,b,c,d = strfind(IP, "(%d*).(%d*).(%d*).(%d*)")
d=a.."."..b.."."..c.."."..d
c=a.."."..b.."."..c..".*"
b=a.."."..b..".*"
a=a..".*"
return a,b,c,d
end

Title:
Post by: HaArD on 11 May, 2004, 19:51:25
You do realize that you are making the flawed assumption that User = IP?

Therefore 2 or more people who:

 - Live in the same home behind a NAT device
 - Go to the same school behind a NAT device
 - Work for the same company behind a NAT device
 - Use the same ISP who happens to share IP's among it's users (common practice in some European countries)

Will not be able to connect to your hub at the same time and in most cases will not have any idea why, since they are not "Clones" or "Doubles" they are just themselves.....
Title:
Post by: Skyhawk on 11 May, 2004, 20:15:56
I know that  thats why i want to have the  do not disconnect options for certain users
Title:
Post by: ??????Hawk?????? on 12 May, 2004, 01:57:45
you could always change this line:-

user:Kick("No doubles allowed!!!")

to this:-

user:Kick("You are sharing the same ip as another user in this hub. Please pm the hub owner from the other connection to have your Nick cleared.  Sorry for any inconveniance")
Title:
Post by: Corayzon on 12 May, 2004, 04:35:47
this scripts could really take up some memory on large hubs...

cant ya get the userlist and loop through it to check for ips rather then duplicating stored memory?

doing so could save a shitload of memory when u have 1000 users
Title:
Post by: TyShkan on 01 September, 2004, 20:35:53
QuoteOriginally posted by Mutor
This script informs the opchat of a clone. Easy enough to mod.

--Clone Alert 1.0
--by Mutor The Ugly
--PM Clone login to Opchat
--
--
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--OpChatName = "opschat" --Use this line for a scripted opchat
 
function Main()
frmHub:EnableFullData(1)
end

function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
user1 = GetItemByName(user1)


if user1 ~= nil then
if user1.sIP == curUser.sIP    then
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName)

end
end
end
end
Hi! Who's can modify this script? I would like, that script disconnect new user, if they have already 2 clon's on the hub...
Title:
Post by: nErBoS on 01 September, 2004, 21:53:50
Hi,

Done...

--Clone Alert 1.0
--by Mutor The Ugly
--PM Clone login to Opchat
--
--
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--OpChatName = "opschat" --Use this line for a scripted opchat
 
function Main()
frmHub:EnableFullData(1)
end

function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
user1 = GetItemByName(user1)


if user1 ~= nil then
if user1.sIP == curUser.sIP    then
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName)
[b]curUser:Disconnect()[/b]
end
end
end
end

Best regards, nErBoS
Title:
Post by: blackwings on 01 September, 2004, 23:33:14
Nerbos, I think you misunderstood TyShkan. I think he meant that that 2 users with the same IP is ok, but the third users that connects with the same IP will be disconnected.
Title:
Post by: TyShkan on 02 September, 2004, 14:29:34
QuoteOriginally posted by blackwings
Nerbos, I think you misunderstood TyShkan. I think he meant that that 2 users with the same IP is ok, but the third users that connects with the same IP will be disconnected.
Hi!
Yes, it's right :D Nerbos is misunderstood me ;) On hub are 2 users with same IP, when Connecting 3d user withs same IP, his will be disconnected...
Title:
Post by: nErBoS on 02 September, 2004, 22:26:38
Hi,

Sorry, try this then...

--Clone Alert 1.0
--by Mutor The Ugly
--PM Clone login to Opchat
--
--
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--OpChatName = "opschat" --Use this line for a scripted opchat

arrClone = {}
 
function Main()
frmHub:EnableFullData(1)
end

function UserDisconnected(user)
if (arrClone[user.sIP] ~= nil) then
arrClone[user.sIP] = arrClone[user.sIP] - 1
end
end

function DataArrival(curUser,sdata)
local _,_,user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
local clone
user1 = GetItemByName(user1)
if user1 ~= nil then
if user1.sIP == curUser.sIP    then
if (arrClone[user1.sIP] == nil) then
arrClone[user1.sIP] = 1
else
arrClone[user1.sIP] = arrClone[user1.sIP] + 1
end
if (arrClone[user1.sIP] == 2) then
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName)
curUser:Disconnect()
end
end
end
end
end

Best regards, nErBoS
Title:
Post by: TyShkan on 06 September, 2004, 15:02:22
Hi! I have some trouble! This script disconnect users:
[16:53:40] *** Connected: User[1comp]
[16:53:45] *** Connected: User[2comp]
ok
[16:55:32] *** Disconnected: User[2comp]
[16:56:07] *** Connected: User[2comp]
disconnect user
Can you change script?
Title:
Post by: nErBoS on 06 September, 2004, 16:33:02
Hi,

I have edited the script above, try out.

Best regards, nErBoS