elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  autoname, namechanger, namestealer
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: autoname, namechanger, namestealer  (Leído 2,359 veces)
85

Desconectado Desconectado

Mensajes: 206



Ver Perfil WWW
autoname, namechanger, namestealer
« en: 7 Marzo 2013, 04:55 am »

Hola , estaba revisando un código que usaba en el Counter-Strike.
Es un namechanger o namestealer.
En un servidor de CS, de por ejemplo 32 slots, este hack lo que hace es cambiar tu nombre aleatoriamente por el de alguno de los demás jugadores. El tema es que no se permite tener el mismo exacto nombre, por lo que se le debe hacer un cambio. Tampoco se permite que tu nombre contenga el nombre de un administrador.

Este namechanger se encarga de lo primero, o sea recibe el nombre de alguien y lo modifica con un sólo cambio y devuelve el nombre modificado.

Se hace un sólo cambio por que la idea es que el nombre se pareza al del otro jugador.

Yo lo que hice fue reemplazar las funciones de cadena que se utilizaron en el primer código. Lo que quisiera es si alguien se anima a hacerlo de otra forma, sin salirse de la lógica de funcionamiento.

Otra cosa es lo de la escritura LEET, o 1337. Se trata de una equivalencia de letras con números, por ejemplo:

CASA = C454

o

AVIÓN = 4V10N

o

BS = 85

etc

Eso también es válido para este autoname.
Si encuentran algún error en mi code avizen.
Aunque no crean este autoname da buenos resultados para gambetear bans XD

Código
  1.  
  2. //
  3. // By 85
  4. // elhacker.net
  5. // etalking.com.ar
  6. // 2013
  7. //
  8.  
  9. #include<windows.h>
  10. #include<stdio.h>
  11.  
  12. //
  13.  
  14. char objetivos[] = "ABEGLOST\0";
  15. char reemplazos[]= "48361057\0";
  16.  
  17. //
  18. void ModificadorDeNombresConSTR(char* str){
  19.  
  20. // Detección de doble whitespace
  21. if(strstr(str,"  ")!=NULL)
  22.        {
  23.        strcpy(strstr(str,"  "),strstr(str,"  ")+1);
  24.        return;
  25.        }
  26.  
  27. // Detección de whitespace
  28. if(strstr(str," ")!=NULL)
  29.       {
  30.        char buf[256];
  31.        strcpy(buf,str);
  32.        strcpy(strstr(buf," ")+1,strstr(str," "));
  33.        strcpy(str,buf);
  34.        return;
  35.       }
  36.  
  37. // Char inicial y final iguales
  38.       if(str[0]==str[strlen(str)-1])
  39.       {
  40.        char buf[256];
  41.        char sbuf[2]="X";// Al asignarle valor se le agrega el 0 automáticamente.
  42.        sbuf[0]=str[0];
  43.        strcpy(buf,sbuf);
  44.        strcat(buf,str);
  45.        strcpy(str,buf);
  46.        return;
  47.       }
  48.  
  49. // Reemplazo de ocurrencias (para escritura 1337 XD)
  50. if(strstr(str,"A")!=NULL)
  51.        {
  52.        *strstr(str,"A")='4';
  53.        return;
  54.        }
  55.  
  56. if(strstr(str,"B")!=NULL)
  57.       {
  58.        *strstr(str,"B")='5';
  59.        return;
  60.       }
  61.  
  62. if(strstr(str,"E")!=NULL)
  63.        {
  64.        *strstr(str,"E")='3';
  65.        return;
  66.        }
  67.  
  68. if(strstr(str,"G")!=NULL)
  69.       {
  70.        *strstr(str,"G")='6';
  71.        return;
  72.       }
  73.  
  74. if(strstr(str,"L")!=NULL)
  75.        {
  76.        *strstr(str,"L")='1';
  77.        return;
  78.        }
  79.  
  80. if(strstr(str,"O")!=NULL)
  81.        {
  82.        *strstr(str,"O")='0';
  83.        return;
  84.       }
  85.  
  86. if(strstr(str,"S")!=NULL)
  87.        {
  88.        *strstr(str,"S")='5';
  89.        return;
  90.       }
  91.  
  92. if(strstr(str,"T")!=NULL)
  93.        {
  94.        *strstr(str,"T")='7';
  95.        return;
  96.        }
  97.  
  98. // Char final y prefinal iguales
  99. if(str[strlen(str)-1]==str[strlen(str)-2])
  100.        {
  101.        str[strlen(str)-1]=0;
  102.        return;
  103.        }
  104.  
  105. // Reducción de longitud
  106. if(strlen(str)>16)
  107.        {
  108.        str[strlen(str)-1]=0;
  109.        return;
  110.        }
  111.  
  112. // Agrega un punto al final
  113. strcat(str,".");
  114. }
  115.  
  116. //
  117.  
  118. void ModificadorDeNombresSinSTR(char* str){
  119.  
  120. #define current (i-1)
  121. int len=0;
  122. for(;*str++;len++);// Obtener largo de cadena
  123. str-=(len+1);// Arreglar el puntero que se ha desplazado!!!
  124. {
  125. int i=0;
  126. while(str[i++]){
  127.  
  128. // Detección de doble whitespace
  129. if((str[current] == ' ' && str[i] == ' ')){
  130.  
  131. printf("DOBLE ESPACIO\n");
  132. system("pause");
  133.  
  134. char buf[256];
  135. int pos=current;
  136. while(str[pos++]!='\0'){// Reemplazo de STRCPY+STRSTR ;D
  137.  
  138. int bufcur = (pos-current)-1;
  139. int strcur = (pos-1);
  140. buf[bufcur]=str[strcur+1];
  141. buf[bufcur+1]=str[strcur+2];
  142. str[strcur]=buf[bufcur];
  143. str[strcur+1]=buf[bufcur+1];
  144. }
  145. str[pos-1]=0;
  146. return;
  147. }}}
  148.  
  149. {
  150. int i=0;
  151. while(str[i++]){
  152.  
  153. // Detección whitespace
  154. if(str[current] == ' '){
  155.  
  156. printf("ESPACIO\n");
  157. system("pause");
  158.  
  159. str[len+1]=0;
  160. int pos=len+1;
  161. while(pos--){
  162. if(pos==current) break;
  163. str[pos]=str[pos-1];
  164. }
  165. return;
  166. }}}
  167.  
  168.  
  169. {
  170. int i=0;
  171. while(str[i++]){
  172.  
  173. // Char inicial y final iguales
  174. if(str[0] == str[len-1]){
  175.  
  176. printf("INICIAL y FINAL IGUALES\n");
  177. system("pause");
  178.  
  179. str[len+1]=0;
  180. int pos=len+1;
  181. while(pos--){// Reemplazo de STRCPY ;D
  182. if(pos<1) break;
  183. str[pos]=str[pos-1];
  184. }
  185. return;
  186. }}}
  187.  
  188. {
  189. int i=0;
  190. while(str[i++]){
  191.  
  192. // Reemplazo de ocurrencias (para escritura 1337 XD)
  193. if(str[current] == 'A') {str[current]='4'; return;}
  194. else if(str[current] == 'B') {str[current]='8'; return;}
  195. else if(str[current] == 'E') {str[current]='3'; return;}
  196. else if(str[current] == 'G') {str[current]='6'; return;}
  197. else if(str[current] == 'L') {str[current]='1'; return;}
  198. else if(str[current] == 'O') {str[current]='0'; return;}
  199. else if(str[current] == 'S') {str[current]='5'; return;}
  200. else if(str[current] == 'T') {str[current]='7'; return;}
  201. }}
  202.  
  203.  
  204. // Char final y prefinal iguales
  205. if(str[len-1] == str[len-2]){
  206.  
  207. printf("FINAL y PREFINAL IGUALES\n");
  208. system("pause");
  209. str[len-1]=0;
  210. return;
  211. }
  212.  
  213. // Reducción de longitud
  214. if(len>16){
  215.  
  216. printf("LONGITUD\n");
  217. system("pause");
  218.  
  219. str[len-1] =0;
  220. return;
  221. }
  222.  
  223.  
  224. // Agrega un punto al final
  225. str[len] ='.';
  226. str[len+1] =0;
  227. }
  228.  
  229. //
  230. int main(){
  231.  
  232. // Nota: si STRCPY recibe el segundo argumento de mayor size que el primero
  233. // no importa mientras la cadena sea igual o menor. Y terminada en 0.
  234. // Aparte de que STRCPY recibe sus argumentos en forma de punteros.
  235. // http://www.cplusplus.com/reference/cstring/strcpy/
  236.  
  237. char nombrelargo[256];
  238.  
  239. // char ingreso[512] = "RRRRRRRRRRRRRRRRX\0";
  240. // char ingreso[512] = "LEE TL\0";
  241. // char ingreso[512] = "LEETL \0";
  242. // char ingreso[512] = "LEET";
  243. // char ingreso[512] = "azucarada";
  244. // char ingreso[512] = "azuc arada";
  245. // char ingreso[512] = "hazuc  aradah";
  246. // char ingreso[512] = "hazucaradahh";
  247. // char ingreso[512] = "1azucaradahh";
  248. // char ingreso[512] = "1  azucaradahh";
  249. // char ingreso[512] = "1azucaradahhaaaa  ";
  250. char ingreso[512] = "1azucaradahhaaaa ";
  251.  
  252.  
  253. strcpy(nombrelargo, ingreso);
  254. // ModificadorDeNombresConSTR(nombrelargo);
  255. ModificadorDeNombresSinSTR(ingreso);
  256. //printf("%s\n", nombrelargo);
  257. printf("%s\n", ingreso);
  258. system("pause");
  259. return (0);
  260. }
  261.  
  262. //
  263.  

Proyecto: http://www.mediafire.com/?k6os3q63sxrw0ff



« Última modificación: 9 Marzo 2013, 09:21 am por 85 » En línea

Me cerraron el Windows Live Spaces, entonces me creé un WordPress XD
http://etkboyscout.wordpress.com/
0xDani


Desconectado Desconectado

Mensajes: 1.077



Ver Perfil
Re: autoname, namechanger, namestealer
« Respuesta #1 en: 7 Marzo 2013, 16:31 pm »

Una pregunta: ¿porque siempre incluyes windows.h en tus proyectos aunque no la uses?


En línea

I keep searching for something that I never seem to find, but maybe I won't, because I left it all behind!

I code for $$$
Hago trabajos en C/C++
Contactar por PM
bemone

Desconectado Desconectado

Mensajes: 74



Ver Perfil
Re: autoname, namechanger, namestealer
« Respuesta #2 en: 7 Marzo 2013, 23:29 pm »

Y como volcas todo esto al juego?
En línea

Odio los tipos de variable de Windows.
85

Desconectado Desconectado

Mensajes: 206



Ver Perfil WWW
Re: autoname, namechanger, namestealer
« Respuesta #3 en: 7 Marzo 2013, 23:37 pm »

Una pregunta: ¿porque siempre incluyes windows.h en tus proyectos aunque no la uses?

En muchos de mis códigos está puesto innecesariamente, es cierto, pero si te tengo que responder ¿por qué? es entre otras razones por esto:

Algunas de las funciones que uso continuamente,

MessageBox (Depuramiento del programa)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx

GetAsyncKeyState (Para detectar alguna tecla)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646293(v=vs.85).aspx

ExitProcess (Salir del programa)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx

ETC

y es como que siempre queda <windows.h>  ;D


Y como volcas todo esto al juego?
XD justo había apretado 'Publicar' y me dice que alguien respondió algo ERAS VOS XD

El tema es que en el juego hay una forma de obtener los datos de los jugadores, y a esta función solamente le tenés que pasar un nombre y te lo modifica. Con ese nombre modificado, ahora podés cambiar tu propio nombre al del modificado.


En línea

Me cerraron el Windows Live Spaces, entonces me creé un WordPress XD
http://etkboyscout.wordpress.com/
bemone

Desconectado Desconectado

Mensajes: 74



Ver Perfil
Re: autoname, namechanger, namestealer
« Respuesta #4 en: 8 Marzo 2013, 23:36 pm »

Me podes explicar donde consigo esta funcion? me interesa el tema.
En línea

Odio los tipos de variable de Windows.
85

Desconectado Desconectado

Mensajes: 206



Ver Perfil WWW
Re: autoname, namechanger, namestealer
« Respuesta #5 en: 9 Marzo 2013, 09:11 am »

Mi jefe es un hombre muy de moda, que siempre gusta ir de compras en Internet.Ayer cuando estaba listo para volver a casa, él me envió un mensajes de texto y escribió: "hola, Benny, sé que usted está buscando un tablet pc agradable, así que creo que debería recomendar esta tableta para usted.su configuración es muy bonito y está comenzando una promoción loco ahora, su nuevo precio es sólo del Euro € 52, creo que totalmente se lo puede permitir. "Ahora publicar esta noticia aquí, espero que sea útil!! enlace aquí: 7" pantalla Android 4.0 TOP configuración tablet pc

rico bot..

Me podes explicar donde consigo esta funcion? me interesa el tema.

Esta sería la implementación de la función de autoname.. Es un hack para Counter-Strike
Código:
///////////////////////////////////////////////////////////////////////////////////////////////
//
//
// AUTONAME, NAMECHANGER, NAMESTEALER, TEST
// By 85
// [ElHacker.Net]
// [09/03/13]
//
//
///////////////////////////////////////////////////////////////////////////////////////////////

// Counter-Strike Base Hook
// By Chod & h1web
// Release Date: 26th October 2008

///////////////////////////////////////////////////////////////////////////////////////////////
#pragma optimize("gtp",on)
//#pragma comment(linker,"/MERGE:.data=.text /MERGE:.rdata=.text /SECTION:.text,EWR")

#include "apihook.h"
#include "include.h"

///////////////////////////////////////////////////////////////////////////////////////////////

char g_szBaseDir[ 256 ];
cl_enginefunc_t * o_pEngFuncs = NULL;

///////////////////////////////////////////////////////////////////////////////////////////////

void logme(char * fmt, ... )
{
va_list va_alist;
char buf[512];
va_start (va_alist, fmt);
_vsnprintf (buf, sizeof(buf), fmt, va_alist);
va_end (va_alist);

ofstream fout;
char path[256];
sprintf(path,"%sDionysus.txt",g_szBaseDir);
fout.open(path, ios::app);

if(fout.fail()) return;

fout << buf << endl;
fout.close();
}

///////////////////////////////////////////////////////////////////////////////////////////////

// This is just a test for the namechanger !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
bool ok=false;
static unsigned int randi=0;
static char names[32][256];
static unsigned int last_timer=0;
//extern cl_enginefunc_t * o_pEngFuncs;
void logme(char * fmt, ... );
////////////////////////////////////////////////////
void ModificadorDeNombresConSTR(char* str){
 
// Detección de doble whitespace
if(strstr(str,"  ")!=NULL)
    {
        strcpy(strstr(str,"  "),strstr(str,"  ")+1);
        return;
    }
 
// Detección de whitespace
if(strstr(str," ")!=NULL)
    {
        char buf[256];
        strcpy(buf,str);
        strcpy(strstr(buf," ")+1,strstr(str," "));
        strcpy(str,buf);
        return;
    }
 
// Char inicial y final iguales
    if(str[0]==str[strlen(str)-1])
    {
        char buf[256];
        char sbuf[2]="X";// Al asignarle valor se le agrega el 0 automáticamente.
        sbuf[0]=str[0];
        strcpy(buf,sbuf);
        strcat(buf,str);
        strcpy(str,buf);
        return;
    }
 
// Reemplazo de ocurrencias (para escritura 1337 XD)
if(strstr(str,"A")!=NULL)
    {
        *strstr(str,"A")='4';
        return;
    }
 
if(strstr(str,"B")!=NULL)
    {
        *strstr(str,"B")='5';
        return;
    }
 
if(strstr(str,"E")!=NULL)
    {
        *strstr(str,"E")='3';
        return;
    }
 
if(strstr(str,"G")!=NULL)
    {
        *strstr(str,"G")='6';
        return;
    }
 
if(strstr(str,"L")!=NULL)
    {
        *strstr(str,"L")='1';
        return;
    }
 
if(strstr(str,"O")!=NULL)
    {
        *strstr(str,"O")='0';
        return;
    }
 
if(strstr(str,"S")!=NULL)
    {
        *strstr(str,"S")='5';
        return;
    }
 
if(strstr(str,"T")!=NULL)
    {
        *strstr(str,"T")='7';
        return;
    }
 
// Char final y prefinal iguales
if(str[strlen(str)-1]==str[strlen(str)-2])
    {
        str[strlen(str)-1]=0;
        return;
    }
 
// Reducción de longitud
if(strlen(str)>16)
    {
        str[strlen(str)-1]=0;
        return;
    }
 
// Agrega un punto al final
strcat(str,".");
}


