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

 

 


Tema destacado: Introducción a Git (Primera Parte)


  Mostrar Mensajes
Páginas: 1 ... 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 [38] 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 ... 72
371  Programación / .NET (C#, VB.NET, ASP) / Re: Convertir Cadena Hex a Bytes y compararlos Con Bytes de un archivo en: 13 Octubre 2018, 23:09 pm
Y como aplico ese ejemplo al mio? es que tengo una base de datos XML grande.

Código
  1. Dim xml = <?xml version="1.0"?>
  2.              <signatures>
  3.                  <signature>
  4.                      <name>Archivo1</name>
  5.                      <hex>58354f2150254041505b345c505a58353428505e2937434329377d2445494341522d5354414e4441</hex>
  6.                  </signature>
  7.                  <signature>
  8.                      <name>Archivo2</name>
  9.                      <hex>f649e7cc1e00d37e7f3bc85fff3486ac6de91433aa3a39ef1b114d37b534b8323f6ff67132638a3fe2f2afb4aaf9b7e3b4669bb3cab028298aab533c5d73546cdd396fd58c2c7734c50bca68eb709b889a086fb3db5f8ae533a4d5816e8c5f560983695efa14e291c204b1316e657773</hex>
  10.                  </signature>
  11.              </signatures>

372  Programación / .NET (C#, VB.NET, ASP) / Convertir Cadena Hex a Bytes y compararlos Con Bytes de un archivo en: 13 Octubre 2018, 19:57 pm
Bueno hola foro, Como dice el titulo, tengo un Escanear Hexadecimal para identificar archivos, Pero es lento y segun me he documentado se puede mejorar si :

1) Convierto la cadena Hex a Bytes.

2) Obtengo los Bytes del archivo .

4) Comparo la Cadena Hex convertida a Bytes con los Bytes del archivo.




Bueno ahora lo que tengo hecho hasta ahora :


Cadena Hex Almacenada en una variable XML:

Código
  1. Dim xml = <?xml version="1.0"?>
  2.              <signatures>
  3.                  <signature>
  4.                      <name>Archivo1</name>
  5.                      <hex>58354f2150254041505b345c505a58353428505e2937434329377d2445494341522d5354414e4441</hex>
  6.                  </signature>
  7.                  <signature>
  8.                      <name>Archivo2</name>
  9.                      <hex>f649e7cc1e00d37e7f3bc85fff3486ac6de91433aa3a39ef1b114d37b534b8323f6ff67132638a3fe2f2afb4aaf9b7e3b4669bb3cab028298aab533c5d73546cdd396fd58c2c7734c50bca68eb709b889a086fb3db5f8ae533a4d5816e8c5f560983695efa14e291c204b1316e657773</hex>
  10.                  </signature>
  11.              </signatures>

Aquí el código para leer el XML y Convertirlo a Bytes:

Código
  1. Private Sub hexttoBytes()
  2.        Dim Str As New StringBuilder
  3.        For Each signature As XElement In xml.Root.Elements
  4.  
  5.            stringToByteArray(signature.<hex>.Value)
  6.  
  7.        Next
  8.  
  9.    End Sub
  10.  
  11.    Public Shared Function stringToByteArray(text As String) As Byte()
  12.        Dim bytes As Byte() = New Byte(text.Length \ 2 - 1) {}
  13.  
  14.        For i As Integer = 0 To text.Length - 1 Step 2
  15.            bytes(i \ 2) = Byte.Parse(text(i).ToString() & text(i + 1).ToString(), System.Globalization.NumberStyles.HexNumber)
  16.        Next
  17.  
  18.        Return bytes
  19.    End Function


Aquí el código para Obtener los Bytes del archivo a comparar

