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

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


  Mostrar Temas
Páginas: [1]
1  Comunicaciones / Redes / UDP streamming en: 16 Septiembre 2014, 06:12 am
Ok dicen que el protocolo UDP es mejor que el TCP para el video streamming, ok lo entiendo, leo teoria y tiene sentido, entonces programo una aplicacion que envia paquetes no mayores a 1.45kb ( este es el limite, el mtu ), pero la aplicacion no logra enviar mas de 100kb en un segundo .... lo probe con un amigo al otro lado de la ciudad y con una amiga de costa rica y no sobrepasa los 100kb/s ... lo cual no es de mi agrado porque cuando descargo algo de mega o de mediafre , o de cualquier otro lugar, descargo a 160kb/s, .... quiero entender el protocolo udp y no me refiero a guias o manuales.. porque he leido muchos ... me refiero a porque eso ocurre .... ? algun experimentado tiene idea ?
2  Programación / Programación C/C++ / teoria de una videollamada en: 12 Septiembre 2014, 00:24 am
Bueno, voy a ser directo, un programa que funciona a manera de videollamda, por ejemplo

servidor: envia datos visuales al cliente
cliente: decodifica datos y los muestra a manera de imagen

se hace esto varios frames en un segudo ..

buum videollamada xd

es esta la manera en que funciona no ? ,  esa pregunta no es el objetivo de este post, resulta que tengo una duda ... tomemos una imagen bmp cualquiera de 800x600x3 pixeles eso es equivalente a 1.4mb no ? hahaha ... yo recibo buena señal por videollamada, sin mucho lag ... pero mi internet solo puede bajar 150kb/s, asi que la teoria de que se envia una imagen bmp es falsa, se necesitarian 10 segundos para enviar una imagen bmp xd entonces .... comprimimos la imagen ? la transformamos en jpg ? ya lo intente con varias imagenes y lo mas que puedo reducir es hasta 50kb , puedo enviar 3 imagenes jpg en 1 segundo .. pero eso seria lag !!!!


entonces la pregutna ... existe alguna manera que ignore , algun algoritmo, alguna forma de enviar informacion visual en vivo ? alguien sabe ? llevo todo el dia pensando ... y no encuentro nada ! xd
3  Programación / Programación C/C++ / Algoritmo de detección de bordes de Canny ( C++ Manejo básico de imágines ) en: 18 Abril 2014, 01:55 am
Hola, hace un par de meses realize un post para pedir que me ayudaran a leer una imagen haha, lo logré hacer por mi cuenta y he aprendido bastante sobre el manejo básico de imagenes.

El siguiente post lo realizo porque me molesta que haya tan pocos artículos en español sobre este tema. Lo que pondré es un algoritmo de detección de bordes de una imagen en c++, lo acabo de terminar xd

Lo pondré luego explicaré cada parte.

Código
  1.  
  2. struct cannyAlgorithm
  3.    {
  4.        unsigned char * image;
  5.  
  6.        unsigned width;
  7.        unsigned height;
  8.        unsigned size;
  9.        unsigned bpp;
  10.  
  11.        short * Gx;
  12.        short * Gy;
  13.  
  14.        short * Direction;
  15.  
  16.        double * Magnitude;
  17.  
  18.        cannyAlgorithm( unsigned char * data, unsigned imgw, unsigned imgh, unsigned bitsperpixel )
  19.        {
  20.            width   = imgw;
  21.            height  = imgh;
  22.  
  23.            size = width* height;
  24.  
  25.            bpp = bitsperpixel;
  26.  
  27.            Gx = new short[ size ];
  28.            Gy = new short[ size ];
  29.  
  30.            Direction = new short[ size ];
  31.  
  32.            Magnitude = new double[ size ];
  33.  
  34.            image = new unsigned char[ size* bpp ];
  35.            memcpy( image, data, size* bpp );
  36.        }
  37.        ~cannyAlgorithm( void )
  38.        {
  39.            delete[] Gx;
  40.            delete[] Gy;
  41.            delete[] Direction;
  42.            delete[] Magnitude;
  43.        }
  44.        int max( int a, int b )
  45.        {
  46.            int c = a > b ? a : b;
  47.            return c;
  48.        }
  49.        int min( int a, int b )
  50.        {
  51.            int c = a < b ? a : b;
  52.            return c;
  53.        }
  54.        short getAngle( double X, double Y )
  55.        {
  56.            short Angle;
  57.  
  58.            if( X* Y > 0 )  // Quadrant 1 or 3
  59.            {
  60.                if( abs( X ) >= abs( Y ) )
  61.                    Angle = 0;
  62.                else
  63.                    Angle = 180;
  64.            }
  65.            else            // Quadrant 2 or 4
  66.            {
  67.                if( abs(X) >= abs(Y) )
  68.                    Angle = 90;
  69.                else
  70.                    Angle = 270;
  71.            }
  72.  
  73.            return( Angle );
  74.        }
  75.        double hypotenuse( double a, double b )
  76.        {
  77.            double h = sqrt( a*a + b*b );
  78.            return(h);
  79.        }
  80.        bool isLocalMax( unsigned offset )
  81.        {
  82.            unsigned bottom     = max(offset - width, 0);
  83.            unsigned top        = min(offset + width, size);
  84.            unsigned left       = max(offset - 1, 0);
  85.            unsigned right      = min(offset + 1, size);
  86.            unsigned bottomLeft = max(bottom - 1, 0);
  87.            unsigned bottomRight= min(bottom + 1, size);
  88.            unsigned topLeft    = max(top - 1, 0);
  89.            unsigned topRight   = min(top + 1, size);
  90.  
  91.            double thisPoint = 0.0;
  92.            double mag[2]    = { 0.0 };
  93.  
  94.            switch( Direction[offset] )
  95.            {
  96.                case 0:
  97.                {
  98.                                /*   90
  99.                                       *
  100.                                       |******
  101.                                       |******
  102.                                 -------------* 0
  103.                                       |
  104.                                       |
  105.  
  106.                                 */
  107.                    thisPoint = abs( Gx[offset]* Magnitude[offset] );
  108.  
  109.                    mag[0] = abs( Gy[offset]* Magnitude[topRight  ] + ( Gx[offset] - Gy[offset] )* Magnitude[right] );
  110.                    mag[1] = abs( Gy[offset]* Magnitude[bottomLeft] + ( Gx[offset] - Gy[offset] )* Magnitude[left ] );
  111.                    }break;
  112.  
  113.                case 90:
  114.                {
  115.                                /*
  116.                                       90
  117.                                       *
  118.                                  *****|
  119.                                  *****|
  120.                             180 *-------------
  121.                                       |
  122.                                       |
  123.                                 */
  124.                    thisPoint = abs(Gx[offset]* Magnitude[offset] );
  125.  
  126.                    mag[0] = abs( Gy[offset]* Magnitude[bottomRight] - ( Gx[offset] + Gy[offset])* Magnitude[right] );
  127.                    mag[1] = abs( Gy[offset]* Magnitude[topLeft    ] - ( Gx[offset] + Gy[offset])* Magnitude[left ] );
  128.                }break;
  129.  
  130.                case 180:
  131.                {
  132.                                /*
  133.                                       |
  134.                                       |
  135.                             180 *-------------
  136.                                 ******|
  137.                                 ******|
  138.                                       *
  139.                                      270
  140.                                 */
  141.                    thisPoint = abs( Gy[offset]* Magnitude[offset] );
  142.  
  143.                    mag[0] = abs( Gx[offset]* Magnitude[topRight  ] + ( Gy[offset] - Gx[offset] )* Magnitude[top   ] );
  144.                    mag[1] = abs( Gx[offset]* Magnitude[bottomLeft] + ( Gy[offset] - Gx[offset] )* Magnitude[bottom] );
  145.                }break;
  146.  
  147.                case 270:
  148.                {
  149.                                /*
  150.                                       |
  151.                                       |
  152.                                 -------------* 0
  153.                                       |*******
  154.                                       |*******
  155.                                       *
  156.                                      270
  157.                                 */
  158.                    thisPoint = abs( Gy[offset]* Magnitude[offset] );
  159.  
  160.                    mag[0] = abs( Gx[offset]* Magnitude[bottomRight] - ( Gy[offset] + Gx[offset] )* Magnitude[bottom] );
  161.                    mag[1] = abs( Gx[offset]* Magnitude[topLeft    ] - ( Gy[offset] + Gx[offset] )* Magnitude[top   ] );
  162.                }break;
  163.  
  164.                default:
  165.                    break;
  166.            }
  167.  
  168.            if( thisPoint >= mag[0] && thisPoint >= mag[1] )
  169.                return( true );
  170.            return( false );
  171.        }
  172.        void grayScaleCompress( void )
  173.        {
  174.            unsigned char * compressed = new unsigned char[ size ];
  175.  
  176.            for( unsigned offset = 0; offset < size; offset++ )
  177.                compressed[offset] = image[offset* bpp];
  178.  
  179.            delete[] image;
  180.            image = new unsigned char[ size ];
  181.            memcpy( image, compressed, size );
  182.  
  183.            delete[] compressed;
  184.        }
  185.        void continuousTracing( unsigned offset, unsigned char * in, unsigned char * out, unsigned thresholding )
  186.        {
  187.            /*
  188.             The concept is sample:
  189.             I found a possible edge and I will follow this edge until its end.
  190.             Test 8 neighboring pixels and if someone is higher than thresholding then
  191.             that pixel will be another edge and I will follow it.
  192.  
  193.             This process is repeated until the value of the current pixel tested is null.
  194.             */
  195.            const unsigned edge = 255;
  196.  
  197.            unsigned dir[2];
  198.            dir[0] = width;      // Top - Bottom
  199.            dir[1] = 1;          // Left - Right
  200.  
  201.            unsigned top = min( offset + dir[0], size );
  202.            if( in[top] >= thresholding )
  203.                do
  204.                {
  205.                    if( !out[top] )
  206.                    {
  207.                        out[top] = edge;
  208.                        continuousTracing( top, in, out, thresholding );
  209.                    }
  210.                    else
  211.                        break;
  212.  
  213.                    top += dir[0];
  214.  
  215.                    if( top > size )
  216.                        break;
  217.  
  218.                }while( in[top] >= thresholding );
  219.  
  220.            unsigned bottom = max( offset - dir[0], 0 );
  221.            if( in[bottom >= thresholding] )
  222.                do
  223.                {
  224.                    if( !out[bottom] )
  225.                    {
  226.                        out[bottom] = edge;
  227.                        continuousTracing( bottom, in, out, thresholding );
  228.                    }
  229.                    else
  230.                        break;
  231.  
  232.                    bottom -= dir[0];
  233.  
  234.                    if( bottom < 0 )
  235.                        break;
  236.  
  237.                }while( in[bottom] >= thresholding );
  238.  
  239.            unsigned right = min( offset + dir[1], size );
  240.            if( in[right] >= thresholding )
  241.                do
  242.                {
  243.                    if( !out[right] )
  244.                    {
  245.                        out[right] = edge;
  246.                        continuousTracing( right, in, out, thresholding );
  247.                    }
  248.                    else
  249.                        break;
  250.  
  251.                    right += dir[1];
  252.  
  253.                    if( right > size )
  254.                        break;
  255.  
  256.                }while( in[right] >= thresholding );
  257.  
  258.            unsigned left = max( offset - dir[1], 0 );
  259.            if( in[left] >= thresholding )
  260.                do
  261.                {
  262.                    if( !out[left] )
  263.                    {
  264.                        out[left] = edge;
  265.                        continuousTracing( left, in, out, thresholding );
  266.                    }
  267.                    else
  268.                        break;
  269.  
  270.                    left -= dir[1];
  271.  
  272.                    if( left < 0 )
  273.                        break;
  274.  
  275.                }while( in[left] >= thresholding );
  276.  
  277.            unsigned topRight = min( offset + dir[0] + dir[1], size );
  278.            if( in[topRight] >= thresholding )
  279.                do
  280.                {
  281.                    if( !out[topRight] )
  282.                    {
  283.                        out[topRight] = edge;
  284.                        continuousTracing( left, in, out, thresholding );
  285.                    }
  286.                    else
  287.                        break;
  288.  
  289.                    topRight += dir[0] + dir[1];
  290.  
  291.                    if( topRight > size )
  292.                        break;
  293.  
  294.                }while( in[topRight] >= thresholding );
  295.  
  296.            unsigned bottomLeft = max( offset - dir[0] - dir[1], 0 );
  297.            if( in[bottomLeft] >= thresholding )
  298.                do
  299.                {
  300.                    if( !out[bottomLeft] )
  301.                    {
  302.                        out[bottomLeft] = edge;
  303.                        continuousTracing( bottomLeft, in, out, thresholding );
  304.                    }
  305.                    else
  306.                        break;
  307.  
  308.                    bottomLeft -= dir[0] - dir[1];
  309.  
  310.                    if( bottomLeft < 0 )
  311.                        break;
  312.  
  313.                }while( in[bottomLeft] >= thresholding );
  314.  
  315.            unsigned topLeft = min( offset + dir[0] - dir[1], size );
  316.            if( in[topLeft] >= thresholding )
  317.                do
  318.                {
  319.                    if( !out[topLeft] )
  320.                    {
  321.                        out[topLeft] = edge;
  322.                        continuousTracing( topLeft, in, out, thresholding );
  323.                    }
  324.                    else
  325.                        break;
  326.  
  327.                    topLeft += dir[0] - dir[1];
  328.  
  329.                    if( topLeft > size )
  330.                        break;
  331.  
  332.                }while( in[topLeft] >= thresholding );
  333.  
  334.            unsigned bottomRight = max( offset - dir[0] + dir[1], 0 );
  335.            if( in[bottomRight] >= thresholding )
  336.                do
  337.                {
  338.                    if( !out[bottomRight] )
  339.                    {
  340.                        out[bottomRight] = edge;
  341.                        continuousTracing( bottomRight, in, out, thresholding );
  342.                    }
  343.                    else
  344.                        break;
  345.  
  346.                    bottomRight -= dir[0] + dir[1];
  347.  
  348.                    if( bottomRight < 0 )
  349.                        break;
  350.  
  351.                }while( in[bottomRight] >= thresholding );
  352.  
  353.            /* Works with feedback and not will be an infinite loop cause I am saving the new data into a new image */
  354.        }
  355.        void computeGradients( void )
  356.        {
  357.            // Compute Gradients in X
  358.            for( unsigned y = 0; y < height; y++ )
  359.            {
  360.                unsigned offset = y* width;
  361.  
  362.                Gx[offset] = image[offset + 1] - image[offset];
  363.  
  364.                offset++;
  365.                for( unsigned x = 1; x < width - 1; x++, offset++ )
  366.                    Gx[offset] = image[offset + 1] - image[offset - 1];
  367.  
  368.                Gx[offset] = image[offset] - image[offset - 1];
  369.            }
  370.            // Compute Gradients in Y
  371.            for( unsigned x = 0; x < width; x++ )
  372.            {
  373.                unsigned offset = x;
  374.  
  375.                Gy[offset] = image[offset + width] - image[offset];
  376.  
  377.                offset += width;
  378.                for( unsigned y = 1; y < height - 1; y++, offset += width )
  379.                    Gy[offset] = image[offset + width] - image[offset - width];
  380.  
  381.                Gy[offset] = image[offset] - image[offset - width];
  382.            }
  383.            // Hypotenuse = sqrt(x^2 + y^2)
  384.            for( unsigned y = 0, offset = 0; y < height; y++ )
  385.                for( unsigned x = 0; x < width; x++, offset++ )
  386.                    Magnitude[offset] = hypotenuse( Gx[offset], Gy[offset] );
  387.            // Okay, edges of the image must be null
  388.            for( unsigned x = 0; x < width; x++ )
  389.                Magnitude[x] = 0;
  390.  
  391.            for( unsigned x = 0, offset = width* (height - 1); x < width; x++, offset++ )
  392.                Magnitude[offset] = 0;
  393.  
  394.            for( unsigned y = 0; y < width* height; y += width )
  395.                Magnitude[y] = 0;
  396.  
  397.            for( unsigned y = 0, offset = width - 1; y < width* height; y += width, offset += width)
  398.                Magnitude[offset] = 0;
  399.        }
  400.        void nonMaxSupress( void )
  401.        {
  402.            /* Compute magnitudes direction and save it */
  403.            for( unsigned y = 0, offset = 0; y < height; y++ )
  404.                for( unsigned x = 0; x < width; x++, offset++ )
  405.                    Direction[offset] = getAngle( Gx[offset], Gy[offset] );
  406.            /*
  407.                 The most complicated part:
  408.                 If the pixel is not a local maximum then kill it.
  409.                 How do I know if my point is a local max ?
  410.                 I will compare the current pixel with neighboring pixels in the gradient direction.
  411.                 Remember: Pixel with null magnitude are not candidate to be an edge.
  412.             */
  413.            for( unsigned y = 0, offset = 0; y < height; y++ )
  414.                for( unsigned x = 0; x < width; x++, offset++ )
  415.                {
  416.                    if( Magnitude[offset] && isLocalMax(offset) )
  417.                        image[offset] = Magnitude[offset] > 255 ? 255 : (unsigned char)Magnitude[offset];
  418.                    else
  419.                        image[offset] = 0;
  420.                }
  421.        }
  422.        void hysteresis( float lowScale, float highScale )
  423.        {
  424.            /*
  425.             We need a High value and a Low value, High value will be the edge color.
  426.             All pixels with color higher than ' Hight value ' will be edges
  427.             and we will follow this pixel until another pixel is founded.
  428.             The pixel founded must be a color higher than ' Low value ', if that is the case
  429.             then we will set this pixel like edge, else it will be background ( null ).
  430.             */
  431.  
  432.            lowScale    = lowScale <= 0.0f ? 0.01f : lowScale > 1.0f ? 1.0f : lowScale;
  433.            highScale   = highScale <= 0.0f ? 0.01f : highScale > 1.0f ? 1.0f : highScale;
  434.  
  435.            unsigned char globalMax = 0;
  436.            for( unsigned offset = 0; offset < size; offset++ )
  437.                if( image[offset] > globalMax )
  438.                    globalMax = image[offset];
  439.  
  440.            unsigned highV = globalMax* highScale;
  441.            unsigned lowV = globalMax* lowScale;
  442.  
  443.            unsigned char * finalPic = new unsigned char[ size ];
  444.            memset( finalPic, 0, size );
  445.  
  446.            for( unsigned y = 1,offset = 1; y < height - 1; y++ )
  447.                for( unsigned x = 1; x < width - 1; x++, offset++ )
  448.                    if( image[offset] >= highV && !finalPic[offset] )
  449.                    {
  450.                        finalPic[offset] = 255;
  451.                        continuousTracing( offset, image, finalPic, lowV );
  452.                    }
  453.  
  454.            delete[] image;
  455.            image = new unsigned char[ size ];
  456.            memcpy( image, finalPic, size );
  457.  
  458.            delete[] finalPic;
  459.        }
  460.        void grayScaleDecompress( void )
  461.        {
  462.            size = width* height* bpp;
  463.            unsigned char * decompressed = new unsigned char[ size ];
  464.  
  465.            for( unsigned offset = 0; offset < width* height; offset++ )
  466.                decompressed[offset*bpp + 0] = decompressed[offset* bpp + 1] = decompressed[offset* bpp + 2] = image[offset];
  467.  
  468.            delete[] image;
  469.            image = new unsigned char[ size ];
  470.            memcpy( image, decompressed, size );
  471.  
  472.            delete[] decompressed;
  473.        }
  474.        void AutoEdgeDetection( unsigned char * data, float lowV, float highV )
  475.        {
  476.            grayScaleCompress();
  477.            computeGradients();
  478.            nonMaxSupress();
  479.            hysteresis(lowV, highV);
  480.            grayScaleDecompress();
  481.  
  482.            memcpy( data, image, size );
  483.        }
  484.        unsigned char * get_data( void )
  485.        {
  486.            grayScaleDecompress();
  487.            return( image );
  488.        }
  489.    };
  490.  
  491.  


Lo puse todo en una estructura para que sea más portable y además para que  no dependa de otras librerias añadí funciones como max, min y hypotenuse, creo que solo debe incluir la libreria <cmath> para la funcion abs

Se preguntarán: Okay, tengo el algorithmo, ¿ Ahora qué ?.

fácil, para usarlo deben iniciailizarlo con el ancho y alto de la imagen, la cantidad de bits por pixel( 1 , 2 , 3 o 4 ) y el unsigned char de la data de la imagen, ejemplo:

Código
  1.  
  2.    gaussianBlur(15, 2);
  3.    grayScale();
  4.    cannyAlgorithm cpix( ~self.data, self.width, self.height, self.bpp / 8 );
  5.  
  6.    cpix.AutoEdgeDetection( ~self.data, 0.2f, 0.25f );
  7.  
  8.  

seguire explicando abajo
4  Programación / Programación C/C++ / Cargar y mostrar image BMP c++ en: 27 Febrero 2014, 01:35 am
¿ Que ven mal en mi codigo ?
Es que me muestra un cuadro gris pero no carga la textura .... no entiendo porque
Estoy algo desesperado y puede que este pasando algo por alto, si alguien ve algo malo digame T_T

PD: empeze a hacerlo hace unas horas y no he estudiado mucho con respecto al manejo de BMP's, tal ves ese sea mi problema

Código
  1.  
  2. bool SPRITE::LoadBMP(const char * path, GLuint * texture)
  3. {
  4. std::ifstream img(path, std::ios::binary);
  5. if( !img )
  6. return(False);
  7.  
  8. BITMAPFILEHEADER imgHeader;
  9. BITMAPINFOHEADER imgInfo;
  10.  
  11. img.read( (char*)&imgHeader,sizeof(BITMAPFILEHEADER) );
  12. img.read( (char*)&imgInfo, sizeof( BITMAPINFOHEADER ) );
  13.  
  14. if (imgHeader.bfType != 0x4D42)
  15. return(False);
  16.  
  17. int size = ( imgInfo.biSizeImage );
  18.  
  19. BYTE * pix =new BYTE[size];
  20. img.read( (char*)pix, size );
  21.  
  22. img.close();
  23.  
  24. BYTE * data = new BYTE[size];
  25. for (int i = 0; i < size; i += 3)
  26. {
  27. data[i+0] = pix[i+2];
  28. data[i+1] = pix[i+1];
  29. data[i+2] = pix[i+0];;
  30. }
  31.  
  32. unsigned int w = imgInfo.biWidth;
  33. unsigned int h = imgInfo.biHeight;
  34.  
  35. glGenTextures(1, texture);          
  36. glBindTexture(GL_TEXTURE_2D, *texture);            
  37.  
  38. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  39. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  40.  
  41. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
  42.  
  43. glBindTexture(GL_TEXTURE_2D, NULL);
  44.  
  45. return(True);
  46. }
  47.  
  48.  
5  Programación / Ingeniería Inversa / modificar valor de X variable de un proceso mediante un programa creado en c++ en: 3 Febrero 2014, 23:16 pm
Amm, soy nuevo ._. me vi en la necesidad de unirme a un foro de programacion porque hay algo que realmente no logro comprender, me explicare...

Llevo varias horas estudiando sobre como inyectar fracciones de codigo en un programa, desde otro programa creado por mi en c++ ( alrededor de 50 horas en los ultimos 3 dias ), y hasta ahora he logrado modificar el valor del dinero en counter strike xd y el valor de una variable de un programa "victima.exe" que yo mismo cree para iniciarme.

si, tuve exito, pero si reinicio el programa la posicion de la memoria de la variable es distinta, ya se que eso es normal xd lo que no logro es encontrar la posicion de memoria estatica, me es dificil explicarme pero supongo que mas de uno paso por esto.

"Address=Base+offset+offset+offset"

ok .. intente con el cheat engine 6.2 pero solo logre conseguir una posicion de memoria dinamica y de ahi no logro por mas que lo intento conseguir la estatica

les muestro mi codigo y les explico:

main.cpp

Código
  1.  
  2.  
  3. #include "stdafx.h"
  4. #include "util.h"
  5. #include <tlhelp32.h>  
  6. #include <shlwapi.h>  
  7.  
  8. #define PROCESS_NAME "victima.exe"
  9.  
  10. int readMemory(DWORD pId);
  11. DWORD getProcessId(IN PCHAR szExeName);
  12.  
  13.  
  14. int main()
  15. {
  16. DWORD pId=getProcessId(PROCESS_NAME);
  17. if(!pId)
  18. return(0);
  19.  
  20. int result=readMemory(pId);
  21.  
  22. std::cout<<result<<std::endl;
  23. system("pause");
  24.  
  25. return 0;
  26. }
  27.  
  28. int readMemory(DWORD pId)
  29. {
  30. int hex=0x0016FAC8, // esto lo obtengo con cheat engine
  31. int offset = -8; // esto lo obtengo con cheat engine
  32. int memory,pointerBase,result;
  33. HANDLE hProc = OpenProcess(PROCESS_VM_READ, FALSE, pId);
  34. ReadProcessMemory(hProc, (LPVOID)hex, &memory, 4, NULL);
  35. pointerBase = memory-offset;
  36. ReadProcessMemory(hProc, (LPVOID)pointerBase, &result,4, NULL);
  37. return(result);
  38. }
  39.  
  40. DWORD getProcessId(IN PCHAR szExeName)
  41. {
  42.    DWORD dwRet = 0;
  43.    DWORD dwCount = 0;
  44.  
  45.    HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  46.  
  47.    if (hSnapshot != INVALID_HANDLE_VALUE)
  48.    {
  49.        PROCESSENTRY32 pe = {0};
  50.        pe.dwSize = sizeof(PROCESSENTRY32);
  51.  
  52.        BOOL bRet = Process32First(hSnapshot, &pe);
  53.  
  54.        while (bRet)
  55.        {
  56.            if (!_stricmp(cw(pe.szExeFile), szExeName))
  57.            {
  58.                dwCount++;
  59.                dwRet = pe.th32ProcessID;
  60.            }
  61.            bRet = Process32Next(hSnapshot, &pe);
  62.        }
  63.  
  64.        if (dwCount > 1)
  65.            dwRet = 0xFFFFFFFF;
  66.  
  67.        CloseHandle(hSnapshot);
  68.    }
  69.  
  70.    return dwRet;
  71. }
  72.  
  73.  

util.h , tenia unos errores con el stricmp y logre crearme esta funcion xd

Código
  1. wchar_t * wc(const char* word)
  2. {
  3.    size_t newsize = strlen(word) + 1;
  4.    wchar_t * wcs = new wchar_t[newsize];
  5.  
  6.    size_t convertedChars = 0;
  7.    mbstowcs_s(&convertedChars, wcs, newsize, word, _TRUNCATE);
  8.  
  9. return( wcs );
  10. }
  11.  
  12. char * cw(const wchar_t* word)
  13. {
  14.    size_t newsize = wcslen(word) + 1;
  15.    char * wcs = new char[newsize];
  16.  
  17.    size_t convertedChars = 0;
  18.    wcstombs_s(&convertedChars, wcs, newsize, word, _TRUNCATE);
  19.  
  20. return( wcs );
  21. }
  22.  
  23.  


aca el link del programa victima.exe:
http://www.mediafire.com/download/4iwb35swrh4o8ei/victima.exe

victima.cpp

Código
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <stdlib.h>
  4.  
  5. int _tmain(int argc, _TCHAR* argv[])
  6. {
  7. int num=1000;
  8. while(num>0)
  9. {
  10. std::cout<<num<<std::endl;
  11. num-=10;
  12. system("pause");
  13. }
  14. return 0;
  15. }
  16.  
  17.  

me gustaria que si alguno tiene alguna idea de como hacerlo me explicara, señores solo necesito eso xd la ***** posicion de la variable X xd pero .. una posicion que no cambie al reiniciar el programa, me gustaria una explicacion de lo que neceisto hacer y del error que estoy cometiendo xd

espero no haber publicado en la sección incorrecta y espero que alguien me responda al menos un "hola" xd

Gracias de antemano.
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines