Siga-nos em...
Follow us on Twitter Follow us on Facebook Watch us on YouTube
Registro

Alpha Servers
Página 1 de 2 12 ÚltimoÚltimo
Resultados 1 a 10 de 14
  1. #1

    Avatar de Getulio
    Data de Ingresso
    Mar 2010
    Localização
    char
    Idade
    31
    Posts
    95
    Agradecido
    289
    Agradeceu
    92
    Peso da Avaliação
    0

    Padrão Proteção contra Disconnect Hack & Ataques (Flood) no GS

    Não tenho muito a dizer sobre, afinal, o próprio titulo já diz tudo.

    Proteção contra Disconnect Hack:
    Disconnect.h:
    Código:
    #pragma once
    
    namespace Network
    {
    	struct PMSG_ACTION
    	{
    		PBMSG_HEAD h;
    		unsigned char Direction;
    		unsigned char Action;
    		unsigned char TargetH;
    		unsigned char TargetL;
    	};
    
    	struct DisconnectStruct
    	{
    		bool Send;
    		unsigned long Timer;
    		unsigned long Count;
    	};
    
    	class Disconnect
    	{
    	public:
    		static void Action(PMSG_ACTION* lpMsg, DWORD dwIndex);
    
    	public:
    		static DisconnectStruct Struct[1000];
    	};
    }
    Disconnect.cpp:
    Código:
    #include "Disconnect.h"
    
    namespace Network
    {
    	DisconnectStruct Disconnect::Struct[1000];
    
    	void Disconnect::Action(PMSG_ACTION* lpMsg, DWORD dwIndex)
    	{
    		WORD szIndex = (WORD)(dwIndex - 4800);
    
    		if(!Struct[szIndex].Send)
    		{
    			return;
    		}
    
    		if(Struct[szIndex].Timer <= 0)
    		{
    			Struct[szIndex].Timer = GetTickCount();
    		}
    	
    		if(Struct[szIndex].Count >= 15)
    		{
    			DWORD dwTimer = (GetTickCount() - Struct[szIndex].Timer) / 1000;
    		
    			if(dwTimer <= 1)
    			{
    				Struct[szIndex].Send = false;
    				ServerCloseClient(dwIndex, 0);
    			}
    			else
    			{
    				Struct[szIndex].Count = 0;
    				Struct[szIndex].Timer = GetTickCount();
    			}
    		}
    
    		Struct[szIndex].Count++;
    
    		ServerActionPlayer(lpMsg, dwIndex);		
    	}
    }
    Hook:
    Código:
    Hook((DWORD)&Network::Disconnect::Action, 0x401A1E);
    Define:
    Código:
    #define ServerActionPlayer		((void(*)(Network::PMSG_ACTION*, DWORD)) 0x425CD0)

    Proteção contra Ataques (Flood) no GS - (impedindo lotação de servers):
    Flood.h:
    Código:
    #pragma once
    
    namespace Network
    {
    	struct FloodCheck
    	{
    		bool Send;
    		bool Delete;
    		unsigned long Timer;
    		unsigned long Count;
    		std::string Address;
    	};
    
    	struct FloodStruct
    	{
    		FloodCheck Check;
    		std::string Address;
    	};
    
    	class Flood
    	{
    	public:
    		static bool Inits();
    		static bool Check(std::string szAddress);
    		static short stringExplode(std::string szAddress, std::string szExplode);
    		static short Connection(SOCKET szSocket, char* szAddress);
    
    	public:
    		static FloodStruct Struct[500];
    
    	public:
    		static unsigned long Count;
    	};
    }
    Flood.cpp:
    Código:
    #include "Library.h"
    
    namespace Network
    {
    	FloodStruct Flood::Struct[500];
    	unsigned long Flood::Count;
    
    	bool Flood::Init()
    	{
    		for(int i = 0; i < 500; i++)
    		{
    			Struct[i].Address = "";
    		}
    
    		Count = 0;
    
    		std::fstream f(".\\Network\\Block\\IpAddress.txt", std::ios::in);
    		
    		if(f.is_open() && f.good())
    		{
    			BYTE szNum = 0;
    			char szBuffer[1024];
    			std::string szLine;
    
    			while(!f.eof())
    			{
    				if(Count == 500)
    				{
    					MessageBox(NULL, "O limite de endereço IP de usuários foi excedido.", "Erro", MB_OK | MB_ICONERROR);
    					break;
    				}
    
    				memset(&szBuffer[0], 0x00, 1024);
    				f.getline(szBuffer, 1024);
    				szLine.assign(&szBuffer[0]);
    
    				if(szLine.length() > 9)
    				{
    					if(szLine.substr(0, 2) != "//" && szLine.substr(0, 1) != "#" && szLine.substr(0, 1) != ";")
    					{
    						szNum = (BYTE)Count;
    
    						for(int i = 0; i < (int)szLine.length(); i++)
    						{
    							if(szLine[i] != ' ' && szLine[i] != '\t' && szLine[i] != '"')
    							{
    								if(isdigit(szLine.c_str()[i]) || szLine[i] == '.')
    								{
    									Struct[szNum].Address += szLine[i];
    								}
    								else
    								{
    									f.close();
    									MessageBox(NULL, "O arquivo IpAddress.txt está configurado de forma inadequada.", "Erro", MB_OK | MB_ICONERROR);
    									return false;
    								}
    							}
    						}
    					
    						Count++;
    					}
    				}
    			}
    
    			f.close();
    
    			return true;
    		}
    
    		return false;
    	}
    
    	short Flood::stringExplode(std::string szAddress, std::string szExplode)
    	{
    		BYTE szId = 0, szDec[4] = {0};
    		std::string szConvert = "";
    	
    		for(int i = 0; i <= (int)szAddress.length(); i++)
    		{
    			if(!szAddress.compare(i, 1, szExplode) || i == szAddress.length())
    			{
    				szDec[szId] = (BYTE)atoi((char*)szConvert.c_str());
    				szConvert = "";
    				szId++;
    			}
    			else
    			{
    				szConvert += szAddress[i];
    			}
    		}
    
    		float szResult = (float)(((szDec[0] + szDec[1]) - szDec[2]) + (szDec[3] * 2)) / 2;
    
    		if((szResult > 400))
    		{
    			szResult /= 2;
    		}
    
    		return (short)szResult;
    	}
    
    	bool Flood::Check(std::string szAddress)
    	{
    		WORD szIndex = Function::stringExplode(szAddress, (std::string)".");
    
    		if(Count > 0)
    		{
    			for(int i = 0; i < (int)Count; i++)
    			{
    				if(Struct[i].Address.empty())
    				{
    					break;
    				}
    
    				if((boost::iequals(Struct[i].Address, szAddress)))
    				{
    					if(!Struct[szIndex].Check.Delete)
    					{
    						for(int i = 4800; i < 5800; i++)
    						{
    							if(Object[i].Connected <= 1)
    							{
    								if(boost::iequals(Object[i].IpAddress, szAddress.c_str()))
    								{
    									ServerDelete(i);
    								}
    							}
    						}
    
    						Struct[szIndex].Check.Delete++;
    					}
    
    					return false;
    				}
    			}
    		}
    
    		if(Struct[szIndex].Check.Timer <= 0)
    		{
    			Struct[szIndex].Check.Send	  = true;
    			Struct[szIndex].Check.Delete  = false;
    			Struct[szIndex].Check.Address = szAddress;
    			Struct[szIndex].Check.Timer	  = GetTickCount();
    			Struct[szIndex].Check.Count   = 0;
    		}
    
    		if(!Struct[szIndex].Check.Send)
    		{
    			if(boost::iequals(Struct[szIndex].Check.Address, szAddress))
    			{
    				return false;
    			}
    		}
    
    		if(Struct[szIndex].Check.Count >= 2)
    		{
    			DWORD dwTimer = (GetTickCount() - Struct[szIndex].Check.Timer) / 1000;
    			
    			if(dwTimer <= 1)
    			{
    				Struct[szIndex].Check.Send	  = false;
    				Struct[szIndex].Check.Delete  = false;
    				Struct[szIndex].Check.Address = szAddress;
    
    				bool szWriteProceed = false;
    				
    				if(Count < 500)
    				{
    					if(Count == 499)
    					{
    						if(Struct[499].Address.empty())
    						{
    							Struct[499].Check.Address = szAddress;
    							szWriteProceed = true;
    						}
    					}
    					else
    					{
    						BYTE szNum = (BYTE)Count;
    						Struct[szNum].Address = szAddress;
    						szWriteProceed = true;
    						Count++;
    					}
    				}
    
    				if(szWriteProceed)
    				{
    					std::fstream f(".\\Network\\Block\\IpAddress.txt", std::ios::app | std::ios::out);
    					
    					if(f.is_open() && f.good())
    					{
    						std::string Msg(255, ' ');
    						
    						sprintf_s(&Msg[0], 255, "\"%s\"\n", &szAddress[0]);
    
    						f.write(Msg.c_str(), Msg.length());
    						f.close();
    					}
    				}
    			}
    			else
    			{
    				if(!boost::iequals(Struct[szIndex].Check.Address, szAddress))
    				{
    					Struct[szIndex].Check.Send	  = true;
    					Struct[szIndex].Check.Delete  = false;
    					Struct[szIndex].Check.Address = szAddress;
    				}
    
    				Struct[szIndex].Check.Timer = GetTickCount();
    				Struct[szIndex].Check.Count = 0;
    			}
    		}
    		
    		Struct[szIndex].Check.Count++;
    
    		return true;
    	}
    
    	short Flood::Connection(SOCKET szSocket, char* szAddress)
    	{
    		if(!Check((std::string)szAddress))
    		{
    			return (-1);
    		}
    
    		return ServerConnect(szSocket, szAddress);
    	}
    }
    Hook:
    Código:
    Hook((DWORD)&Network::Flood::Connection, 0x401834);
    Define:
    Código:
    #define ServerConnect			((short(*)(SOCKET, char*)) 0x45F0F0)

    Lembrando, os offsets utilizados em ambos, são da versão 97d.


    Créditos:
    Network.
    Última edição por Getulio; 03-04-2012 às 01:16 AM.

  2. #2

    Avatar de FabioMR
    Data de Ingresso
    Feb 2011
    Localização
    Patrocinio-MG
    Idade
    38
    Posts
    139
    Agradecido
    6
    Agradeceu
    3
    Peso da Avaliação
    15

    Padrão

    rsrsrs ja usaram esse maldito disconect em meu servidor mesmo eu tendo anti hacker ghp e muserver do will.

    Um fix pra isso é ótimo pois até hoje foi o que mais me deu dor de cabeça.

  3. #3

    Avatar de Joas
    Data de Ingresso
    Nov 2011
    Localização
    Luis Alves
    Idade
    33
    Posts
    154
    Agradecido
    8
    Agradeceu
    5
    Peso da Avaliação
    14

    Padrão

    Como que utiliza isso ein ?
    VIVENDO E APRENDENDO !!
    POSTA É ARTE, COPIAR FAZ PARTE, AGRADECER É MODA, SER CRITICADO QUE É PHODA!!

  4. #4

    Avatar de Getulio
    Data de Ingresso
    Mar 2010
    Localização
    char
    Idade
    31
    Posts
    95
    Agradecido
    289
    Agradeceu
    92
    Peso da Avaliação
    0

    Padrão

    @NevePreta,
    Você precisa criar uma DLL (Dynamic-Link Library) com o conteúdo do post principal e laça-la/injeta-la no GS (Hook).

  5. #5

    Avatar de c0zy
    Data de Ingresso
    Mar 2012
    Localização
    Capanema - Paraná
    Idade
    32
    Posts
    96
    Agradecido
    1
    Peso da Avaliação
    13

    Padrão

    A Parte do Hook((DWORD)&Network:isconnect::Action, 0x401A1E); seria aonde mais ou menos ?

  6. #6

    Avatar de Slate
    Data de Ingresso
    May 2012
    Localização
    Em Casa!
    Idade
    27
    Posts
    64
    Agradecido
    2
    Agradeceu
    2
    Peso da Avaliação
    0

    Padrão

    Na Função Principal da Sua DLL.

  7. #7

    Avatar de kameibr
    Data de Ingresso
    May 2011
    Localização
    maringa
    Idade
    36
    Posts
    16
    Agradecido
    0
    Agradeceu
    0
    Peso da Avaliação
    0

    Padrão

    Teria como o autor enviar o gameserver utilizado? Dessa forma conseguiremos encontrar as OFFSETS em outros Gameservers.

    Abraços

    ---------- Post adicionado em 05:04 PM ---------- post anterior foi em 03:45 PM ----------

    Já consegui os Offsets do Gs 1.00.90

    Vlwss

    ---------- Post adicionado em 05:07 PM ---------- post anterior foi em 05:04 PM ----------

    GS .90

    Hook((DWORD)&Network:isconnect::Action, 0x4052E0);
    #define ServerActionPlayer ((void(*)(Network::PMSG_ACTION*, DWORD)) 0x454480)

    ---------- Post adicionado em 05:09 PM ---------- post anterior foi em 05:07 PM ----------

    Caso exista alguma boa alma caridosa teria como copilar a dll ,com os offsets que postei, para mim? estou com meu visual studio expirado =///

    abraços

  8. #8

    Avatar de ReDBuLL™
    Data de Ingresso
    Nov 2010
    Localização
    Chapada dos Veadeiros !
    Idade
    33
    Posts
    29
    Agradecido
    1
    Peso da Avaliação
    0

    Padrão

    Pago 200$ pra quem fizer o anti dc ai no meu gs , versão 1.01e

  9. #9

    Avatar de kameibr
    Data de Ingresso
    May 2011
    Localização
    maringa
    Idade
    36
    Posts
    16
    Agradecido
    0
    Agradeceu
    0
    Peso da Avaliação
    0

    Padrão

    Esta gerando erros ao copilar =\


    (7) : error C2146: syntax error : missing ';' before identifier 'h'
    1>.\Disconnect.h(7) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>.\Disconnect.h(7) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>.\Disconnect.h(25) : error C2061: syntax error : identifier 'DWORD'
    1>.\disconnect.cpp(7) : error C2061: syntax error : identifier 'DWORD'
    1>.\disconnect.cpp(9) : error C2065: 'WORD' : undeclared identifier
    1>.\disconnect.cpp(9) : error C2146: syntax error : missing ';' before identifier 'szIndex'
    1>.\disconnect.cpp(9) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(9) : error C2065: 'WORD' : undeclared identifier
    1>.\disconnect.cpp(9) : error C2065: 'dwIndex' : undeclared identifier
    1>.\disconnect.cpp(11) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(11) : error C2228: left of '.Send' must have class/struct/union
    1>.\disconnect.cpp(16) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(16) : error C2228: left of '.Timer' must have class/struct/union
    1>.\disconnect.cpp(18) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(18) : error C2228: left of '.Timer' must have class/struct/union
    1>.\disconnect.cpp(18) : error C3861: 'GetTickCount': identifier not found
    1>.\disconnect.cpp(21) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(21) : error C2228: left of '.Count' must have class/struct/union
    1>.\disconnect.cpp(23) : error C2065: 'DWORD' : undeclared identifier
    1>.\disconnect.cpp(23) : error C2146: syntax error : missing ';' before identifier 'dwTimer'
    1>.\disconnect.cpp(23) : error C2065: 'dwTimer' : undeclared identifier
    1>.\disconnect.cpp(23) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(23) : error C2228: left of '.Timer' must have class/struct/union
    1>.\disconnect.cpp(23) : error C3861: 'GetTickCount': identifier not found
    1>.\disconnect.cpp(25) : error C2065: 'dwTimer' : undeclared identifier
    1>.\disconnect.cpp(27) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(27) : error C2228: left of '.Send' must have class/struct/union
    1>.\disconnect.cpp(28) : error C2065: 'dwIndex' : undeclared identifier
    1>.\disconnect.cpp(28) : error C3861: 'ServerCloseClient': identifier not found
    1>.\disconnect.cpp(32) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(32) : error C2228: left of '.Count' must have class/struct/union
    1>.\disconnect.cpp(33) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(33) : error C2228: left of '.Timer' must have class/struct/union
    1>.\disconnect.cpp(33) : error C3861: 'GetTickCount': identifier not found
    1>.\disconnect.cpp(37) : error C2065: 'szIndex' : undeclared identifier
    1>.\disconnect.cpp(37) : error C2228: left of '.Count' must have class/struct/union
    1>.\disconnect.cpp(39) : error C2065: 'dwIndex' : undeclared identifier
    1>.\disconnect.cpp(39) : error C3861: 'ServerActionPlayer': identifier not found

  10. #10

    Avatar de Marceliin
    Data de Ingresso
    Aug 2011
    Localização
    Mococa
    Idade
    30
    Posts
    631
    Agradecido
    72
    Agradeceu
    30
    Peso da Avaliação
    19

    Padrão

    Ta faltando ali o include da StdAfx.h

    Código:
    // StdAfx.H : include file for standard system include files,
    // Or project specific include files that are used frequently, but are changed infrequently
    
    #pragma once
    
    // Modify the following defines if you have to target a platform prior to the ones specified below.
    // Refer to MSDN for the latest info on corresponding values for different platforms.
    #ifndef WINVER				// Allow use of features specific to Windows XP or later.
    #define WINVER 0x0501		// Change this to the appropriate value to target other versions of Windows.
    #endif
    
    #ifndef _WIN32_WINNT		// Allow use of features specific to Windows XP or later.                   
    #define _WIN32_WINNT 0x0601	// Change this to the appropriate value to target other versions of Windows.
    #endif						
    
    #ifndef _WIN32_WINDOWS		// Allow use of features specific to Windows 98 or later.
    #define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
    #endif
    
    #ifndef _WIN32_IE			// Allow use of features specific to IE 6.0 or later.
    #define _WIN32_IE 0x0700	// Change this to the appropriate value to target other versions of IE.
    #endif
    
    #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
    // Windows Header Files:
    #include <Process.h>
    #include <windows.h>
    #include <winbase.h>
    #include <iostream>
    #include <time.h>
    #include <conio.h>
    #include <stdio.h>
    #include <vector>
    #include <map>
    #include <cstdarg>
    #include <cstdlib>
    #include <cstdio>
    #include <tchar.h>
    #include <math.h>
    #include <stdlib.h>
    #include <direct.h>
    #include <fcntl.h>
    #include <io.h>
    #include <vector>
    #include <rpc.h>
    #include <rpcdce.h>
    #include "COMMCTRL.h"
    #include "windef.h"
    // ------------------------------------------------------------------------------------------------------------------------
    
    // ------------------------------------------------------------------------------------------------------------------------
    using namespace std;
    // ------------------------------------------------------------------------------------------------------------------------
    #pragma comment( lib , "ws2_32.lib" )
    #pragma comment( lib , "rpcrt4.lib" )
    #pragma comment( lib , "wsock32.lib" )
    #pragma comment( lib , "COMCTL32.lib" )
    // ------------------------------------------------------------------------------------------------------------------------
    static HMENU MyMenu;
    static DWORD OldProtect;
    static UINT_PTR MyMenuTimerID;
    static UINT_PTR cPluginsTimer;
    // ------------------------------------------------------------------------------------------------------------------------
    static HWND cWND;
    static HINSTANCE hInst;
    // ------------------------------------------------------------------------------------------------------------------------
    #pragma warning(disable: 4018 4101 4244 4305 4309 4311 4312 4482 4700 4789 4995 4996)

 

 
Página 1 de 2 12 ÚltimoÚltimo

Informações de Tópico

Usuários Navegando neste Tópico

Há 1 usuários navegando neste tópico. (0 registrados e 1 visitantes)

Tópicos Similares

  1. |Source| Proteção contra debuggers e Ant Inject
    Por Sain no fórum Delphi
    Respostas: 3
    Último Post: 11-04-2014, 09:42 PM
  2. DUVIDA COMO PROTEJER CONTRA ATAQUES NO Case Sensitive
    Por TOMASBORUS no fórum Dúvidas
    Respostas: 7
    Último Post: 05-05-2012, 02:19 PM
  3. |Source| Proteção contra Skill Bug
    Por Getulio no fórum Sources
    Respostas: 0
    Último Post: 02-04-2012, 01:39 AM
  4. |Source| Proteção contra Trade Hack
    Por Getulio no fórum Sources
    Respostas: 0
    Último Post: 01-04-2012, 04:17 AM
  5. |Tutorial| Defendendo contra Ataques DDoS / Flood GS/ Sprut.
    Por mustx1 no fórum Servers
    Respostas: 22
    Último Post: 22-03-2011, 03:20 PM

Marcadores

Permissões de Postagem

  • Você não pode iniciar novos tópicos
  • Você não pode enviar respostas
  • Você não pode enviar anexos
  • Você não pode editar suas mensagens
  •