P2P Client Flood Detector.lua
 

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

P2P Client Flood Detector.lua

Started by Corayzon, 03 November, 2005, 05:39:02

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Corayzon

This script detects when a dumbass is dos attacking your hub using the P2P ConnectToMe exploit. It gives stats on
how many attacks happen each minute\hour and has an average hour attack count.

I left out a few features that track the users back to the hub that is allowing the attack to take place because i couldnt
be bothered translating all the script back to PtokaX and alot of ediots will just attack them back if the script tells them
where the attacks source from.

-- Converted from cSlave 1.0 for PtokaX by Corayzon

cSlave = {}
cSlave.FloodDetection = {}
cSlave.FloodDetection.iMinCount = 0
cSlave.FloodDetection.iHourCounter = 0
cSlave.FloodDetection.iHourCount = 0
cSlave.FloodDetection.Adverage = 0
sBotName = frmHub:GetHubBotName()

Main = function()

	-- Start cSlave timer api
	SetTimer = 60
	StartTimer()

end

UnknownArrival = function(User, sData)

	-- Get command
	local _,_, sCommand, sArguments = string.find(sData, "(%S+)")

	if sCommand == "$MyNick" then

		-- Add count to flood counter
		cSlave.FloodDetection.iMinCount = cSlave.FloodDetection.iMinCount + 1
		cSlave.FloodDetection.iHourCount = cSlave.FloodDetection.iHourCount + 1
	end
end

OnTimer = function()

	-- Increment hour counter one minute
	cSlave.FloodDetection.iHourCounter = cSlave.FloodDetection.iHourCounter + 1

	-- Check if a hour has been reached
	if cSlave.FloodDetection.iHourCounter == 60 then

		-- Check if is first adverage
		if cSlave.FloodDetection.Adverage == 0 then

			-- Make hour average
			cSlave.FloodDetection.Adverage = cSlave.FloodDetection.iHourCount
		else

			-- Make hour average
			cSlave.FloodDetection.Adverage = (cSlave.FloodDetection.iHourCount + cSlave.FloodDetection.Adverage) / 2
		end

		-- Empty hour connection counter
		cSlave.FloodDetection.iHourCount = 0

		-- Empty hour counter
		cSlave.FloodDetection.iHourCounter = 0
	end

	-- Check if flood was detected
	if cSlave.FloodDetection.iMinCount > 0 then

		local iAverage = 0

		if cSlave.FloodDetection.Adverage == 0 then
			iAverage = cSlave.FloodDetection.iHourCount
		else
			iAverage = cSlave.FloodDetection.Adverage
		end

		-- Send Message to operators
		SendPmToOps(sBotName, "*** Connection Flood Detected: \r\n\r\n\t\tConnections in last minute: " .. cSlave.FloodDetection.iMinCount .. "\r\n\t\tConnections in this hour: " .. cSlave.FloodDetection.iHourCount .. "\r\n\t\tConnections in hour average: " .. iAverage .. "\r\n")

		cSlave.FloodDetection.iMinCount = 0
	end
end

Dessamator

Hmm, nice script, maybe it should be integrated in Ptokax's deflood.
Ignorance is Bliss.

bastya_elvtars

I heard that CTM floods are somewhat rare. Or isn't the CTM deflood by plop targeted to stop them?
Everything could have been anything else and it would have just as much meaning.

Corayzon

CTM floods can be somewhat effective as a dynial of service attack. It relies on 3rd hand clients to do the port filling so one is unable to be traced though the hub being attacked directly. But that doesnt mean with some nickname logging and hublist.org checking you cant find the source client with the help of a CTM loging client.

ConnectToMe flooding is becoming quite rear because the smart ppl that dont leave exploits open for personal use are actually convincing developers to close the exploit by doing a very simple and resource friendly ip address check.

Anyways, for those of you that think u could be on the bad end of a CTM flood, this script will tell you, it u stay online long enough.

PPK

QuoteOriginally posted by Dessamator
maybe it should be integrated in Ptokax's deflood.
Why integrate to PtokaX something what is not working on hub ?(  :D
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Hades

Why though not integrate mysql stats into it?
It works very nice on ynhub.It has options for how many dayz keep mysql - very usefull.

Dessamator

#6
QuoteOriginally posted by PPK
QuoteOriginally posted by Dessamator
maybe it should be integrated in Ptokax's deflood.
Why integrate to PtokaX something what is not working on hub ?(  :D

I never tried the script,   that comment was based on the assumption that it worked :)
Ignorance is Bliss.

bastya_elvtars

QuoteOriginally posted by Hades
Why though not integrate mysql stats into it?
It works very nice on ynhub.It has options for how many dayz keep mysql - very usefull.

There will be such stats.
Everything could have been anything else and it would have just as much meaning.

TrIp-iN-SuN

it's not stop that it's only show u what flood get in your hub and i need same thing stop that who can help me becsoe same body flood me

TrIp-iN-SuN


SMF spam blocked by CleanTalk