Código
  1.  ' Opendia IS OPENFILEDIALOG
  2.        Dim result As DialogResult = OpenDia.ShowDialog()
  3.  
  4.  
  5.        If result = Windows.Forms.DialogResult.OK Then
  6.  
  7.  
  8.            Dim path As String = OpenDia.FileName
  9.            Try
  10.  
  11.                Dim bytesFile As Byte() = File.ReadAllBytes(path)
  12.  
  13.                ' BytesFile es donde se almacenan Los Bytes del archivo a comparar
  14.                ' Necesito saber Como los Comparo con los Otros Bytes que antes eran HEX
  15.  
  16.            Catch ex As Exception
  17.  
  18.                MsgBox(ex.Message)
  19.  
  20.            End Try
  21.        End If
  22.  




AHORA LAS DUDAS, SEGÚN LO QUE TENGO ECHO ,  No logro Como hacer Para Comparar los Bytes que antes eran HEX con los Bytes del archivo. Lo que quiero lograr seria algo como esto :

Código
  1. 'Donde BytesFiles es el Archivo y BytesHex eran la Cadena Hex que ahora son Bytes
  2. ' En caso de que los Bytes sean Iguales. lanza el mensaje de que encontró el archivo o no.
  3. If bytesFile = BytesHex then
  4. Msgbox("Archivo Coincide")
  5. else
  6. Msgbox("Archivo No Coincide")
  7. end if

Gracias De Antemano

373  Programación / Scripting / Re: Crear BAT que cree un txt o html con caracteres especiales??? en: 10 Octubre 2018, 17:29 pm
Ya te lo explicaron arriba pero de todos modos toma :

Código
  1. @echo off
  2.  (
  3.     echo ^<html^>
  4.     echo ^<Hola cualquier cosa aqui^>
  5.  ) >> archivo.html

374  Programación / Scripting / Re: PEQUEÑO ENCRIPTADOR EN BATCH en: 7 Octubre 2018, 22:16 pm
No Revivir post Antiguos!



No se para que te molestas en crear cosas q ya están creadas, pero bueno:

[BATCH] Encriptador & Desencriptador de Texto v1.5

BatOfuser

375  Programación / Scripting / Re: modificar texto en batch en: 7 Octubre 2018, 04:43 am
Código
  1. @echo off
  2. goto main
  3.  
  4. :error
  5. echo archivo no existe.
  6. pause
  7. goto main
  8.  
  9.  
  10. :Main
  11. cls
  12. set /p file=Indique el nombre del archivo:
  13. if not exist %file% goto error
  14. set string=telefono
  15. echo.
  16. setlocal enabledelayedexpansion
  17. set /a nchar=0
  18. call:Contar
  19. set /a nlin=0
  20. For /f "useback tokens=*" %%F in ("%file%") do (
  21.     set /a nlin+=1
  22.     set "line=%%F"
  23.     set /a xcont=0
  24.     call:Comparar
  25. )
  26. echo. & echo Terminado. & pause>nul & goto Main
  27.  
  28. :Contar
  29. If /i "!string:~%nchar%,1!" == "" goto:eof
  30. set /a nchar+=1
  31. goto Contar
  32.  
  33. :Comparar
  34. If /i "!line:~%xcont%,%nchar%!" == "%string%" (
  35.     set mtch=T
  36.     call:Msj
  37. )
  38. If /i "!line:~%xcont%,%nchar%!" == "" (
  39.     set mtch=F
  40.     call:Msj
  41.     goto:eof
  42. )
  43. set /a xcont+=1
  44. goto Comparar
  45.  
  46. :Msj
  47. If "%mtch%" == "T" (
  48.     cls
  49.     color a
  50.     echo Telefono encontrado:  [%line%] & echo.
  51.     call :Continue
  52. )
  53. If "%mtch%" == "F" echo LINEA %nlin%: %line%
  54. goto:eof
  55. exit
  56.  
  57. :Continue
  58. set /p numero=introduzca El nuevo Numero :
  59.     Call :TEXTMAN RL %nlin% "%file%" "Telefono : %numero%"
  60.     pause
  61.     exit
  62.  
  63. :TEXTMAN
  64. (SET /A "A=0", "LINE=0", "TOTAL_LINES=0")  &  (CALL :%~1 %* || (ECHO Invalid parameter & Exit /B 1)) & (GOTO:EOF)
  65. :RL
  66. (For /F "tokens=1* delims=]" %%A in ('type "%~3" ^| find /n /v ""') DO (Call Set /A "LINE+=1" && (CMD /C "IF NOT "%%LINE%%" EQU "%~2" (if "%%B" EQU "" (Echo+>> "%~3.NEW") ELSE ((Echo %%B)>> "%~3.NEW")) ELSE ((Echo %~4)>> "%~3.NEW")"))) && (CALL :RENAMER "%~3") & (GOTO:EOF)
  67. :RENAMER
  68. (REN "%~1" "%~nx1.BAK") & (MOVE /Y "%~1.BAK" "%TEMP%\" >NUL) & (REN "%~1.NEW" "%~nx1") & (GOTO:EOF)


Bueno lo q hace el Code es Buscar la primera linea que tenga la palabra Teléfono y la cambia por el nuevo q tu introduzcas



Código sacado del aporte del compañero  @Elektro : [BATCH] [APORTE] Rutina TEXTMAN para manipular archivos de texto
376  Programación / Scripting / Re: modificar texto en: 6 Octubre 2018, 22:16 pm
1) NO ESPECIFICAS QUE LENGUAJE. Y POR COMO TE EXPRESAS SUPONGO QUE NO POSES CONOCIMIENTO DE NINGUNO . AQUÍ NO AYUDAMOS ASÍ.

