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

 

 


Tema destacado: Estamos en la red social de Mastodon


  Mostrar Mensajes
Páginas: [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... 32
1  Programación / Java / ProcessBuilder- Ayuda para Ejecutar en terminal. en: 26 Agosto 2016, 01:07 am
Alguien me podria decir como poner este codigo de forma correcta?

Código:
ProcessBuilder processBuilder = new ProcessBuilder(sudo partclone.ntfs -c -s /dev/sda5 | gzip -c9 > /media/toni/Datos/toniARCH.bk)

Se que debe quedar algo asi

Código:
"sudo", "partclone.ntfs", "-c", "-s", "/dev/sda5" 
pero no lo consigo
2  Foros Generales / Dudas Generales / Aguien sabe de algun bootloader que sirva tanto para UEFI como para BIOS? en: 22 Febrero 2016, 11:33 am

Busco un bootloader que sirva tanto para uefi como para bios y que sea grafico como burg.
Burg no me sirve ya que esta abandonado desde hace años.

He visto el refind y el clover pero no se si sirven para bios.
3  Programación / Java / Ayuda con mi codigo. (Enviar buffer de imagen de c++ a java)(SOCKETS) en: 18 Diciembre 2015, 16:59 pm
Estoy intentando hacer streaming capturando la pantalla del pc y enviando el buffer por socket a
java(Android).

Al parecer mi codigo funciona bien pero al poco de iniciar el streaming me da error en java(Android)

Alguna idea?.

Este es mi codigo de c++:
Código:

                        byte* buffer=NULL;

                        ULONG tamañobuffer=NULL;

                        ULONG comprobacion = NULL;

                        CapturarPantalla(buffer,tamañobuffer, 50);


long int NetInt;

NetInt = htonl((unsigned)tamañobuffer);

                        send(s2, (char *)&NetInt, sizeof(long), 0);

recv(s2,(char*)&comprobacion,sizeof(long),0);

                        long int hostint = ntohl(comprobacion);

printf("\n%lu\n", hostint);

send(s2, (char*)buffer,(int) tamañobuffer, 0);

Y mi codigo java es este :

Código:

  private Runnable updateTask = new Runnable () {
 
    public void run() {
   
            int tamaño=0;
   
    try {
        InStream = new DataInputStream(btSocket.getInputStream());
tamaño= InStream.readInt();


    } catch (IOException e) {

        e.printStackTrace();
        }
   
   
    try {

                                        outStream= new DataOutputStream(btSocket.getOutputStream());
outStream.writeInt(tamaño);
 
} catch (IOException e) {

// TODO Bloque catch generado automáticamente

e.printStackTrace();
}

                    int bufferSize = 1024;

                            byte[] buffer = new byte[bufferSize];
 
                    int totalBytesRead = 0;

                    int numBytesRead   = 0;

                    byte[] result = new byte[tamaño];
   
    while (totalBytesRead != tamaño )
      {
   
    try {
numBytesRead    = InStream.read(buffer);
} catch (IOException e) {
// TODO Bloque catch generado automáticamente
e.printStackTrace();
}
   
    System.arraycopy(buffer, 0, result, totalBytesRead, numBytesRead);
         
    totalBytesRead += numBytesRead;
           }
     
                         Bitmap bmp = BitmapFactory.decodeByteArray(result, 0, tamaño);
       
                                             ImageView image = (ImageView) findViewById(R.id.imageView1);
                   
                                             image.setImageBitmap(bmp);
     
                           buffer = null;
                       
                                              totalBytesRead = 0;
     
                                             numBytesRead   = 0;
         
                                             result=null;
     


     
                  mHandler.postDelayed(updateTask, 20);

           
    }
};
 

4  Programación / Java / Como se envia un numero (xxxxxxxxxxxxxxxxx) de c++ a java? en: 5 Octubre 2015, 14:02 pm
Necesito enviar el tamaño de un archivo y recogerlo en java.
Me podeis guiar un poco?
5  Programación / Java / Problema al recivir imagen c++/java en: 21 Septiembre 2015, 16:00 pm
Buenas.
Intento enviar imagen tras imagen en c++ y ir guardarlas en java(android).
No se por que pero es como que guarda imagen tras imagen en el mismo archivo.
Ayuda¡¡¡¡


Código
  1.  
  2. //c++
  3.  
  4. unsigned char *mem;
  5. size_t  mem_size;
  6.  
  7. send(s2,(char*)mem,mem_size, 0);
  8.  
  9.  

Y lo recivo en java asi:


Código
  1.  
  2. //JAVA
  3.  
  4. Thread t = new Thread() {
  5. int u=0;
  6.      @Override
  7.      public void run() {
  8.        try {
  9.  
  10.          while (!isInterrupted()) {
  11.            Thread.sleep(1000);
  12.            runOnUiThread(new Runnable() {
  13.              @Override
  14.              public void run() {
  15.  
  16.  
  17.         File result = new File( "/sdcard/1/testImg"+u+".jpg" );
  18.          u++;
  19.         try {
  20.  
  21.         BufferedInputStream in = new BufferedInputStream( btSocket.getInputStream() );
  22.         BufferedOutputStream outt = new BufferedOutputStream( new FileOutputStream( result ) );
  23.  
  24.         byte[] buffer = new byte[ 4096 ];
  25.                    int bytesRead;
  26.                    while ( (bytesRead = in.read( buffer )) != 0 ) {
  27.                 outt.write( buffer, 0, bytesRead );
  28.                    }
  29.  
  30.                 outt.flush();
  31.                 outt.close();
  32.  
  33.                 out.append( "Done." );
  34.  
  35.         } catch ( FileNotFoundException e ) {
  36.         e.printStackTrace();
  37.         } catch ( IOException e ) {
  38.         e.printStackTrace();
  39.         }
  40.  
  41.  
  42.              }
  43.            });
  44.          }
  45.        } catch (InterruptedException e) {
  46.        }
  47.      }
  48.     };
  49.  
  50.  
6  Programación / Java / Como cargar un jpg en un imageview desde un buffer ? (Android) en: 3 Septiembre 2015, 18:50 pm
Intento ir actualizando el imageview con la llegada del buffer pero no carga la imagen.
Este seria el codigo... Aver si me pueden ayudar.

Envio de datos desde c++;
Código:
unsigned char *mem;
 size_t  mem_size;

send(socket,(char*)mem,mem_size, MSG_OOB);


thread que recibe los datos y los muestra en el imageview
Código:

Thread t = new Thread() {

     @Override
     public void run() {
       try {
         while (!isInterrupted()) {
           Thread.sleep(1000);
           runOnUiThread(new Runnable() {
             @Override
             public void run() {
               // update TextView here!
             int o=0;
             try {
o = inStream.read(buffer,0,buffer.length);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
           
             ImageView img=(ImageView)findViewById(R.id.imageView1);
                  Bitmap bit =BitmapFactory.decodeByteArray(buffer, 0, buffer.length);
               
                  img.setImageBitmap(bit);
img.invalidate();
               
             }
           });
         }
       } catch (InterruptedException e) {
       }
     }
    };

    t.start();




7  Programación / Programación C/C++ / Sabriais decirme como reducir el tamaño de la imagen creada con directx? en: 17 Julio 2015, 08:23 am

Este es el code que e ido generando y el cual me gustaria editar para reducir el tamaño del archivo final.



Código:
// ConsoleApplication7.cpp: define el punto de entrada de la aplicación de consola.
//

#include "stdafx.h"

#include <stdio.h>
#include <Windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <D3dx9tex.h>

#include <iostream>
#include <fstream>
using namespace std;

#pragma comment( lib, "d3d9.lib" )
#pragma comment( lib, "d3dx9.lib" )



void main()
{
CoInitialize(NULL);

LPDIRECT3D9 d3d9;
LPDIRECT3DDEVICE9 d3ddev;
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);

int ww = GetSystemMetrics(SM_CXSCREEN);
int wh = GetSystemMetrics(SM_CYSCREEN);

HWND hwnd = GetDesktopWindow();
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpp.BackBufferCount = 3;
d3dpp.BackBufferWidth = ww;
d3dpp.BackBufferHeight = wh;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.MultiSampleQuality = 0;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.hDeviceWindow = hwnd;
d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;

d3d9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &d3ddev);

IDirect3DSurface9* render;
IDirect3DSurface9* dest;

int i = 0;
while (i++ < 100){

d3ddev->CreateOffscreenPlainSurface(ww, wh, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &dest, NULL);

d3ddev->GetFrontBufferData(0, dest);




LPD3DXBUFFER buffer;
D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_JPG, dest, NULL, NULL);
DWORD imSize = buffer->GetBufferSize();
void* imgBuffer = buffer->GetBufferPointer();

fstream out;

///////////////////////
char file[100];
snprintf(file, 100, "toni%d.jpg", i);
////////////////////
out.open(file, std::ios_base::binary | std::ios_base::out);
out.write((char*)imgBuffer, imSize);
out.clear();
out.close();

dest->Release();

}






d3ddev->Release();
d3d9->Release();

CoUninitialize();
}
8  Programación / ASM / Re: asm en c++ (Devolver variable con return) ayuda. en: 12 Enero 2015, 15:50 pm
Lo que intento es obfuscar este codigo.


Código:
DWORD prueba       = 0;

// *** The following code gets EIP register value and stores into primero
   __asm call andro
   __asm   andro:
   
   __asm   pop primero


prueba = (DWORD)(*(DWORD *)(--primero));
9  Programación / ASM / Re: asm en c++ (Devolver variable con return) ayuda. en: 12 Enero 2015, 14:44 pm
Me puedes poner el ejemplo bien comentado?.
10  Programación / ASM / asm en c++ (Devolver variable con return) ayuda. en: 12 Enero 2015, 02:52 am

Hola, de entrada decirles que no se ni pajolera idea de asm... por eso mi pregunta.

Como consigo hacer el return de la variable "primero" ?


Código:
char lanzar(){

char primero = 0;

__asm{

call des
des :
pop primero


}
return primero;
}
Páginas: [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... 32
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines