|
Mostrar Temas
|
Páginas: [1] 2 3 4 5
|
1
|
Foros Generales / Foro Libre / Convertir PC en CCTV
|
en: 8 Octubre 2016, 20:57 pm
|
Buenas! Como bien dice el título mi objetivo es convertir un PC en una CCTV pero me he dado cuenta de que la cosa no es tan sencilla como pensaba. Mi idea es hacerme con una cámara de videovigilancia con salida coaxial para conectarla con un cable BNC a una capturadora de vídeo en el PC pero no se que capturadora de vídeo necesito. Seria posible conectar la señal de vídeo con un cable VGA a BNC a una tarjeta gráfica? O necesito una tarjeta especial para tal fin? Mi objetivo final es poder instalar un linux con zoneminder en el PC para hacer funcionar las cámaras. Si alguien puede orientarme se lo agradecería muchísimo!!
Gracias y un saludo de antemano!
|
|
|
2
|
Programación / Programación C/C++ / Ayuda con GetWindowText
|
en: 20 Marzo 2013, 13:10 pm
|
Buenas, estoy intentando hacer un codigo en c++ para leer el texto de la ventana maximizada pero por algun motivo el texto no se lee apropiadamente... Aquí les dejo el codigo: #include "stdafx.h" #include <iostream> #include <Windows.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { TCHAR title[500]; ZeroMemory(title, sizeof(title)); HWND wnd = GetForegroundWindow(); while (true) { HWND current = GetForegroundWindow(); if (current!=wnd) { wnd = current; GetWindowText(wnd, title, 400); cout << "Text: " << title << endl; } Sleep(50); } return 0; }
Estoy haciendo pruebas con el Visual Studio 2012 pero al ejecutar el programa este siempre me devuelve un valor sin sentido EJ: 01AB8D9 lo cual supongo que debe ser basura... Si alguien puede explicarme que estoy haciendo mal estaria muy agradecido!!
|
|
|
3
|
Programación / Java / Duda sobre Imagenes
|
en: 16 Febrero 2013, 00:30 am
|
Buenas, últimamente he estado investigando sobre imágenes en Java y lo que es realmente una imagen para poder desarrollar una aplicación que compare 2 imágenes y obtenga en forma de cadena de enteros la información dentro de la imagen, al hacer esto me han surgido unas cuantas dudas que me gustaría que me aclararan o bien donde puedo encontrar información al respecto. Bien empiezo:
Realizo una captura del escritorio de mi PC a una resolución de 1366x768 de tal modo que llamo a la clase robot y obtengo dicha captura en forma de BufferedImage, esta imagen no es más que una matriz 2D de pixels donde cada pixel según el tipo de imagen puede tener distinta información (almenos en java), suponiendo un tipo de imagen RGB cada pixel estaría compuesto de 3 datos que equivaldrían a 1 Byte cada uno que contendrían la información sobre el color (numero entero del 0-255), bien pues si sacamos cálculos teniendo en cuenta que tenemos una imagen de 1366x768 tenemos un total de 1,049,088 pixels donde cada pixel ocupa 3 Bytes es decir dicha imagen debería ocupar en realidad un total de 3,147,264 Bytes, esto es poco mas de 3MB ?? Como es esto posible si yo al almacenar dicha imagen mediante la clase ImageIO obtengo resultados entorno a 250 KB ? Además, las imágenes de esta resolución no pesan eso...
Donde está el truco?? Estoy seguro de que esto se debe a algún tipo de compresión de imágenes o algo por el estilo pues creo que mis cálculos son correctos...
|
|
|
4
|
Programación / Java / Registro Windows desde Java (WinRegistry)
|
en: 4 Febrero 2013, 03:39 am
|
Buenas! Pues verán, buscando por internet un método adecuado para acceder al registro de Windows mediante Java encontré un código muy interesante pero que tiene la pega de ser detectado como una amenaza para por el mismísimo Windows Defender lo cual hace que la implementación de dicho codigo en cualquier aplicación no sea posible... Mi pregunta es: ¿Existe alguna manera de modificar el código para que sea posible evadir los mecanismos de detección? O dicho de otra forma, que parte del código es la que es detectada como una amenaza para Windows? import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.prefs.Preferences; public class WinRegistry { public static final int HKEY_CURRENT_USER = 0x80000001; public static final int HKEY_LOCAL_MACHINE = 0x80000002; public static final int REG_SUCCESS = 0; public static final int REG_NOTFOUND = 2; public static final int REG_ACCESSDENIED = 5; private static final int KEY_ALL_ACCESS = 0xf003f; private static final int KEY_READ = 0x20019; private static Preferences userRoot = Preferences.userRoot(); private static Preferences systemRoot = Preferences.systemRoot(); private static Class<? extends Preferences> userClass = userRoot.getClass(); private static Method regOpenKey = null; private static Method regCloseKey = null; private static Method regQueryValueEx = null; private static Method regEnumValue = null; private static Method regQueryInfoKey = null; private static Method regEnumKeyEx = null; private static Method regCreateKeyEx = null; private static Method regSetValueEx = null; private static Method regDeleteKey = null; private static Method regDeleteValue = null; static { try { regOpenKey = userClass.getDeclaredMethod("WindowsRegOpenKey", new Class[] { int.class, byte[].class, int.class }); regOpenKey.setAccessible(true); regCloseKey = userClass.getDeclaredMethod("WindowsRegCloseKey", new Class[] { int.class }); regCloseKey.setAccessible(true); regQueryValueEx = userClass.getDeclaredMethod("WindowsRegQueryValueEx", new Class[] { int.class, byte[].class }); regQueryValueEx.setAccessible(true); regEnumValue = userClass.getDeclaredMethod("WindowsRegEnumValue", new Class[] { int.class, int.class, int.class }); regEnumValue.setAccessible(true); regQueryInfoKey = userClass.getDeclaredMethod("WindowsRegQueryInfoKey1", new Class[] { int.class }); regQueryInfoKey.setAccessible(true); regEnumKeyEx = userClass.getDeclaredMethod( "WindowsRegEnumKeyEx", new Class[] { int.class, int.class, int.class }); regEnumKeyEx.setAccessible(true); regCreateKeyEx = userClass.getDeclaredMethod( "WindowsRegCreateKeyEx", new Class[] { int.class, byte[].class }); regCreateKeyEx.setAccessible(true); regSetValueEx = userClass.getDeclaredMethod( "WindowsRegSetValueEx", new Class[] { int.class, byte[].class, byte[].class }); regSetValueEx.setAccessible(true); regDeleteValue = userClass.getDeclaredMethod( "WindowsRegDeleteValue", new Class[] { int.class, byte[].class }); regDeleteValue.setAccessible(true); regDeleteKey = userClass.getDeclaredMethod( "WindowsRegDeleteKey", new Class[] { int.class, byte[].class }); regDeleteKey.setAccessible(true); } e.printStackTrace(); } } private WinRegistry() { } /** * Read a value from key and value name * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE * @param key * @param valueName * @return the value * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ { if (hkey == HKEY_LOCAL_MACHINE) { return readString(systemRoot, hkey, key, valueName); } else if (hkey == HKEY_CURRENT_USER) { return readString(userRoot, hkey, key, valueName); } else { } } /** * Read value(s) and value name(s) form given key * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE * @param key * @return the value name(s) plus the value(s) * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static Map <String, String > readStringValues (int hkey, String key ) { if (hkey == HKEY_LOCAL_MACHINE) { return readStringValues(systemRoot, hkey, key); } else if (hkey == HKEY_CURRENT_USER) { return readStringValues(userRoot, hkey, key); } else { } } /** * Read the value name(s) from a given key * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE * @param key * @return the value name(s) * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static List <String > readStringSubKeys (int hkey, String key ) { if (hkey == HKEY_LOCAL_MACHINE) { return readStringSubKeys(systemRoot, hkey, key); } else if (hkey == HKEY_CURRENT_USER) { return readStringSubKeys(userRoot, hkey, key); } else { } } /** * Create a key * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE * @param key * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static void createKey (int hkey, String key ) { int [] ret; if (hkey == HKEY_LOCAL_MACHINE) { ret = createKey(systemRoot, hkey, key); regCloseKey. invoke(systemRoot, new Object[] { new Integer(ret [0]) }); } else if (hkey == HKEY_CURRENT_USER) { ret = createKey(userRoot, hkey, key); regCloseKey. invoke(userRoot, new Object[] { new Integer(ret [0]) }); } else { } if (ret[1] != REG_SUCCESS) { } } /** * Write a value in a given key/value name * @param hkey * @param key * @param valueName * @param value * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static void writeStringValue { if (hkey == HKEY_LOCAL_MACHINE) { writeStringValue(systemRoot, hkey, key, valueName, value); } else if (hkey == HKEY_CURRENT_USER) { writeStringValue(userRoot, hkey, key, valueName, value); } else { } } /** * Delete a given key * @param hkey * @param key * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static void deleteKey (int hkey, String key ) { int rc = -1; if (hkey == HKEY_LOCAL_MACHINE) { rc = deleteKey(systemRoot, hkey, key); } else if (hkey == HKEY_CURRENT_USER) { rc = deleteKey(userRoot, hkey, key); } if (rc != REG_SUCCESS) { } } /** * delete a value from a given key/value name * @param hkey * @param key * @param value * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static void deleteValue (int hkey, String key, String value ) { int rc = -1; if (hkey == HKEY_LOCAL_MACHINE) { rc = deleteValue(systemRoot, hkey, key, value); } else if (hkey == HKEY_CURRENT_USER) { rc = deleteValue(userRoot, hkey, key, value); } if (rc != REG_SUCCESS) { } } // ===================== private static int deleteValue { int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { if (handles[1] != REG_SUCCESS) { return handles[1]; // can be REG_NOTFOUND, REG_ACCESSDENIED } int rc =((Integer) regDeleteValue. invoke(root, new Integer(handles [0]), toCstr (value ) })).intValue(); regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); return rc; } private static int deleteKey (Preferences root, int hkey, String key ) { int rc =((Integer) regDeleteKey. invoke(root, return rc; // can REG_NOTFOUND, REG_ACCESSDENIED, REG_SUCCESS } { int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { if (handles[1] != REG_SUCCESS) { return null; } byte[] valb = (byte[]) regQueryValueEx. invoke(root, new Object[] { new Integer(handles [0]), toCstr (value ) }); regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); return (valb != null ? new String(valb ). trim() : null); } private static Map<String,String> readStringValues (Preferences root, int hkey, String key ) { HashMap<String, String> results = new HashMap<String,String>(); int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { if (handles[1] != REG_SUCCESS) { return null; } int[] info = (int[]) regQueryInfoKey.invoke(root, int count = info[0]; // count int maxlen = info[3]; // value length max for(int index=0; index<count; index++) { byte[] name = (byte[]) regEnumValue. invoke(root, new Object[] { results. put(new String(name ). trim(), value ); } regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); return results; } private static List<String> readStringSubKeys (Preferences root, int hkey, String key ) { List<String> results = new ArrayList<String>(); int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { }); if (handles[1] != REG_SUCCESS) { return null; } int[] info = (int[]) regQueryInfoKey.invoke(root, int count = info[0]; // Fix: info[2] was being used here with wrong results. Suggested by davenpcj, confirmed by Petrucio int maxlen = info[3]; // value length max for(int index=0; index<count; index++) { byte[] name = (byte[]) regEnumKeyEx. invoke(root, new Object[] { }); results. add(new String(name ). trim()); } regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); return results; } private static int [] createKey (Preferences root, int hkey, String key ) { return (int[]) regCreateKeyEx.invoke(root, } private static void writeStringValue { int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { regSetValueEx.invoke(root, new Integer(handles [0]), toCstr (valueName ), toCstr (value ) }); regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); } // utility private static byte[] toCstr (String str ) { byte[] result = new byte[str.length() + 1]; for (int i = 0; i < str.length(); i++) { result[i] = (byte) str.charAt(i); } result[str.length()] = 0; return result; } }
|
|
|
5
|
Programación / Programación C/C++ / Problema Función "OpenProcess"
|
en: 2 Febrero 2013, 19:06 pm
|
Al llamar a la función OpenProcess(PROCESS_ALL_ACCESS, 0, pid) esta me devuelve NULL es decir no es capaz de abrir el proceso. Utilizando la función getLastError() esta me devuelve 5, es decir, problemas Administrativos por lo que tengo entendido (Lectura, Escritura). La cosa esta en como puedo solucionar esto para que si me sea posible obenter el proceso?? Nota: Estoy utilizando Microsoft Visual Studio C++ y Windows 8. Para que se hagan una mejor idea aqui les dejo mi codigo: #include "stdafx.h" #include <iostream> #include <Windows.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { HWND hwnd = FindWindow(0, _T("NOMBRE_VENTANA")); HANDLE hProcess; DWORD pid; if (!hwnd) { cout << "ERROR 1\n\n"; } else { GetWindowThreadProcessId(hwnd, &pid); cout << "PID = " << pid << "\n\n"; hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid); //PROBLEMA AQUI!!! if (!hProcess) { cout << "ERROR = " << GetLastError() << "\n\n"; //OBTENEMOS ERROR = 5 (PRIVILEGIOS) } else { cout << "PROCESS OPENED\n\n"; //GESTIONAR... } CloseHandle(hProcess); } cin.get(); return 0; }
A ver si alguien puede echarme una mano pues no se como salir adelante... Saludos y gracias de antemano!!
|
|
|
6
|
Programación / Java / Can't load IA 32-bit
|
en: 30 Enero 2013, 15:31 pm
|
Buenas! Veran, estaba siguiendo el tutorial del usuario Leyer para crear un Keylogger mediante JNI una vez tengo todo preparado y listo ejecuto el codigo y me manda el siguiente mensaje de Error: Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\RAT\Keylogger.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854) at java.lang.Runtime.loadLibrary0(Runtime.java:845) at java.lang.System.loadLibrary(System.java:1084) at extras.Keylogger.<clinit>(Keylogger.java:8) at extras.Main.main(Main.java:14)
La verdad no tengo ni idea de como solucionarlo y despues de haber googleado bastante sigo sin encontrar la solucion, el problema esta en intentar cargar la libreria y estoy usando la que Leyer ofrece en su ejemplo y una que yo mismo he compilado siguiendo sus instrucciones y obtengo el mismo problema...
|
|
|
7
|
Sistemas Operativos / Windows / Que es un .EXE exactamente??
|
en: 29 Diciembre 2012, 19:21 pm
|
Pues eso, he hecho alguna aplicacion en C y VB y he visto que se crean los tipicos ejecutables .EXE de windows. Por otro lado con la programacion en java he hecho alguna aplicacion y compilado en formato .JAR. Pues bien, resulta que un .JAR como muchos ya sabran no es mas que un .ZIP la pregunta es entonces, un .EXE tiene alguna relación con .ZIP o .RAR ?? He visto que es posible abrir un .EXE con WinRAR... quiere decir eso que puedo crear un .EXE indicando que incluya un archive que indique las acciones que debe realizar al ejecutar el archive y listo como si fuera un .JAR con un archivo MANIFEST.MF??
Corrijanme si me equivoco y en caso de estar en lo cierto, como se haria esto?? PD: FELIZ NAVIDAD!!
|
|
|
8
|
Programación / Java / Ayuda Java niv:Avanzado!
|
en: 10 Diciembre 2012, 12:56 pm
|
Buenas, mi problema es el siguiente. Estoy intentando hacer un programa que en base a unos datos introducidos por el usuario la aplicacion los cogera para generar un archivo de salida con codigo en java que posteriormente sera compilado para crear un jar con las especificaciones que el usuario a introducido. Estoy superconfundido y no se como hacerlo si alguien puede ayudar aunque sea dandome una idea para poder avanzar se lo agradeceria muchisiiimo!!
|
|
|
9
|
Programación / Java / [Source] Algoritmo Conjetura de Goldbach
|
en: 10 Noviembre 2012, 22:05 pm
|
Pues bien, aqui les traigo un simple codigo que permite hallar todas las combinaciones posibles de 2 numeros primos que suman un numero par mayor que 2 (Conjetura de Goldbach). public class Goldbach { public static Boolean isPrime (int n ) { //comprueba si 'n' es primo int i=2; while (n%i!=0) i++; if (i==n) return true; else return false; } public static void main (String[] args ) { for (int i=2; i<50; i++) { // Buscamos combinaciones entre 2*2=4 y 50*2=100 for (int j=0; j+1<i; j++) { // Nota: j+1 para evitar el caso j=1 (1 no es primo) int p=i+j, q=i-j; // p & q primos a la misma distancia de 2*i por lo que su suma es 2*i if ((isPrime(p)) && (isPrime(q))) System. out. println("For number: "+2*i +" = "+p +" + "+q ); } System. out. println("Number: "+2*i +" | Combos: "+nCombos ); } } }
Ejemplo de salida : For number: 4 = 2 + 2 For number: 6 = 3 + 3 For number: 8 = 5 + 3 For number: 10 = 5 + 5 For number: 10 = 7 + 3 For number: 12 = 7 + 5 For number: 14 = 7 + 7 For number: 14 = 11 + 3 For number: 16 = 11 + 5 For number: 16 = 13 + 3 For number: 18 = 11 + 7 For number: 18 = 13 + 5 For number: 20 = 13 + 7 For number: 20 = 17 + 3 A ver si con esto alguien se anima a demostrar la conjetura Un saludo!
|
|
|
10
|
Programación / Java / Ayuda con Sockets en java
|
en: 20 Agosto 2012, 04:48 am
|
Pues veran, estoy desarrolando una apliacion que se maneja con scokets para comunicarse con servidores y clientes utilizando los metodos DataOutputStream y DataInputStream. Bien, el caso es que estoy teniendo algunos problemillas pues no estoy muy familiarizado con los sockets, me gustaria saber que pasa y como debo reaccionar cuando un cliente no responde al servidor, poniendo el siguiente codigo de ejemplo: public class checkConnections extends Thread { public void run () { try { User u = null; System. out. println("Checking connections..."); for (int i=0; i<users.size(); i++) { u = getUserAtRow(i); dos.writeUTF("answer"); String answer = dis. readUTF(); if (!answer.equals("hi")) { users.remove(u); t.removeRow(i); } } } }
Para informarles, no esta de mas decir que los servidores conectados se encuentran en una tabla que gestiona el cliente, asi que va revisando que todos los servidores respondan. Tal y como he dicho antes, este codigo pide a todos los servidores conectados que respondan mediante la instruccion answer. En el caso en que dicho servidor no este conectado por diversos motivos (fallo en la conexion, etc...), la llamada al metodo : dos.readUTF(); me devuelve un nullpointerexception que no se como gestionar, alguna idea?
|
|
|
|
|
|
|