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

 

 


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


  Mostrar Mensajes
Páginas: 1 2 3 4 5 6 [7] 8 9 10 11 12 13 14 15 16
61  Programación / .NET (C#, VB.NET, ASP) / problemas con GetModuleFileNameExA. en: 15 Marzo 2012, 19:46 pm
hola. e decido jugar con algunas apis, para eso quiese enlistar en un listview los procesos, sus pid, y su ruta pero tengo un inconveniente con la ruta ...
Código
  1. 'veran en vb6 con esta api no tengo ningun problema :
  2.  
  3. Private Declare Function GetModuleFileNameExA Lib "PSAPI.DLL" (ByVal _  
  4.    hProcess As Long, _  
  5.    ByVal hModule As Long, ByVal _  
  6.    lpFilename As String, _  
  7.    ByVal nSize As Long) As Long

y adapte la api en .net de esta forma

 
Código
  1. <System.Runtime.InteropServices.DllImport("PSAPI.DLL")> _
  2.    Private Shared Function GetModuleFileNameExA(ByVal hWnd As System.IntPtr, ByVal hModule As Int32, ByVal lpFilename As String, ByVal nSize As Int32) As Integer
  3.    End Function

pero al querer adquirir la ruta de cierto proceso no sale nada  porque sera ?
mi codigo

Código
  1.        Dim Proceso As Process, ret As Integer, hola As String
  2.  
  3.        For Each Proceso In Process.GetProcesses
  4.  
  5.            If Proceso.ProcessName = "notepad" Then
  6.  
  7.                hola = Space(255)
  8.                ret = GetModuleFileNameExA(Proceso.Handle, 0, hola, 255)
  9.  
  10.                MsgBox(Len(Microsoft.VisualBasic.Left(hola, ret))) ' no optengo nada ??
  11.            Else
  12.  
  13.            End If
  14.  
  15.  
  16.        Next

Alguna sugerencia. gracias ..
 :( :( :( :(
62  Programación / Programación C/C++ / consejo Base de Datos.. en: 1 Agosto 2011, 20:30 pm
hola . estoy asiendo una base de datos para millones de usuarios. Y tengo dos dudas enfrentadas. Son las siguientes : (en c++)

¿Cuál  de estas formas es mas rápida y consume menos recursos?

Forma 1: mantener en una Cadena todos los usuarios (supongamos q serian 2 millones)  y en la petición extraer el usuario directamente de cadena. Pero lo malo es que consume mucha ram y en la hora de buscar un usuario entre 2 millones consume mucho y se puede desbordar el  buffer.
Forma 2: mantener en una carpeta  todas las carpetas con los nombres de usuario y adentro de la carpeta un archivo .txt con su datos .asi en la petición lo extrae directamente mas rápido y no consume ram pero consume disco y muchas carpetas ejemplo:

Petición :usuario rembolso&pass&choripan
Server: busca una carpeta que se llame rembolso y dentro de esa carpeta esta rembolsopass.txt

UsuariosDB\Rembolso\rembolsopass.txt

La petición es mas rápida pero como ya aclare consume mucho disco y lo hace mas lento pero no importa necesitaría un consejo. Y si hay otra forma por favor postéenla.

gracias por leer
63  Programación / ASM / Re: mover en memoria en: 25 Julio 2011, 19:18 pm
gracias. estoy buscando informacion asrca de la la estructura dememoria en assm y como actua . esto ya lo eecho en c++ y en vb  con copymen en c pero quiero en asm jeje .si termino el code lo posteo gracias
64  Programación / ASM / Re: mover en memoria en: 25 Julio 2011, 07:30 am
Иōҳ ese ejemplo si no me equivoco es para concatenar cadenas pero lo q yo busco es unir sectores de memoria (en ejecucion).
ejemplo
memoria :D
DIRECCION|   Hex byte                                     |show bytes
------------------------------------------------------------------------------
03BB0000   |  4D 65 6E 73 61 6A 65                   |Mensaje.....
03BB0001   |  00 00 00 00 20 14 55                    | . . . . . 2  @
03BB0009   |  48 6F 6C 61 20 4D 75 6E 64 6F      |Hola Mundo......
------------------------------------------------------------------------------
LA COSITA es que me traslade la cadena  03BB0000(mensaje) a la cadena 03BB0009   (hola mundo). y el sector de  memoria quedaria :
DIRECCION|   Hex byte                                     |show bytes
------------------------------------------------------------------------------
03BB0000   |  4D 65 6E 73 61 6A 65                   |Mensaje.....
03BB0001   |  00 00 00 00 20 14 55                    | . . . . . 2  @
03BB0009   |  48 6F 6C 61 20 4D 75 6E 64 6F 4D 65 6E 73 61 6A 65     |Hola Mundo Mensaje......
------------------------------------------------------------------------------
quedaria modificado en memoria. (supongamo que es la memoria de otro proceso )
lo que necesito es concatenar cualquier sector de memoria no importa si es de otra aplicacion
65  Programación / ASM / Re: mover en memoria en: 25 Julio 2011, 04:38 am
tendrias un ejemplo de como funciona o mas detalle yo encontre este pero no lo entiendo mucho con el rep

MOV AH, 62h
: INT 21h
: MOV ES, BX
: CLD
:
: mov bx, @data
: mov es, bx
: lea di, buffer
: mov cx , 333
: rep movsb
: mov [di], 30h ;** line 23 ????
:
: mov dx,buffer
: MOV AH, 09h
: INT 21h
66  Programación / ASM / Re: Libros de Ensamblador / ASM [eBooks] en: 24 Julio 2011, 22:23 pm
q lindo jamon porq hace un ratito empeze con asm
67  Programación / ASM / mover en memoria en: 24 Julio 2011, 22:16 pm
hola. acabo de empezar a programar en asm y e echo unos 25 ejemplos con hola mundo y ese tipo de cosa tambien e practicado descargar de una pila en orden etc. pero me encuentro con esta actividad mover el contenido de una direccion de memoria a otra direccion  ejemplo:
direccion a
004033C0 "hola mundo"
direccion b
004033E0 "mira esto:"
-------------
.MODEL SMALL
.CODE
Programa:
MOV AX, 004033C0
MOV DS, AX
MOV 004033E0 ,AX

.STACK

END Programa
------------ Y EN la direccion de mem 004033E0  TENDRIA QUE QUEDAR "mira esto: hola mundo"
pero me sale error bue me canse de intentarlo de mil formas diferentes talves me den una mano soy nobb ajaja  y un tutorial donde salgan este tipo de ejemplos saludos
68  Programación / Programación Visual Basic / Re: se corta la cadena string en: 1 Mayo 2011, 06:13 am
gracias .. me re olvide del binario... xD:
69  Programación / Programación Visual Basic / se corta la cadena string en: 1 Mayo 2011, 05:06 am
hola . estoy intentando abrir archivos de mi pc y encontro una imagen que no se abre.

es esta imagen:

es la del celular del facebook .
Código
  1. Public Function AbrirArichivo(file As String)
  2. Dim n_File As Integer
  3. Dim Linea As String
  4.    n_File = FreeFile()
  5. Open file For Input As n_File
  6.  
  7. While Not EOF(n_File)
  8.  
  9. Line Input #n_File, Linea
  10.  
  11. Wend
  12.  
  13. Close #n_File
  14. AbrirArichivo = Linea
  15. text2.text =  AbrirArichivo ' en este texto se visualizan los siguiente bytes: ‰PNG
  16. ' solo esos bytes porq no se visualiza todo el archivo .
  17. End Function
70  Programación / Programación C/C++ / error copilando WinPcap en: 9 Febrero 2011, 02:15 am
hola . estoy con dev c++ 5.0 utilizando la libreria winpcap .  y busque un ejemplo de filtrar paquetes .
Código
  1. /*
  2.  * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
  3.  * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms, with or without
  7.  * modification, are permitted provided that the following conditions
  8.  * are met:
  9.  *
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  * notice, this list of conditions and the following disclaimer.
  12.  * 2. Redistributions in binary form must reproduce the above copyright
  13.  * notice, this list of conditions and the following disclaimer in the
  14.  * documentation and/or other materials provided with the distribution.
  15.  * 3. Neither the name of the Politecnico di Torino, CACE Technologies
  16.  * nor the names of its contributors may be used to endorse or promote
  17.  * products derived from this software without specific prior written
  18.  * permission.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31.  *
  32.  */
  33.  
  34.  
  35. #include <stdlib.h>
  36. #include <stdio.h>
  37.  
  38. #include <pcap.h>
  39.  
  40. #define MAX_PRINT 80
  41. #define MAX_LINE 16
  42.  
  43.  
  44. void usage();
  45.  
  46.  
  47. void main(int argc, char **argv)
  48. {
  49. pcap_t *fp;
  50. char errbuf[PCAP_ERRBUF_SIZE];
  51. char *source=NULL;
  52. char *ofilename=NULL;
  53. char *filter=NULL;
  54. int i;
  55. pcap_dumper_t *dumpfile;
  56. struct bpf_program fcode;
  57. bpf_u_int32 NetMask;
  58. int res;
  59. struct pcap_pkthdr *header;
  60. const u_char *pkt_data;
  61.  
  62.    if (argc == 1)
  63.    {
  64.        usage();
  65.        return;
  66.    }
  67.  
  68.    for(i=1;i < argc; i+= 2)
  69.    {
  70.  
  71.        switch (argv[i] [1])
  72.        {
  73.            case 's':
  74.            {
  75.                source=argv[i+1];
  76.            };
  77.            break;
  78.  
  79.            case 'o':
  80.            {
  81.                ofilename=argv[i+1];
  82.            };
  83.            break;
  84.  
  85.            case 'f':
  86.            {
  87.                filter=argv[i+1];
  88.            };
  89.            break;
  90.        }
  91.    }
  92.  
  93.    // open a capture from the network
  94.    if (source != NULL)
  95.    {
  96.        if ( (fp= pcap_open(source,
  97.                            1514 /*snaplen*/,
  98.                            PCAP_OPENFLAG_PROMISCUOUS /*flags*/,
  99.                            20 /*read timeout*/,
  100.                            NULL /* remote authentication */,
  101.                            errbuf)
  102.                            ) == NULL)
  103.        {
  104.            fprintf(stderr,"\nUnable to open the adapter.\n");
  105.            return;
  106.        }
  107.    }
  108.  
  109.    else usage();
  110.  
  111.    if (filter != NULL)
  112.    {
  113.        // We should loop through the adapters returned by the pcap_findalldevs_ex()
  114.        // in order to locate the correct one.
  115.        //
  116.        // Let's do things simpler: we suppose to be in a C class network ;-)
  117.        NetMask=0xffffff;
  118.  
  119.        //compile the filter
  120.        if(pcap_compile(fp, &fcode, filter, 1, NetMask) < 0)
  121.        {
  122.            fprintf(stderr,"\nError compiling filter: wrong syntax.\n");
  123.            return;
  124.        }
  125.  
  126.        //set the filter
  127.        if(pcap_setfilter(fp, &fcode)<0)
  128.        {
  129.            fprintf(stderr,"\nError setting the filter\n");
  130.            return;
  131.        }
  132.  
  133.    }
  134.  
  135.    //open the dump file
  136.    if (ofilename != NULL)
  137.    {
  138.        dumpfile= pcap_dump_open(fp, ofilename);
  139.  
  140.        if (dumpfile == NULL)
  141.        {
  142.            fprintf(stderr,"\nError opening output file\n");
  143.            return;
  144.        }
  145.    }
  146.    else usage();
  147.  
  148.    //start the capture
  149.    while((res = pcap_next_ex( fp, &header, &pkt_data)) >= 0)
  150.    {
  151.  
  152.        if(res == 0)
  153.        /* Timeout elapsed */
  154.        continue;
  155.  
  156.        //save the packet on the dump file
  157.        pcap_dump((unsigned char *) dumpfile, header, pkt_data);
  158.  
  159.    }
  160. }
  161.  
  162.  
  163. void usage()
  164. {
  165.  
  166.    printf("\npf - Generic Packet Filter.\n");
  167.    printf("\nUsage:\npf -s source -o output_file_name [-f filter_string]\n\n");
  168.    exit(0);
  169. }
  170.  
  171.  
Código
  1. [code=bash]In file included from C:/Dev-Cpp/include/pcap.h:14,
  2.                 from main.c:38:
  3. C:/Dev-Cpp/include/pcap++/Packet.h:16: error: syntax error before "pcappp"
  4. C:/Dev-Cpp/include/pcap++/Packet.h:16: error: syntax error before '{' token
  5.  
  6. C:/Dev-Cpp/include/pcap++/Packet.h:36: error: syntax error before "Data"
  7. C:/Dev-Cpp/include/pcap++/Packet.h:36: warning: data definition has no type or storage class
  8. C:/Dev-Cpp/include/pcap++/Packet.h:42: warning: data definition has no type or storage class
  9. C:/Dev-Cpp/include/pcap++/Packet.h:50: error: syntax error before "const"
  10. C:/Dev-Cpp/include/pcap++/Packet.h:50: warning: data definition has no type or storage class
  11. C:/Dev-Cpp/include/pcap++/Packet.h:56: error: syntax error before "const"
  12. C:/Dev-Cpp/include/pcap++/Packet.h:69: error: syntax error before '&' token
  13. C:/Dev-Cpp/include/pcap++/Packet.h:84: error: `packet' undeclared here (not in a function)
  14. C:/Dev-Cpp/include/pcap++/Packet.h:84: warning: data definition has no type or storage class
  15. C:/Dev-Cpp/include/pcap++/Packet.h:85: error: `false' undeclared here (not in a function)
  16. C:/Dev-Cpp/include/pcap++/Packet.h:85: warning: data definition has no type or storage class
  17. C:/Dev-Cpp/include/pcap++/Packet.h:86: error: syntax error before '}' token
  18. C:/Dev-Cpp/include/pcap++/Packet.h: In function `get_seconds':
  19. C:/Dev-Cpp/include/pcap++/Packet.h:116: error: syntax error before '{' token
  20. C:/Dev-Cpp/include/pcap++/Packet.h:168: error: syntax error before "Data"
  21.  
  22. In file included from C:/Dev-Cpp/include/pcap++/DataLink.h:15,
  23.  
  24.                 from C:/Dev-Cpp/include/pcap.h:15,
  25.                 from main.c:38:
  26. C:/Dev-Cpp/include/string.h:37: warning: `__pure__' attribute ignored
  27. C:/Dev-Cpp/include/string.h:42: warning: `__pure__' attribute ignored
  28. C:/Dev-Cpp/include/string.h:43: warning: `__pure__' attribute ignored
  29. C:/Dev-Cpp/include/string.h:46: warning: `__pure__' attribute ignored
  30. C:/Dev-Cpp/include/string.h:49: warning: `__pure__' attribute ignored
  31. C:/Dev-Cpp/include/string.h:51: warning: `__pure__' attribute ignored
  32. C:/Dev-Cpp/include/string.h:53: warning: `__pure__' attribute ignored
  33. C:/Dev-Cpp/include/string.h:54: warning: `__pure__' attribute ignored
  34. C:/Dev-Cpp/include/string.h:55: warning: `__pure__' attribute ignored
  35. C:/Dev-Cpp/include/string.h:56: warning: `__pure__' attribute ignored
  36. C:/Dev-Cpp/include/string.h:67: warning: `__malloc__' attribute ignored
  37. C:/Dev-Cpp/include/string.h:92: warning: `__malloc__' attribute ignored
  38. C:/Dev-Cpp/include/string.h:97: error: storage class specified for parameter `strcasecmp'
  39. C:/Dev-Cpp/include/string.h:97: error: syntax error before '{' token
  40.  
  41. C:/Dev-Cpp/include/string.h:103: error: storage class specified for parameter `strncasecmp'
  42. C:/Dev-Cpp/include/string.h:103: error: syntax error before '{' token
  43. C:/Dev-Cpp/include/string.h:170: error: storage class specified for parameter `wcscmpi'
  44. C:/Dev-Cpp/include/string.h:170: error: redefinition of parameter 'wcscmpi'
  45. C:/Dev-Cpp/include/string.h:167: error: previous definition of 'wcscmpi' was here
  46. C:/Dev-Cpp/include/string.h:170: error: syntax error before '{' token
  47. In file included from C:/Dev-Cpp/include/pcap.h:15,
  48.                 from main.c:38:
  49. C:/Dev-Cpp/include/pcap++/DataLink.h:17: error: syntax error before "namespace"
  50. C:/Dev-Cpp/include/pcap++/DataLink.h:482: error: parameter `desc' is initialized
  51. C:/Dev-Cpp/include/pcap++/DataLink.h:482: error: `m_type' undeclared (first use in this function)
  52. C:/Dev-Cpp/include/pcap++/DataLink.h:482: error: (Each undeclared identifier is reported only once
  53. C:/Dev-Cpp/include/pcap++/DataLink.h:482: error: for each function it appears in.)
  54. C:/Dev-Cpp/include/pcap++/DataLink.h:482: confused by earlier errors, bailing out
  55.  
  56. make.exe: *** [main.o] Error 1
  57.  
  58. Ejecución Terminada
ALGUNA solucion que me ofrescan
documentacion:http://www.winpcap.org/docs/docs_40_2/html/group__wpcapsamps.html

surce code de winpcap: http://www.winpcap.org/install/bin/PacketCE.zip[/code]
Páginas: 1 2 3 4 5 6 [7] 8 9 10 11 12 13 14 15 16
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines