Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Flyff > Flyff Private Server
You last visited: Today at 21:34

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Source Code]DDos Protect

Discussion on [Source Code]DDos Protect within the Flyff Private Server forum part of the Flyff category.

Reply
 
Old   #1
 
[LS]Michael's Avatar
 
elite*gold: 15
Join Date: Oct 2007
Posts: 450
Received Thanks: 474
[Source Code]DDos Protect

Hallo Elitepvpers,


Ich Wollte hier mal da ich an der Beta Version von mein Dos Protect nicht weiter coden werde sondern mit der anderen version anfange, habe ich mich entschlossen Den source Code zu Relasen.

Der Haupt Exe
Code:
#AutoIt3Wrapper_Icon=..\Icon.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Run_Obfuscator=y
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <file.au3>
#include <Math.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Global $max = "", $cheksum = ""
Global $create = "0"

$Form1 = GUICreate("Lucidsoft - DDoS Protection © by Lucidsoft | Coded by Michael", 609, 281, 195, 122)
GUICtrlCreateGroup("Incoming Connection", 8, 0, 241, 241)
$ListView1 = GUICtrlCreateListView("ID|Con", 16, 16, 226, 214)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 40)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Blocked Connection", 256, 0, 201, 241)
$ListView2 = GUICtrlCreateListView("ID", 264, 16, 186, 214)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Main Setting´s", 464, 0, 137, 169)
GUICtrlCreateLabel("Check Interval in msec:", 472, 16, 115, 17)
$Input1 = GUICtrlCreateInput("", 472, 40, 113, 21)
GUICtrlCreateLabel("Max Connection:", 472, 64, 84, 17)
$Input2 = GUICtrlCreateInput("", 472, 88, 113, 21)
$Button1 = GUICtrlCreateButton("Save", 472, 136, 123, 25)
GUICtrlCreateLabel("Port:", 480, 112, 28, 17)
$Input3 = GUICtrlCreateInput("", 520, 112, 49, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Manual Block", 464, 168, 137, 97)
$Button2 = GUICtrlCreateButton("Block", 472, 224, 59, 25)
$Button3 = GUICtrlCreateButton("Deblock", 536, 224, 59, 25)
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 472, 192, 122, 21)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button4 = GUICtrlCreateButton("Start", 8, 248, 139, 25)
$Button5 = GUICtrlCreateButton("Stop", 152, 248, 139, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button6 = GUICtrlCreateButton("Login", 296, 248, 163, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
_startsettings()

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $Button1
			IniWrite("Log\Settings.ls", "Time", "Interval", GUICtrlRead($Input1))
			IniWrite("Log\Settings.ls", "Con", "MAX", GUICtrlRead($Input2))
			IniWrite("Log\Settings.ls", "Port", "Port", GUICtrlRead($Input3))
			$max = GUICtrlRead($Input2)
		Case $Button2
			_checkNONBlockList(_GUICtrlIpAddress_Get($IPAddress1))
			_ReloadListBlock()
		Case $Button3
			_deletblock(_GUICtrlIpAddress_Get($IPAddress1))
			_ReloadListBlock()
		Case $Button4
			GUICtrlSetState($Button4, $GUI_DISABLE)
			GUICtrlSetState($Button5, $GUI_ENABLE)
			AdlibRegister("_LoadConList", GUICtrlRead($Input1))
		Case $Button5
			GUICtrlSetState($Button5, $GUI_DISABLE)
			GUICtrlSetState($Button4, $GUI_ENABLE)
			AdlibUnRegister("_LoadConList")
		Case $GUI_EVENT_CLOSE
			Exit

	EndSwitch
WEnd

Func _deletblock($ip)
	$CMD = Run(@ComSpec & " /c netsh ipsec static delete filter filterlist=DDoS-Protect srcaddr=" & $ip & " dstaddr=Me", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	Dim $aRecords
	If Not _FileReadToArray("Log\Block.ini", $aRecords) Then
	Else
		FileDelete("Log\Block.ini")
		For $x = 1 To $aRecords[0]
			If $aRecords[$x] = $ip Then
			Else
				FileWrite("Log\Block.ini", $aRecords[$x] & @CRLF)
			EndIf
		Next
	EndIf
EndFunc   ;==>_deletblock

Func _startsettings()
	DirCreate("Log")
	If FileExists("Log\Settings.ls") Then
		$create = IniRead("Log\Settings.ls", "Create", "Policy", "")
		GUICtrlSetData($Input1, IniRead("Log\Settings.ls", "Time", "Interval", ""))
		GUICtrlSetData($Input2, IniRead("Log\Settings.ls", "Con", "MAX", ""))
		GUICtrlSetData($Input3, IniRead("Log\Settings.ls", "Port", "Port", ""))
		$max = IniRead("Log\Settings.ls", "Con", "MAX", "")
	EndIf

	If FileExists("Log\Block.ini") Then
		_Listblock()
	EndIf

	If $create = 0 Then
		_createIPsec()
	EndIf
EndFunc   ;==>_startsettings

Func _createIPsec()
	Run(@ComSpec & " /c netsh ipsec static add filterlist name=DDoS-Protect", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	Sleep(1000)
	Run(@ComSpec & " /c netsh ipsec static add filteraction name=BlockIP action=block", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	Sleep(1000)
	Run(@ComSpec & " /c netsh ipsec static add filter filterlist=DDoS-Protect srcaddr=192.168.192.100 dstaddr=Me", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	Sleep(1000)
	Run(@ComSpec & " /c netsh ipsec static add policy name=DDoS-Protec-Policy assign=yes", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	Sleep(1000)
	Run(@ComSpec & " /c netsh ipsec static add rule name=DDoSProtectRule policy=DDoS-Protec-Policy filterlist=DDoS-Protect filteraction=BlockIP", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	Sleep(100)
	Run(@ComSpec & " /c netsh ipsec static delete filter filterlist=DDoS-Protect srcaddr=192.168.192.100 dstaddr=Me", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	Sleep(1000)
	IniWrite("Log\Settings.ls", "Create", "Policy", "1")
EndFunc   ;==>_createIPsec

Func _Listblock()
	If FileExists("Log\Block.ini") Then
		_GUICtrlListView_DeleteAllItems($ListView2)
		Dim $aRecords
		If Not _FileReadToArray("Log\Block.ini", $aRecords) Then
		Else
			If _FileCountLines("Log\Block.ini") > 0 Then
				For $x = 1 To $aRecords[0]
					GUICtrlCreateListViewItem($aRecords[$x], $ListView2)
				Next
			EndIf
		EndIf
	EndIf
EndFunc   ;==>_Listblock

Func _ReloadListBlock()
	_Listblock()
EndFunc   ;==>_ReloadListBlock

Func _LoadConList()
	$incon = ""
	If ProcessExists("Read.exe") Then
		ProcessClose("Read.exe")
		FileDelete("Log\Conn.ini")
		Run("Log\Read.exe", "Log\")
	Else
		FileDelete("Log\Conn.ini")
		Run("Log\Read.exe", "Log\")
	EndIf
	Sleep(250)
	Dim $aRecords
	If Not _FileReadToArray("Log\Conn.ini", $aRecords) Then
	Else
		$fi = FileRead("Log\Conn.ini")
		For $x = 1 To $aRecords[0]
			$aResult = StringRegExp($fi, $aRecords[$x], 3)

			$check = _GUICtrlListView_FindInText($ListView1, $aRecords[$x])
			If $check = "-1" Then
				GUICtrlCreateListViewItem($aRecords[$x] & "|" & UBound($aResult), $ListView1)
				$incon &= $aRecords[$x] & "|"
			Else
				$incon &= $aRecords[$x] & "|"
				$itemtext = _GUICtrlListView_GetItemTextString($ListView1, $check)
				$str = StringSplit($itemtext, "|")
				If $str[2] <> UBound($aResult) Then
					_GUICtrlListView_SetItemText($ListView1, $check, UBound($aResult), 1)
				EndIf
			EndIf

		Next

		$items = _GUICtrlListView_GetItemCount($ListView1)
		For $y = 0 To $items
			$search = _GUICtrlListView_GetItemText($ListView1, $y)
			$string = StringInStr($incon, $search)
			If $string = 0 Then
				_GUICtrlListView_DeleteItem($ListView1, $y)
			EndIf
		Next
	EndIf
	_CheckBlock()
EndFunc   ;==>_LoadConList

Func _CheckBlock()
	$max = IniRead("Log\Settings.ls", "Con", "MAX", "")
	$items = _GUICtrlListView_GetItemCount($ListView1)
	For $y = 0 To $items - 1
		$ip = _GUICtrlListView_GetItemText($ListView1, $y)
		$count = _GUICtrlListView_GetItemText($ListView1, $y, 1)
		If Int($count) >= Int($max) Then
			_checkNONBlockList($ip)
		EndIf
	Next

EndFunc   ;==>_CheckBlock

Func _checkNONBlockList($ip)
	$check = ""
	Dim $aRecords
	If Not _FileReadToArray("Log\White.ini", $aRecords) Then
	EndIf
	If _FileCountLines("Log\White.ini") > 0 Then
		For $x = 1 To $aRecords[0]
			If $ip = $aRecords[$x] Then
				$check = "1"
				ExitLoop
			Else
				$check = "2"
			EndIf
		Next
		If $check = 2 Then
			_checkBlockIP($ip)
		EndIf
	EndIf
EndFunc   ;==>_checkNONBlockList

Func _checkBlockIP($ip)
	$cheksum = ""
	Dim $aRecords
	If Not _FileReadToArray("Log\Block.ini", $aRecords) Then
	Else
		If _FileCountLines("Log\Block.ini") > 0 Then
			For $x = 1 To $aRecords[0]
				If $aRecords[$x] = $ip Then
					$cheksum = "2"
					ExitLoop
				Else
					$cheksum = "1"
				EndIf
			Next
			If $cheksum = 1 Then
				_Add($ip)
			EndIf
		EndIf
	EndIf
EndFunc   ;==>_checkBlockIP

Func _Add($ip)
	$command2 = "netsh ipsec static add filter filterlist=DDoS-Protect srcaddr=" & $ip & " dstaddr=Me"
	FileWrite("Log\Block.ini", $ip & @CRLF)
	GUICtrlCreateListViewItem($ip, $ListView2)
	$CMD = Run(@ComSpec & " /c " & $command2, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
EndFunc   ;==>_Add

Func _ReduceMem()
	Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
	Return SetError(@error, @extended, $ai_Return[0])
EndFunc   ;==>_ReduceMem
Der Read exe

Code:
#NoTrayIcon
#RequireAdmin
#AutoIt3Wrapper_Icon=..\..\Icon.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Run_Obfuscator=y
#include <Constants.au3>
_check()

Func _check()
	$port = IniRead("Settings.ls", "Port", "Port", "")
	$read = _CMDRead("netstat -n")
	$str = StringStripWS($read, 4)
	$str2 = StringSplit($str, " ")
	For $x = 1 To $str2[0]
		$strstr = StringInStr($str2[$x], ":" & $port)
		If $strstr > 0 Then
			If StringRegExp($str2[$x + 1], "^[.0-9]", 0, 1) Then
				$strr = StringSplit($str2[$x + 1], ":")
				FileWrite("Conn.ini", $strr[1] & @CRLF)
			EndIf
		EndIf
	Next
	_ReduceMem()
EndFunc   ;==>_check

Func _CMDRead($command)
	Local $line
	$CMD = Run(@ComSpec & " /c " & $command, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	While 1
		$line &= StdoutRead($CMD)
		If @error Then ExitLoop
	WEnd
	Return $line

EndFunc   ;==>_CMDRead

Func _GetMem()
	Local Static $LastMem = -1
	Local $Diff = 0
	Local $aStats = ProcessGetStats()
	If $LastMem <> -1 Then $Diff = $aStats[0] - $LastMem
	$LastMem = $aStats[0]
	Return StringFormat("%09d   (%+010d)", $aStats[0], $Diff)
EndFunc   ;==>_GetMem

Func _ReduceMem()
	Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
	Return SetError(@error, @extended, $ai_Return[0])
EndFunc   ;==>_ReduceMem
ich wünsche allen Hobby codern Viel Spaß an den Code ^^
[LS]Michael is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[SYIXX]DDos Protect
01/05/2011 - Coding Tutorials - 8 Replies
Hallo Einen guten Artikel dazu findest du hier: Denial-of-service attack - Wikipedia, the free encyclopedia ------ Da viele Pserver bzw. Hompge´s keine ahnung haben sich gegen DDos zu schützen habe ich mal vor langer zeit ein kleines tut geschrieben... Viel Spaß ------ Sich vor DDoS zu schützen ist fast immer ein Problem. Zuerst solltest du bei deiner Firewall "fallback" anwenden, um dich nicht selbst bei einer fehlerhaften Konfiguration zu sperren: Bei diesem Befehl wird die...
[Help] DDoS Atk, how i can protect my server?
10/29/2008 - Lineage 2 - 3 Replies
Hi there, this is my first post here and i need a bit help. My server its underatk from a Kids, there is anyway to protect the server from this shit? The host machine, have Windows2k3 as operation system. Any idea? Regards Andrew.



All times are GMT +1. The time now is 21:34.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.