Intenta  crear tu propio script y en caso de que tengas algún error, con mucho gusto te ayudo.



A como te expresas, la respuesta que te daría es que :

1) agarres el txt , click derecho >> Editar .

2) Modificas el texto.

3) Y lo guardas.

Esa seria la Solución que le daría a alguien como tu.
377  Seguridad Informática / Análisis y Diseño de Malware / Re: [BATCH] [APORTE] Virus . (Te hace pensar que agarraste ramsomware) en: 5 Octubre 2018, 02:56 am
Y esto como para qué? xD no le veo utilidad la verdad...  :silbar:

Reírte un rato al joder la computadoras de otros. por ejemplo tengo control a la PC de alguien mediante un rat  y quiero joderle la pc. ejecuto ese código y listo y lo mejor es q no es detectado.
378  Programación / Scripting / Re: problema findstr en: 3 Octubre 2018, 22:23 pm
Solo tenias q dejar la Sub-rutina BS :

Código
  1. :Bs
  2. cls
  3.   set file=%~1
  4.   if not exist %file% goto leer
  5.   Echo Por Favor Espere...
  6.   findstr /i %string% "%file%"
  7.   if %errorlevel% == 0 echo Palabra %string% Encontrada en %file% >> lista.txt

De ultimo (osea al final de batch) y ya eso es todo. eso se debe por que no puse el :

Código:
GOTO :EOF

Eso era todo.

PD: no te puedo explicar mas por que ando un poco ocupado. vuelvo dentro de unas 3 horas bay.
379  Programación / .NET (C#, VB.NET, ASP) / Re: [Ayuda] Agrego el paquete NuGet "SharpDX" pero me da error. en: 3 Octubre 2018, 22:19 pm
Instale por medio de la consola en una nueva solucion . me agarro el paquete "SharpDX" , "SharpDX.Mathematics" y "SharpDX.Desktop" pero con los demás paquetes me sale lo mismo:



Alguna Idea? Gracias de antemano
380  Programación / .NET (C#, VB.NET, ASP) / Re: [Ayuda] Agrego el paquete NuGet "SharpDX" pero me da error. en: 3 Octubre 2018, 22:05 pm
Tengo VS 2012 ya q mi pc es kk

me voy a :




Y solo tengo instalado el paquete SharpDX la mas nueva versión.




Ya verifique y si lo tengo instalado, bueno voy hacer todos desde 0 con un nuevo proyecto y te aviso.
Páginas: 1 ... 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 [38] 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 ... 72
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines