[solved] bug in account protection
 

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

[solved] bug in account protection

Started by eMTee, 07 March, 2007, 22:35:43

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

eMTee

Ive tried to use the long awaited multiple IP account protection in 3.1 without success. The IP's are added to the
IP_check table fine but it didn't worked.
After several bans of my own account I've gone to debug the source and found that its not working
because of buggy code. Login is working only if you go from the first IP in the table for every user.

Here is a solution

Code: lua
Check_IP = function(user,data)
	local Name = user.sName
        local Found = false
	for i,v in pairs(IP_Check[Name]) do
		if  i == user.sIP or WSA.GetHostByName(i) == user.sIP then
			user:SendData(Cfg.Bot_Name,"IP check passed !  - "..user.sIP)
                        Found = true
			break
		end
	end
	if (not Found) then
			IP_Check_Failed_Message(user)
			user:SendData(Cfg.Bot_Name," - "..user.sIP)
			user:SendData(Cfg.Bot_Name,IP_Check[Name])
			TempBan(user.sIP,0,"IP check failed",Cfg.Bot_Name,0)
			NickTempBan(user.sName,0,"IP check failed",Cfg.Bot_Name)
			SendToOps(Cfg.Bot_Name,Cvrt.P2[user.iProfile].." ".. user.sName.." from "..user.sIP.." has been Disconnected and TempBanned because IP check failed.")
	end
	Clear()
end

Its working ok on my hub for a week
I pmed this to Time a week ago or so but he isn't reacted so I placed it here too...


Thor

Can you post how the table/array looks like?

Cêñoßy†ê

#2
Not fully tested tho but should work, let me know if problems (added dns name to protection) ::)
Code: lua
Check_IP = function(user,data)	-- fix originally made by eMTee from http://forum.ptokax.org
	local pass,who = false,user.sName
	for i,key in pairs(IP_Check[who]) do
		if i == user.sIP or WSA.GetHostByName(i) == user.sIP or i == WSA.GetHostByAddr(user.sIP) then
			user:SendData(Cfg.Bot_Name,"IP check passed !")
			pass = true
			return 1
		end
	end
		if not pass then
			IP_Check_Failed_Message(user)
			user:SendData(Cfg.Bot_Name,IP_Check[Name])
			TempBan(user.sIP,0,"IP check failed",Cfg.Bot_Name,0)
			NickTempBan(user.sName,0,"IP check failed",Cfg.Bot_Name)
			SendToOps(Cfg.Bot_Name,Cvrt.P2[user.iProfile].." ".. user.sName.." from "..user.sIP.." has been Disconnected and TempBanned because IP check failed.")
		end
	Clear()
end
Powered By Leviathan™ 2nd Generation v. 1.9

eMTee

Nice because this way it eliminates that lots of unneccesary host resolves in the loop.
Seems it works as it should.  8)

Cêñoßy†ê

Quote from: eMTee on 08 March, 2007, 16:14:30
Nice because this way it eliminates that lots of unneccesary host resolves in the loop.
Seems it works as it should.  8)


Your way was the working one.. mine didnt like hub address as protection  :P

Post updated with correct version
Powered By Leviathan™ 2nd Generation v. 1.9

eMTee

OK I updated... its working, the only one problem is if you have eg 6 ips / dns's for a name and you log in from the ip what is in 6th index of the table those 5 reverse dns resolves can take even 15 secs at login...

I can't see why do you need that though ( i == WSA.GetHostByAddr(user.sIP) ) it works fine without it... many of my ops has their own hub address or dynamic dns set and they can connect from there with their dns address added to the table...

Cêñoßy†ê

Quote from: eMTee on 09 March, 2007, 13:38:08
I can't see why do you need that though ( i == WSA.GetHostByAddr(user.sIP) ) it works fine without it... many of my ops has their own hub address or dynamic dns set and they can connect from there with their dns address added to the table...

That part is from lv 3.2 that has dns name stuffs added (ban/get dns name)

[19:51:58] <?Debug?LV?3.2> <C??o?y??> !getdnsname (adsl)Guq
[19:51:58] <?Leviathan_3.2?> *** (adsl)Guq's dns name is dsl-sjkgw4-fef4f800-192.dhcp.inet.fi (84.248.244.192)
Powered By Leviathan™ 2nd Generation v. 1.9

eMTee

Nice function, now I can see why ;)

The long login time is the only problem but this way you can do nothing with it... so if someone want to login protected from 8 places then pay the price : WAIT  ;D

SMF spam blocked by CleanTalk