int AddEntResult = 1;
//===================================================================================
void HUD_AddEntity (int type, struct cl_entity_s *ent, const char *modelname)
{

if(o_pEngFuncs)
{
//////////////////////////////////////////////////////////////////Modificado por 85

if(o_pEngFuncs->GetLocalPlayer()->curstate.solid)
{
//logme("tgt %d",(timeGetTime()/1000));
//logme("last_timer %d",last_timer);
int ii = (timeGetTime()/1000);
SYSTEMTIME time;
GetLocalTime(&time);
//int ii =time.wSecond;
//int ii = 0;
//logme("o_pEngFuncs %X",o_pEngFuncs);
//logme("ii %d",ii);

if(((ii) - last_timer)>2.0)
{
int names_count=0;
int i;
for(i=0; i<33;i++)
{
cl_entity_s * pEnt = o_pEngFuncs->GetEntityByIndex(i);
if(pEnt && pEnt->curstate.solid && pEnt!=o_pEngFuncs->GetLocalPlayer())
{
hud_player_info_t pInfo;
o_pEngFuncs->pfnGetPlayerInfo(i, &pInfo);//pEnt->curstate.solid
char name[256];
//strcpy(name,pInfo.name);
memcpy(name,pInfo.name,128);
name[128]=0;
if(name[0]!='('){
randi++;
strcpy(names[names_count++],name);
}
}
}

int n;
if(names_count>0)
{
char cmdstr[256];
char name[256];
char buf[2]="A";
n=randi%names_count;
strcpy(cmdstr,"name \"");
strcpy(name,names[n]);
/////////////////////////////////////////////////
ModificadorDeNombresConSTR(name);// Hola, me reconocen?
//////////////////////////////////////////
strcat(cmdstr,name);
strcat(cmdstr,"\"");
o_pEngFuncs->pfnClientCmd(cmdstr);
//o_pEngFuncs->pfnDrawConsoleString( 300, 300, cmdstr );
//logme(cmdstr);
}

last_timer = (ii);
}
}///////////////////////////////////////////////////////////////
}///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////

int retval = 1;
AddEntResult = retval;
}
DWORD* slots=(DWORD*)0x01EB74E8;
static bool loaded = false;
static bool done = false;
DWORD retaddress;
__declspec( naked )void Gateway2_HUD_AddEntity( void )
{
__asm
{
mov AddEntResult, eax;
call HUD_AddEntity;
mov eax, AddEntResult;
jmp retaddress;
}
}
DWORD AddEnt = (DWORD)&Gateway2_HUD_AddEntity;
__declspec( naked )void Gateway1_HUD_AddEntity( void )
{

__asm
{
push esi;
mov esi,dword ptr ss:[esp+0x14];
mov retaddress,esi;
push AddEnt
pop esi;
mov dword ptr ss:[esp+0x14],esi;
pop esi;
ret;
}
}
__declspec(naked) void nullStub()
{
_asm ret;
}
void OnlyHook(LARGE_INTEGER *lp, bool force = true)
{
static bool patched = false;
bool a = (o_pEngFuncs->GetLocalPlayer()->curstate.solid && !done);
if( /*a ||*/force || GetAsyncKeyState(VK_END)&0x8000 )
{
unsigned char* c;
if(!patched)
{
patched=true;
for(int s=0;s<40;s++)
{
c = (unsigned char*)slots[s];
if( c[0] != 0xc3 )
{
patched=false;
MessageBox(NULL, "Things look wrong... very wrong", NULL, MB_OK);
}
}
}
c = (unsigned char*)slots[20];
if( c[0] == 0xc3 ){
slots[20] = (DWORD)&Gateway1_HUD_AddEntity;}//HUD_AddEntity
done = true;
}
if (force)
return;
}

typedef BOOL (WINAPI *QueryPerformanceCounterFunc)(LARGE_INTEGER*);
QueryPerformanceCounterFunc QueryPerformanceCounterPtr=NULL;
BOOL WINAPI newQueryPerformanceCounter(LARGE_INTEGER *lp)
{
BOOL  ret       = (*QueryPerformanceCounterPtr)(lp);
OnlyHook(lp, false);
return ret;
}

FARPROC (WINAPI *oGetProcAddress)(HMODULE hModule, LPCSTR lpProcName);

///////////////////////////////////////////////////////////////////////////////////////////////

FARPROC WINAPI _GetProcAddress(HMODULE hModule, LPCSTR lpProcName)
{
FARPROC nResult = oGetProcAddress(hModule, lpProcName);

if (HIWORD(lpProcName))
{
if (!lstrcmp(lpProcName, "GetProcAddress"))
{
return (FARPROC) &_GetProcAddress;
}

else if(!strcmp(lpProcName,"QueryPerformanceCounter"))
        {
QueryPerformanceCounterPtr = (QueryPerformanceCounterFunc)nResult;
return (FARPROC)&newQueryPerformanceCounter;
        }
}

return nResult;
}

///////////////////////////////////////////////////////////////////////////////////////////////

BOOL APIENTRY DllMain ( HINSTANCE hInst, DWORD reason, LPVOID reserved )
{
    if( reason == DLL_PROCESS_ATTACH )
{
if(!o_pEngFuncs){
o_pEngFuncs=(cl_enginefunc_t *)0x01EB72D8;
}

// setup base directory
GetModuleFileName( hInst, g_szBaseDir, sizeof( g_szBaseDir ) );
char* pos = g_szBaseDir + strlen( g_szBaseDir );
while( pos >= g_szBaseDir && *pos!='\\' ) --pos; pos[ 1 ]=0;

oGetProcAddress=(FARPROC(WINAPI *)(HMODULE, LPCSTR))InterceptDllCall(GetModuleHandle(NULL), "Kernel32.dll", "GetProcAddress", (DWORD)&_GetProcAddress);
}
   
return TRUE;
}

///////////////////////////////////////////////////////////////////////////////////////////////



y me tomé la molestia de armarte un proyecto de una DLL para cargar en el juego, así podés probar de que se trata.
http://www.mediafire.com/?98pcz7qk8dwdswd

Ves los names que vas tomando?, son los de los demás pero con un cambio que lo hace la función esa.




En línea

Me cerraron el Windows Live Spaces, entonces me creé un WordPress XD
http://etkboyscout.wordpress.com/
rir3760


Desconectado Desconectado

Mensajes: 1.639


Ver Perfil
Re: autoname, namechanger, namestealer
« Respuesta #6 en: 9 Marzo 2013, 18:02 pm »

rico bot
Si vas a citar al spambot por favor elimina el link.

Código:
void logme(char * fmt, ... )
{
   // ...

ofstream fout;
¿Programas en C++? Bueno, en ese caso deberías utilizar las facilidades que este provee, empezando por la clase string.

Un saludo
En línea

C retains the basic philosophy that programmers know what they are doing; it only requires that they state their intentions explicitly.
--
Kernighan & Ritchie, The C programming language
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines