Jump to content

[Binário] Definir Portas + Ip Do Servidor


tierrilopes
 Share

Recommended Posts

SERVE para definir as portas e ip no executável.

NÃO SERVE para obfuscar as portas (isto é impossível de fazer pois o cliente terá sempre de estabelecer ligação ao servidor)

Ir até ao ficheiro UserInterface/locale.cpp

Adicionar o seguinte debaixo de todos os includes:
 

#include <detours.h>
#include "Python-2.7/Python.h"
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "detours.lib")

//Colocar o IPFalso no serverinfo do root
char *IPfalso[] = { "127.0.0.1" };

//Colocar o ip verdadeiro do servidor
char *IPverdadeiro[] = { "192.168.2.50" };

//Colocar as portas falsas no serverinfo do root
unsigned int PORTSfalsas[] = { 11002, 13000 }; //Auth CH1 (para adicionar mais, separar por virgulas)

//Colocar as portas verdadeiras do servidord
unsigned int PORTSverdadeiras[] = { 17022, 15200 };  //Auth CH1 (para adicionar mais, separar por virgulas)

typedef int(__stdcall *OldConnect)(SOCKET Sock, const struct sockaddr *SockAddr, int NameLen);
OldConnect Connect;

int __stdcall NewConnect(SOCKET Sock, const struct sockaddr *SockAddr, int NameLen) {

	SOCKADDR_IN *Grabber = (SOCKADDR_IN *)SockAddr; 
	char *ip = inet_ntoa(Grabber->sin_addr); 
	unsigned int port = ntohs(Grabber->sin_port); 
	for (unsigned int i = 0; i<(sizeof(IPfalso) / sizeof(IPfalso[0])); i++)
	{
		if (strcmp(ip, IPfalso) == 0) {
			ip = IPverdadeiro;
		}
	} for (unsigned int i = 0; i<sizeof(PORTSfalsas) / sizeof(PORTSfalsas[0]); i++)
	{
		if (port == PORTSfalsas) {
			port = PORTSverdadeiras;
		}
	} 
	SOCKADDR_IN *so = (SOCKADDR_IN*)SockAddr; 
	so->sin_addr.S_un.S_addr = inet_addr(ip); 
	so->sin_port = htons(port); 
	return Connect(Sock, SockAddr, NameLen);
}
void DefBinario()
{
	Connect = (OldConnect)DetourFunction((PBYTE)GetProcAddress(GetModuleHandleA("ws2_32.dll"), "connect"), (PBYTE)&NewConnect);
}


Procurar por:

void LoadConfig(const char *fileName) {


Adicionar debaixo :

    DefBinario();


Colocar o ficheiro(em anexo) detour.h na pasta Extern / include do vosso cliente
Colocar o ficheiro(em anexo) detour.lib na pasta Extern / library do vosso cliente
Utilização :

//Colocar o IPFalso no serverinfo do root
    char *IPfalso[] = { "127.0.0.1" };
//Colocar o ip verdadeiro do servidor
    char *IPverdadeiro[] = { "192.168.2.50" };
//Colocar as portas falsas no serverinfo do root
    unsigned int PORTSfalsas[] = { 11000, 13000, 14000 }; //Auth CH1 CH2 (Separar por virgulas ao adicionar/remover)
//Colocar as portas verdadeiras do servidord
unsigned int PORTSverdadeiras[] = { 15050, 17010 , 17110}; //Auth CH1 CH2 (Separar por virgulas ao adicionar/remover)


Nota:
    O include #include "Python-2.7/Python.h" poderá diferir de localização na source do vosso cliente.
    Não recomendado para binários que usem python2.2.

detours.lib

detours.h

Link to comment
Share on other sites

  • 1 year later...
  • 5 weeks later...
Error    1    error C2015: too many characters in constant    \UserInterface\Locale.cpp    28    1    UserInterface
Error    2    error C2015: too many characters in constant    \UserInterface\Locale.cpp    31    1    UserInterface
Error    3    error C2015: too many characters in constant    \UserInterface\Locale.cpp    34    1    UserInterface
Error    4    error C2015: too many characters in constant    \UserInterface\Locale.cpp    37    1    UserInterface
Error    5    error C2664: 'int strcmp(const char *,const char *)' : cannot convert argument 2 from 'char *[1]' to 'const char *'   \UserInterface\Locale.cpp    49    1    UserInterface
Error    6    error C2440: '=' : cannot convert from 'char *[1]' to 'char *'   \UserInterface\Locale.cpp    50    1    UserInterface
Error    7    error C2446: '==' : no conversion from 'char **' to 'unsigned int'  \UserInterface\Locale.cpp    54    1    UserInterface
Error    8    error C2040: '==' : 'unsigned int' differs in levels of indirection from 'char *[2]'   \UserInterface\Locale.cpp    54    1    UserInterface
Error    9    error C2440: '=' : cannot convert from 'char *[2]' to 'unsigned int'  \UserInterface\Locale.cpp    55    1    UserInterface
    14    IntelliSense: argument of type "char **" is incompatible with parameter of type "const char *"    UserInterface\Locale.cpp    49    18    UserInterface
    15    IntelliSense: a value of type "char **" cannot be assigned to an entity of type "char *"   \UserInterface\Locale.cpp    50    7    UserInterface
    16    IntelliSense: operand types are incompatible ("unsigned int" and "unsigned int *")    \UserInterface\Locale.cpp    54    12    UserInterface
    17    IntelliSense: a value of type "unsigned int *" cannot be assigned to an entity of type "unsigned int"    \UserInterface\Locale.cpp    55    9    UserInterface

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...