GetNetInfo
 

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

GetNetInfo

Started by [NL]Pur, 04 May, 2004, 16:18:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[NL]Pur

I was expermenting with $GetNetInfo|

but when i send this to a NMDC 2 client it's gets disconnected.

anyone noticed this ?

oh, and the client sends before it's gets disconnected a NetInfo.


Is this a client bug, or ptokax that doens't like weird protocol?


Or did i forget something?

NotRabidWombat

PtokaX will disconnect users that send unauthorized commands such as BCDC++'s $UserIP. You must return 1 if you want PtokaX to keep the client connected.

Here is an example of NetInfo.
function DataArrival(curUser, sData)
	if(strsub(sData, 1, 7) == "$MyINFO") then
		if(curUser.iVersion == nil) then
			curUser:SendPM("test", "Your client is stupid");
			curUser:Disconnect();
			return;
		end

		if(strfind(curUser.iVersion, "^1.0091$") and curUser.bOperator == nil) then
		-- the . is a magic char on purpose
			curUser:SendData("$GetNetInfo|");
		end
	end

	if(strsub(sData, 1, 8) == "$NetInfo") then
		local info = strsub(sData, 9, -1);
		local s, e, slots, hubs, mode, cap = strfind(sData, "^%$NetInfo (%d+)%$(%d+)%$(%w)%$*(%d*)%|$");

		if(s == nil)
			then curUser:Disconnect();-- the search failed, incorrect NetInfo
		elseif(cap == "") then
			curUser:SendData("Hub-Security", "Please download the latest Neo Modus Client");
			curUser:Disconnect();
		else
			slots = tonumber(slots) or 0;
			hubs = tonumber(hubs) or -1;	-- second value is for invalid number
			cap = tonumber(cap) or -1;	-- second value is for invalid number

		-- do what you want with the rest of the stuff above
		-- slots: duh
		-- hubs: all open hubs (even if OP and even if the user isn't connected :-\ )
		-- mode: A or P
		-- cap: kB/sec upload cap
		
		end

		return 1;
	end

	return 0;
end

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

[NL]Pur

QuotePtokaX will disconnect users that send unauthorized commands such as BCDC++'s $UserIP. You must return 1 if you want PtokaX to keep the client connected.


ah yes, now it works

i did forget the return 1

SMF spam blocked by CleanTalk