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


Tema destacado: Security Series.XSS. [Cross Site Scripting]


  Mostrar Mensajes
Páginas: 1 ... 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 [604] 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 ... 1253
6031  Programación / Scripting / Re: Estaristica - Batch en: 2 Febrero 2015, 23:48 pm
Buenas

En este foro no se hace el trabajo de los demás, ayudamos a resolver dudas y aportamos orientación.

¿Has intentado desarrollar el código por ti mismo?, muestra tus avances.

De todas formas, la tarea que pides es algo muy sencillo de realizar, pero ya te hice este otro trabajo donde tampoco aportaste ningún interés por intentar hacerlo tu mismo:
http://foro.elhacker.net/scripting/juego_de_loteria_batch-t429237.0.html;msg1993365#msg1993365

Saludos
6032  Programación / Scripting / Re: Poner parametros en shell en: 2 Febrero 2015, 23:39 pm
Sabia que me dirían eso, pero el problema es que los quiero pasar como en el ejemplo -u (usuario), etc...
¿Hay alguna manera en Shell?

Pues utiliza un argumento para verifcar el nombre parámetro, y el siguiente argumento para asignar el valor del parámetro.

No majoe Bash, pero creo que se entiende lo que intento decir, te muestro un pseudo código:

Código:
args=[$1, $2]
user=""

If args(1) == "-u" Then
  If Not IsEmptyString(args(2)) Then
     user = args(2)
  End If
End If

Aunque sinceramente, serías mucho más productivo si utilizases la siguiente sintaxis:

Código:
-u:valor
o
Código:
-u=valor

Ya que de este modo evitaras checkeos innecesarios (aparte de los del ejemplo de arriba).

Pseudo-code de ejemplo:
Código:
args=[$1, $2]
user=""

If args(1).StartsWith("-u=") Then
   user = args(1).Substring("-u=".Length)
Then
6033  Programación / Scripting / Re: Juego de loteria - batch en: 2 Febrero 2015, 23:31 pm
Gracias por decirmelo ya esta arreglado

Si tu idioma natural es inglés entonces porfavor modifica tu post y adjunta el texto original abajo del todo (en inglés), que lo entenderé mucho mejor que la traducción de Google a Spanish xD.

De todas formas si no he entendido mal creo que lo que quieres hacer es esto:
Código
  1. @Echo OFF & Setlocal EnableDelayedExpansion
  2.  
  3. REM %RANDOM% Keep this line written.
  4. Set /A "randValue=%RANDOM% %%9999" & Rem From 0 to 9999.
  5. Set /A "tries=7"
  6.  
  7. Call :Play "%tries%"
  8. Pause&Exit /B 0
  9.  
  10. :Play
  11. For /L %%# In (0, 1, %~1) Do (
  12.  
  13. Echo Attempt %%# of %~1:
  14. Set /P "userValue=Which is the random value between 0 and 9999 that I'm thinking?:"
  15.  
  16. If "!UserValue!" EQU "%randValue%" (
  17. Echo Correct, the random number is !UserValue!, you're kinda magician?.
  18. Exit /B 0
  19. ) Else (
  20. Echo Fail, try again.
  21. )
  22.  
  23. If "%%#" EQU "%~1" (
  24. Echo You lost all the tries.
  25. Echo Try better luck next time.
  26. Exit /B 0
  27.  
  28. )
  29. )

Output:


Saludos
6034  Programación / Scripting / Re: [Batch] Como hacer que un archivo .bat genere un log? en: 2 Febrero 2015, 22:28 pm
EDITO:
Antes de nada debo decir que el ejemplo proporcionado por el compañero @Mini_Nauta no te funcionará en caso de error de sintaxis, ya que al intentar procesarse una isntrucción que contenga un error de sintaxis no se redireccionará ningún flujo de datos hacia el archivo, simplemente se seguirá cerrando la instancia de la CMD de forma inesperada como se cerraba anteriormente.



Estoy haciendo bastantes archivos .bat ultimamente... a veces no se si el archivo bat se ejecuta bien o mal, porque ejecuta el codigo y se cierra tan rapido que no alcanzo a ver si funciono. Por esto, me gustaria saber si hay alguna manera de que el bat genere un archivo de texto con un log.

Existe una solución más simple que generar un log, si quieres conocer el motivo por el cual la instancia de la CMD se cierra inesperadamente (aunque ya te digo que si se cierra inesperadamente solo será por un motivo, por un error de sintaxis), entonces solo debes ejecutar el archivo.bat directamente desde la CMD, y no haciendo doble click sobre el archivo.
Aparte de ejecutarlo desde la CMD, has de asegurarte de que no usas la instrucción "Exit" en el script para finalizar su ejecucuón, ya que la CMD también se cerrará, en su lugar usa un Pause temporalmente.

Dicho esto, generar un log en una herramienta tan simple como Batch es algo muy tedioso y poco viable si realmente se quiere hacer bien siguiendo una estructura,
primero de todo porque una consola no puede redirigir el mismo flujo de datos hacia 2 salidas distintas, es decir, mostrar el error en la consola y luego registrar ese error en un archivo de texto, o lo mismo con la salida de información, eso no es posible de manera natural, por otro lado, existen herramientas como Tee o WinTee que te permiten redirigr el mismo flujo de datos a dos salidas, pero estos programas solo actuan con la salida normal (Standard Output), no sirven para registrar errores:
http://sourceforge.net/projects/gnuwin32/files/coreutils/5.3.0/coreutils-5.3.0-bin.zip/download?use_mirror=sunet&download=
http://code.google.com/p/wintee/downloads/list

Aparte de eso, un error de sintaxis cerrará la CMD de forma inmediata, así que se necesita otro tipo de tratamiento para registrar ese tipo de error, y el tratamiento podría ser ejecutarlo en una nueva instancia de la CMD, ejemplo:
Código
  1. @Echo OFF
  2. (Call CMD.exe /C "For")1> ".\registro.log" 2>&1
  3. Pause&Exit /B 0

registro.log:
Código:
La sintaxis del comando no es correcta.


Resumiendo, si quieres hacerlo bien, debes omitir el registro del flujo normal y registrar solamente el flujo de error, es decir, los mensajes de error que pueda haber, ya que o muestras la información en la consola o lo haces en el log (a menos que utilices Tee para el redireccionamiento),
y lo debes hacer ejecutando en una nueva instancia de la CMD todos los comandos o aquellos comandos que creas que pueden ser problematicos, para evitar cierres inesperados por errores de sintaxis y así poder registrarlos.

Ejemplo:

Código
  1. @Echo OFF & Title Batch-Script Debug and Logging Simple Example by Elektro
  2.  
  3. Set "logFile=.\Registro.log"
  4. Echo+>"%logFile%"
  5.  
  6. (Echo [+] About to run command: "For %%%%a In (*.ext) Do (Echo %%%%a)"...)   1>>"%logFile%"
  7. (Call CMD.exe /C "For %%%%a In (*) Do (Echo %%%%a)")                         1>>"%logFile%" 2>&1
  8.  
  9. (Echo [+] About to run command: "For # In () Do ()"...)                      1>>"%logFile%"
  10. (Call CMD.exe /C "For # In () Do ()")                                        2>>"%logFile%"
  11.  
  12. Pause&Exit /B 0

registro.log:
Código:
[+] About to run command: "For %%a In (*.*) Do (Echo %%a)"...
archivo1.ext
archivo2.ext

[+] About to run command: "For # In () Do ()"...
No se esperaba # en este momento.

Como ves, resulta bastante tedioso Batch.

Para acabar quiero añadir que también puedes utilizar otros operadores de redireccionamiento para comprobar si un comando da error, pero en este caso no me ha parecido lo mas conveniente, te muestro un ejemplo breve:

Código
  1. (Dir /B "*.ext") && (
  2. Echo Success
  3. ) || (
  4. Echo Error
  5. )

Saludos
6035  Programación / .NET (C#, VB.NET, ASP) / Re: [C#] ¿Cómo podría hacer esto? en: 2 Febrero 2015, 20:36 pm
Ya sé que no es limpio es mi primera aplicación en autoit
No te preocupes, aquí nadie es mejor que nadie y todos vienen a aprender.

pero la idea que me has dado serviría para buscarlo por toda la pantalla?
Hombre, por supuesto, solo debes obtener la imagen de la zona donde quieras buscar (puede ser una captura de la pantalla completa, claro), y si la imagen es demasiado grande redimensionar la imagen a unas dimensiones que te permitan realizar la búsqueda y comparación de imagen de una forma eficiente, rápida, pero sin aumentar el margen de falsos positivos, buscando esa relación (ej: 100x100 píxeles quizás, depende).

EDITO:
No me ha quedado claro que camino vas a tomar para llevarlo a cabo, pero bueno vuelvo a aconsejarte utilizar la librería de AForge.Net, aunque he visto algoritmos de pago mucho más rápidos que obtienen los mismos o mejores resultados, pero AForge es excelente para ser gratis.

Realizar un algoritmo de ese estilo es relativamente fácil, de forma básica, pero es un tema muy delicado ya que procesar/comparar una imagen, una imagen que sea grande, es una operación muy lenta (y si usas metodologías anticuadas lo es aun mucho más), si no optimizas tu propio algoritmo hasta el punto que puede llegar a optimizarlo un grupo de desarrolladores profesionales en el tema que están vendiendo un producto de ese estilo entonces te puede quedar un algoritmo muy lento o incompetente en otros sentidos, y yo no soy ningún gurú en la optimización de este tema, pero llegué a implementar funcionalidades GPU para aumentar la velocidad de procesamiento de imagen y aun así no me convenció mucho el resultado que obtuve, sigo prefiriendo la estabilidad de AForge.

Saludos
6036  Foros Generales / Sugerencias y dudas sobre el Foro / Re: ¿Ya no es posible modificar respuestas en la sección de noticias? en: 2 Febrero 2015, 19:09 pm
Buenas

He probado a publicar y luego modificar un comentario, lo he podido hacer sin problemas con mi antiguo usuario "pitoloko", que carece de privilegios:
http://foro.elhacker.net/noticias/cazar_vulnerabilidades_para_google_tiene_premio_1500_millones_en_recompensas-t429221.0.html

Citar
error, porfavor borrar este mensaje

(modificado..)
« Última modificación: Hoy a las 19:08 por pitoloko »

¿Estás seguro que estabas logueado en ese momento, o que el post no estaba bloqueado con candado?

Saludos!
6037  Sistemas Operativos / Windows / Re: Gestión Politicas de seguridad en Win 7 en: 2 Febrero 2015, 18:25 pm
Buenas

Colocaste incorrectamente las urls de las imágenes, porfavor corríge las urls para que podamos entender cual el problema e intentar solucionar la causa del mismo.

Dependiendo de la versión y la edición de Windows que tengas, puedes acceder a una herramienta llamada gpedit.msc para administrar las políticas de grupo (la puedes encontrar junto al resto de applets y herramientas de Windows en el directorio C:\Windows\System32), aunque si careces de dicha herramienta también puedes hacerlo de forma bastante más tediosa/incómoda desde el registro de Windows.

EDITO: También puedes probar a restaurar los valores por defecto de las políticas de grupo:
How to Reset Local Group Policy to Default in Vista, Windows 7, and Windows 8
(no lo he probado)


Saludos!
6038  Sistemas Operativos / Windows / Re: Registros de Windows arruinados en: 2 Febrero 2015, 18:10 pm
Puedes utilizar un LiveCD de Windows para acceder a los archivos del SO que no deja loguearte:
http://lmgtfy.com/?q=windows+7+livecd

Hazlo si tienes la oportunidad, para mostrarnos el contenido del Batch-Script y así podré analizarlo para confirmarte si realmente ha hecho cambios perjudiciales en tu PC,
en caso de haber cambios perjudiciales en el registro, en la mayoría de los casos siempre podrás revertirlos a sus valores originales, si solo es eso puedo intentar ayudarte a solucionarlos.

PD: Y especifica tu versión de Windows.

EDITO: También podrías crear, desde la consola de recuperación de tu dvd de Windows, una nueva cuenta de usuario que te permitiría acceder a los archivos como una solución temporal, aunque no puedo asegurarte si la nueva cuenta te funcionará sin saber que cambios hiciste.

EDITO2: Te sugiero utilizar está aplicación Todo-En-Uno como última alternativa para intentar reparar distintos problemas del registro de Windows que tal vez estén relacionados con problemas respecto a tu sesión de usuario (intentalo desde una sesión de usuario secundaría si no puedes acceder a tu sesión actual en modo seguro):
http://www.tweaking.com/content/page/windows_repair_all_in_one.html

Saludos!
6039  Programación / .NET (C#, VB.NET, ASP) / Re: [Ayuda] Como hacer para validar una text box para q admita solo numeros en: 2 Febrero 2015, 08:21 am
Alguien sabe alguna manera de solucionar esto?

Hay varías maneras.

La primera manera, y también las más eficiente, sería reemplazar el uso de un TextBox para utilizar el control más adecuado a tu situación actual y así seguir buenas prácticas de programación, tienes 2 posibilidades y ambas sin mayores complicaciones:
1) Un control de tipo NumericUpDown para rangos numéricos (ej: 0 - 100).
2) Un control de tipo MaskedTextbox para máscaras numéricas (ej: nnn.nnn.nnn.nnn).

Ahora bien, supongamos que por el motivo que sea prefieres omitir el consejo de arriba y seguir utilizando un TextBox, pues bien, soluciones:

1) Utilizar una expresión regular ("^\d+$") y evaluarla o utilizar los métodos de validación del Type Char, suscribiéndote al evento KeyPress para comprobar si el caracter es un número, pero esto sería una solución horrible ya que estariamos descuidando otros factores a tener en cuenta, de todas formas mostraré un ejemplo breve por si quieres ir a lo sencillo:
Código
  1.    ''' <summary>
  2.    ''' Handles the KeyPress event of the TextBox1 control.
  3.    ''' </summary>
  4.    ''' <param name="sender">The source of the event.</param>
  5.    ''' <param name="e">The <see cref="KeyPressEventArgs"/> instance containing the event data.</param>
  6.    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) _
  7.    Handles TextBox1.KeyPress
  8.  
  9.        e.Handled = Not Char.IsNumber(e.KeyChar)
  10.  
  11.    End Sub

2) Cómo he dicho la solución anterior es horrible, ¿por qué?, por que para evitar completamente que se puede añadir "X" caracter en un TextBox corriente, debes tener varias cosas más en cuenta, como el menú contextual (Edit menu), los atajos de teclado Windows (System-wide Hotkeys), y la característica de soltar y arrastrar (Drag&Drop) en caso de que desees añadirle dicha funcionalidad.

Así pues, otra manera que aportaría mayor eficiencia, libertad, y personalización, sería definir un set de caracteres permitidos, y cancelar la escritura del caracter en el evento KeyPress cuando dicho caracter no se encuentre dentro de los caracteres permitidos:

Para ello he implementado el uso de dicha técnica desarrollando un user-control (el cual se puede mejorar en muchos sentidos, ya que no le puse demasiado empeño en la elaboración del código).

Modo de empleo:
Código
  1. Imports WindowsApplication1.ElektroTextBox
  2.  
  3. Public Class TestForm
  4.  
  5.    Private WithEvents etb As New ElektroTextBox
  6.  
  7.    Private Sub TestForm_Load() Handles MyBase.Load
  8.  
  9.        With Me.etb
  10.            .AllowDrop = True
  11.            .DisableEditMenu = True
  12.            .CurrentCharSet = CharSet.StandardAlphabetic Or
  13.                              CharSet.StandardSymbols Or
  14.                              CharSet.Numeric
  15.  
  16.        End With
  17.  
  18. #If DEBUG Then
  19.        Debug.WriteLine("ElektroTextBox has been initialized...")
  20.        Debug.WriteLine(String.Format("Current CharSet Int: {0}", CStr(etb.CurrentCharSet)))
  21.        Debug.WriteLine(String.Format("Current CharSet Str: {0}", etb.CurrentCharSet))
  22.        Debug.WriteLine(String.Format("CharSet Characters : {0}", String.Join(String.Empty, etb.CurrentCharSetChars)))
  23. #End If
  24.  
  25.        MyBase.Controls.Add(Me.etb)
  26.  
  27.    End Sub
  28.  
  29. End Class

Source:
Nota: Las características del menú contextual se pueden manejar también con los mensajes de Windows que procesa la ventana, WM_COPY, WM_CUT, y WM_PASTE, pero he preferido omitir la intercepción y el procesamiento de mensajes de Windows para no cargar más de la cuenta el user-control con operaciones innecesarias (y tambien porque como ya dije no le he puesto tanto empeño para su elaboración).

Código
  1. ' ***********************************************************************
  2. ' Author   : Elektro
  3. ' Modified : 02-February-2015
  4. ' ***********************************************************************
  5. ' <copyright file="ElektroTextBox.vb" company="Elektro Studios">
  6. '     Copyright (c) Elektro Studios. All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Imports "
  11.  
  12. Imports System.ComponentModel
  13.  
  14. #End Region
  15.  
  16. ''' <summary>
  17. ''' An extended TextBox with character validation capabilities.
  18. ''' </summary>
  19. Public NotInheritable Class ElektroTextBox : Inherits TextBox
  20.  
  21. #Region " Properties "
  22.  
  23.    ''' <summary>
  24.    ''' Gets or sets a value indicating whether
  25.    ''' the default <see cref="ContextMenuStrip"/> for this <see cref="ElektroTextBox"/> instance is disabled.
  26.    ''' </summary>
  27.    ''' <value>
  28.    ''' <c>true</c> if <see cref="ContextMenuStrip"/> is disabled for this <see cref="ElektroTextBox"/> instance;
  29.    ''' <c>false</c> otherwise.</value>
  30.    Public Property DisableEditMenu As Boolean = False
  31.  
  32.    ''' <summary>
  33.    ''' An empty <see cref="ContextMenuStrip"/> that replaces the default <see cref="ContextMenuStrip"/>
  34.    ''' when <see cref="DisableEditMenu"/> property is set to <c>true</c>.
  35.    ''' of this <see cref="ElektroTextBox"/> instance.
  36.    ''' </summary>
  37.    Private ReadOnly emptynessContextMenuStrip As ContextMenuStrip
  38.  
  39.    ''' <summary>
  40.    ''' Gets or sets the character-set that contains the allowed characters to fill this <see cref="ElektroTextBox"/> instance.
  41.    ''' </summary>
  42.    ''' <value>The character-set that contains the allowed characters to fill this <see cref="ElektroTextBox"/> instance.</value>
  43.    <Description("The characters that are allowed to fill this ElektroTextBox")>
  44.    Public Property CurrentCharSet As CharSet
  45.        Get
  46.            Return Me.currentCharSet1
  47.        End Get
  48.        Set(ByVal value As CharSet)
  49.            Me.currentCharSet1 = value
  50.            Me.currentCharSetChars1 = Me.GetCharSetChars(value)
  51.        End Set
  52.    End Property
  53.    ''' <summary>
  54.    ''' The character-set that contains the allowed characters to fill this <see cref="ElektroTextBox"/> instance.
  55.    ''' </summary>
  56.    Private currentCharSet1 As CharSet = CharSet.StandardAlphabetic Or CharSet.StandardSymbols Or CharSet.Numeric
  57.  
  58.    ''' <summary>
  59.    ''' Gets the characters of the current character-set.
  60.    ''' </summary>
  61.    ''' <value>The characters of the current character-set.</value>
  62.    Public ReadOnly Property CurrentCharSetChars As IEnumerable(Of Char)
  63.        Get
  64.            Return Me.currentCharSetChars1
  65.        End Get
  66.    End Property
  67.    ''' <summary>
  68.    ''' The characters of the current character-set.
  69.    ''' </summary>
  70.    Private currentCharSetChars1 As IEnumerable(Of Char) = Me.GetCharSetChars(Me.currentCharSet1)
  71.  
  72.    ''' <summary>
  73.    ''' Determines whether a pasting operation is requested.
  74.    ''' </summary>
  75.    Private isPasteRequested As Boolean = False
  76.  
  77.    ''' <summary>
  78.    ''' Determines whether the 'Enter' key is requested.
  79.    ''' </summary>
  80.    Private isEnterKeyRequested As Boolean = False
  81.  
  82.    ''' <summary>
  83.    ''' Determines whether the 'Backspace' key is requested.
  84.    ''' </summary>
  85.    Private isBackspacekeyRequested As Boolean = False
  86.  
  87.    ''' <summary>
  88.    ''' Determines whether an unknown key is requested.
  89.    ''' </summary>
  90.    Private isUnknownKeyRequested As Boolean = False
  91.  
  92.    ''' <summary>
  93.    ''' Contains pre-defined <see cref="ElektroTextBox"/> character sets.
  94.    ''' </summary>
  95.    Public NotInheritable Class CharSets
  96.  
  97.        ''' <summary>
  98.        ''' Gets the standard alphabetic character set.
  99.        ''' </summary>
  100.        ''' <value>The standard alphabetic character set.</value>
  101.        Public Shared ReadOnly Property CharSetStandardAlpha As IEnumerable(Of Char)
  102.            Get
  103.                Return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  104.            End Get
  105.        End Property
  106.  
  107.        ''' <summary>
  108.        ''' Gets the standard symbols character set.
  109.        ''' </summary>
  110.        ''' <value>The standard symbols character set.</value>
  111.        Public Shared ReadOnly Property CharSetStandardSymbols As IEnumerable(Of Char)
  112.            Get
  113.                Return """|@·#$~%&¬/\()[]{}<>?!,;.:'¨^-_+=*"
  114.            End Get
  115.        End Property
  116.  
  117.        ''' <summary>
  118.        ''' Gets the numerical character set.
  119.        ''' </summary>
  120.        ''' <value>The numerical character set.</value>
  121.        Public Shared ReadOnly Property CharSetNumeric As IEnumerable(Of Char)
  122.            Get
  123.                Return "1234567890"
  124.            End Get
  125.        End Property
  126.  
  127.        ''' <summary>
  128.        ''' Gets the Spanish alphabetic character set.
  129.        ''' </summary>
  130.        ''' <value>The Spanish alphabetic character set.</value>
  131.        Public Shared ReadOnly Property CharSetSpanishAlpha As IEnumerable(Of Char)
  132.            Get
  133.                Return CharSetStandardAlpha.Concat("ñáéíóúàèìòùäëïöüÑÁÉÍÓÚÀÈÌÒÙÄËÏÖÜ")
  134.            End Get
  135.        End Property
  136.  
  137.        ''' <summary>
  138.        ''' Gets the Spanish symbols character set.
  139.        ''' </summary>
  140.        ''' <value>The Spanish symbols character set.</value>
  141.        Public Shared ReadOnly Property CharSetSpanishSymbols As IEnumerable(Of Char)
  142.            Get
  143.                Return CharSetStandardSymbols.Concat("ºª¿¡`´€")
  144.            End Get
  145.        End Property
  146.  
  147.        ''' <summary>
  148.        ''' Gets the Catalonian alphabetic character set.
  149.        ''' </summary>
  150.        ''' <value>The Catalonian alphabetic character set.</value>
  151.        Public Shared ReadOnly Property CharSetCatalonianAlpha As IEnumerable(Of Char)
  152.            Get
  153.                Return CharSetStandardAlpha.Concat("çáéíóúàèìòùäëïöüÇÁÉÍÓÚÀÈÌÒÙÄËÏÖÜ")
  154.            End Get
  155.        End Property
  156.  
  157.        ''' <summary>
  158.        ''' Gets the Catalonian symbols character set.
  159.        ''' </summary>
  160.        ''' <value>The Catalonian symbols character set.</value>
  161.        Public Shared ReadOnly Property CharSetCatalonianSymbols As IEnumerable(Of Char)
  162.            Get
  163.                Return CharSetSpanishSymbols
  164.            End Get
  165.        End Property
  166.  
  167.        ''' <summary>
  168.        ''' Gets the roman numerals characters set.
  169.        ''' </summary>
  170.        ''' <value>The roman numerals characters set.</value>
  171.        Public Shared ReadOnly Property CharSetRomanNumerals As IEnumerable(Of Char)
  172.            Get
  173.                Return "IVXLCDM"
  174.            End Get
  175.        End Property
  176.  
  177.    End Class
  178.  
  179. #End Region
  180.  
  181. #Region " Enumerations "
  182.  
  183.    ''' <summary>
  184.    ''' Specifies a <see cref="ElektroTextBox"/> character set.
  185.    ''' These values can be combined.
  186.    ''' </summary>
  187.    <FlagsAttribute>
  188.    Public Enum CharSet As Integer
  189.  
  190.        ''' <summary>
  191.        ''' Any character set.
  192.        ''' This will disable any character typing on the <see cref="ElektroTextBox"/> instance.
  193.        ''' </summary>
  194.        None = 0
  195.  
  196.        ''' <summary>
  197.        ''' Standard alphabetic characters.
  198.        ''' </summary>
  199.        StandardAlphabetic = 1
  200.  
  201.        ''' <summary>
  202.        ''' Standard symbol characters.
  203.        ''' </summary>
  204.        StandardSymbols = 2
  205.  
  206.        ''' <summary>
  207.        ''' Numeric characters.
  208.        ''' </summary>
  209.        Numeric = 4
  210.  
  211.        ''' <summary>
  212.        ''' Spanish alphabetic characters.
  213.        ''' </summary>
  214.        SpanishAlphabetic = 8
  215.  
  216.        ''' <summary>
  217.        ''' Spanish symbol characters.
  218.        ''' </summary>
  219.        SpanishSymbols = 16
  220.  
  221.        ''' <summary>
  222.        ''' Catalonian alphabetic characters.
  223.        ''' </summary>
  224.        CatalonianAlphabetic = 32
  225.  
  226.        ''' <summary>
  227.        ''' Catalonian symbol characters.
  228.        ''' </summary>
  229.        CatalonianSymbols = 64
  230.  
  231.        ''' <summary>
  232.        ''' Roman numerals characters.
  233.        ''' </summary>
  234.        RomanNumerals = 128
  235.  
  236.    End Enum
  237.  
  238. #End Region
  239.  
  240. #Region " Constructors "
  241.  
  242.    ''' <summary>
  243.    ''' Initializes a new instance of the <see cref="ElektroTextBox"/> class.
  244.    ''' </summary>
  245.    Public Sub New()
  246.        Me.emptynessContextMenuStrip = New ContextMenuStrip
  247.    End Sub
  248.  
  249. #End Region
  250.  
  251. #Region " Overriden Events "
  252.  
  253.    ''' <summary>
  254.    ''' Raises the <see cref="E:Control.Enter"/> event.
  255.    ''' </summary>
  256.    ''' <param name="e">An <see cref="T:EventArgs"/> that contains the event data.</param>
  257.    Protected Overrides Sub OnEnter(ByVal e As EventArgs)
  258.  
  259.        Me.ToggleEditMenu(Me.DisableEditMenu)
  260.        MyBase.OnEnter(e)
  261.  
  262.    End Sub
  263.  
  264.    ''' <summary>
  265.    ''' Raises the <see cref="E:Control.MouseEnter"/> event.
  266.    ''' </summary>
  267.    ''' <param name="e">An <see cref="T:EventArgs" /> that contains the event data.</param>
  268.    Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  269.  
  270.        Me.ToggleEditMenu(Me.DisableEditMenu)
  271.        MyBase.OnMouseEnter(e)
  272.  
  273.    End Sub
  274.  
  275.    ''' <summary>
  276.    ''' Raises the <see cref="E:Control.KeyDown"/> event.
  277.    ''' </summary>
  278.    ''' <param name="e">A <see cref="T:KeyEventArgs"/> that contains the event data.</param>
  279.    Protected Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
  280.  
  281.        If (e.KeyCode = Keys.Enter) Then ' Enter key.
  282.            ' Let handle the 'Enter' key on 'KeyPress' event for proper evaluation.
  283.            Me.isEnterKeyRequested = True
  284.  
  285.        ElseIf (e.KeyCode = Keys.Back) Then ' Backspace key.
  286.            ' Let handle the 'Enter' key on 'KeyPress' event for proper evaluation..
  287.            Me.isBackspacekeyRequested = True
  288.  
  289.        ElseIf (e.KeyCode = Keys.C) AndAlso (e.Modifiers = Keys.Control) Then ' CTRL+C hotkey.
  290.            ' Allow to copy text.
  291.            e.Handled = False
  292.            e.SuppressKeyPress = True
  293.            MyBase.Copy()
  294.  
  295.        ElseIf (e.KeyCode = Keys.X) AndAlso (e.Modifiers = Keys.Control) Then ' CTRL+X hotkey.
  296.            ' Allow to cut text.
  297.            e.Handled = False
  298.            e.SuppressKeyPress = True
  299.            MyBase.Cut()
  300.  
  301.        ElseIf (e.KeyCode = Keys.V) AndAlso (e.Modifiers = Keys.Control) Then ' CTRL+V hotkey.
  302.            ' Let handle the text pasting on 'KeyPress' event for proper character(s) evaluation.
  303.            Me.isPasteRequested = True
  304.  
  305.        Else ' Unhandled character.
  306.            ' Let handle the unknown char on 'KeyPress' event for proper character evaluation.
  307.            Me.isUnknownKeyRequested = True
  308.  
  309.        End If
  310.  
  311. #If DEBUG Then ' Helper.
  312.        Debug.WriteLine(String.Format("Modifiers:{0} KeyCode:{1} KeyData:{2} KeyValue:{3} ",
  313.                                      e.Modifiers.ToString,
  314.                                      e.KeyCode.ToString,
  315.                                      e.KeyData.ToString,
  316.                                      e.KeyValue.ToString))
  317. #End If
  318.  
  319.        MyBase.OnKeyDown(e)
  320.  
  321.    End Sub
  322.  
  323.    ''' <summary>
  324.    ''' Raises the <see cref="E:Control.KeyPress"/> event.
  325.    ''' </summary>
  326.    ''' <param name="e">A <see cref="T:KeyPressEventArgs"/> that contains the event data.</param>
  327.    Protected Overrides Sub OnKeyPress(ByVal e As KeyPressEventArgs)
  328.  
  329.        If isPasteRequested Then
  330.            ' Allow to paste text only if all characters are allowed characters.
  331.            e.Handled = Not Me.StringHasNonAllowedChars(Clipboard.GetText, Me.currentCharSetChars1)
  332.            Me.isPasteRequested = False
  333.  
  334.        ElseIf isBackspacekeyRequested Then
  335.            ' Allow character deletion.
  336.            e.Handled = False
  337.            Me.isBackspacekeyRequested = False
  338.  
  339.        ElseIf isEnterKeyRequested Then
  340.            ' Allow the effects of Enter key.
  341.            e.Handled = False
  342.            Me.isEnterKeyRequested = False
  343.  
  344.        ElseIf isUnknownKeyRequested Then
  345.            ' Allow unknown character only if it's an allowed character.
  346.            e.Handled = Not Me.StringHasNonAllowedChars({Convert.ToChar(e.KeyChar)}, Me.currentCharSetChars1)
  347.            Me.isUnknownKeyRequested = False
  348.  
  349.        End If
  350.  
  351.        MyBase.OnKeyPress(e)
  352.  
  353.    End Sub
  354.  
  355.    ''' <summary>
  356.    ''' Raises the <see cref="E:Control.DragEnter"/> event.
  357.    ''' </summary>
  358.    ''' <param name="drgevent">A <see cref="T:DragEventArgs"/> that contains the event data.</param>
  359.    Protected Overrides Sub OnDragEnter(ByVal drgevent As DragEventArgs)
  360.  
  361.        If MyBase.AllowDrop Then
  362.  
  363.            Select Case True
  364.  
  365.                Case drgevent.Data.GetDataPresent(DataFormats.Text) ' ANSI text.
  366.                    drgevent.Effect = DragDropEffects.Copy ' Drop text from dragged source.
  367.  
  368.                Case Else
  369.                    ' Do Nothing.
  370.  
  371.            End Select
  372.  
  373.        End If
  374.  
  375.        MyBase.OnDragEnter(drgevent)
  376.  
  377.    End Sub
  378.  
  379.    ''' <summary>
  380.    ''' Raises the <see cref="E:Control.DragDrop"/> event.
  381.    ''' </summary>
  382.    ''' <param name="drgevent">A <see cref="T:DragEventArgs"/> that contains the event data.</param>
  383.    Protected Overrides Sub OnDragDrop(ByVal drgevent As DragEventArgs)
  384.  
  385.        If MyBase.AllowDrop Then
  386.  
  387.            Select Case True
  388.  
  389.                Case drgevent.Data.GetDataPresent(DataFormats.Text) ' ANSI text.
  390.                    Dim dropString As String = DirectCast(drgevent.Data.GetData(DataFormats.Text), String)
  391.  
  392.                    ' Allow text drop only if all characters are numeric.
  393.                    If Me.StringHasNonAllowedChars(dropString, Me.currentCharSetChars1) Then
  394.                        MyBase.Text = dropString
  395.                    End If
  396.  
  397.                Case Else
  398.                    ' Do Nothing.
  399.  
  400.            End Select
  401.  
  402.        End If
  403.  
  404.        MyBase.OnDragDrop(drgevent)
  405.  
  406.    End Sub
  407.  
  408. #End Region
  409.  
  410. #Region " Private Methods "
  411.  
  412.    ''' <summary>
  413.    ''' Toggles the edit menu visibility.
  414.    ''' </summary>
  415.    ''' <param name="enable">
  416.    ''' If set to <c>true</c>, restores the default <see cref="ContextMenuStrip"/> for this <see cref="ElektroTextBox"/> instance.
  417.    ''' </param>
  418.    Private Sub ToggleEditMenu(ByVal enable As Boolean)
  419.  
  420.        If (enable) AndAlso (MyBase.ContextMenuStrip Is Nothing) Then
  421.            ' Disable default Copy/Cut/Paste contextmenu.
  422.            MyBase.ContextMenuStrip = Me.emptynessContextMenuStrip
  423.  
  424.        ElseIf Not (enable) AndAlso (MyBase.ContextMenuStrip IsNot Nothing) Then
  425.            ' Restore default edit contextmenu.
  426.            MyBase.ContextMenuStrip = Nothing
  427.  
  428.        Else
  429.            ' Do Nothing.
  430.  
  431.        End If
  432.  
  433.    End Sub
  434.  
  435.    ''' <summary>
  436.    ''' Gets the characters of a <see cref="CharSet"/>.
  437.    ''' </summary>
  438.    ''' <param name="charSet">The <see cref="CharSet"/>.</param>
  439.    ''' <returns>The characters of a <see cref="CharSet"/>.</returns>
  440.    Private Function GetCharSetChars(ByVal charSet As CharSet) As IEnumerable(Of Char)
  441.  
  442.        Dim chars As IEnumerable(Of Char) = String.Empty
  443.  
  444.        If charSet.HasFlag(charSet.None) Then
  445.            ' Do Nothing.
  446.        End If
  447.  
  448.        If charSet.HasFlag(charSet.StandardAlphabetic) Then
  449.            chars = chars.Concat(CharSets.CharSetStandardAlpha)
  450.        End If
  451.  
  452.        If charSet.HasFlag(charSet.StandardSymbols) Then
  453.            chars = chars.Concat(CharSets.CharSetStandardSymbols)
  454.        End If
  455.  
  456.        If charSet.HasFlag(charSet.Numeric) Then
  457.            chars = chars.Concat(CharSets.CharSetNumeric)
  458.        End If
  459.  
  460.        If charSet.HasFlag(charSet.SpanishAlphabetic) Then
  461.            chars = chars.Concat(CharSets.CharSetSpanishAlpha)
  462.        End If
  463.  
  464.        If charSet.HasFlag(charSet.SpanishSymbols) Then
  465.            chars = chars.Concat(CharSets.CharSetSpanishSymbols)
  466.        End If
  467.  
  468.        If charSet.HasFlag(charSet.CatalonianAlphabetic) Then
  469.            chars = chars.Concat(CharSets.CharSetCatalonianAlpha)
  470.        End If
  471.  
  472.        If charSet.HasFlag(charSet.CatalonianSymbols) Then
  473.            chars = chars.Concat(CharSets.CharSetCatalonianSymbols)
  474.        End If
  475.  
  476.        If charSet.HasFlag(charSet.RomanNumerals) Then
  477.            chars = chars.Concat(CharSets.CharSetRomanNumerals)
  478.        End If
  479.  
  480.        Return (From c As Char In chars Order By c.ToString Ascending Distinct)
  481.  
  482.    End Function
  483.  
  484.    ''' <summary>
  485.    ''' Determines whether the specified string has non allowed characters for this <see cref="ElektroTextBox"/> instance.
  486.    ''' </summary>
  487.    ''' <param name="characters">The characters that will be evaluated.</param>
  488.    ''' <param name="allowedChars">The allowed characters.</param>
  489.    ''' <returns><c>true</c> if all the characters of the specified string satisfy the condition;
  490.    ''' <c>false</c> otherwise.</returns>
  491.    Private Function StringHasNonAllowedChars(ByVal characters As IEnumerable(Of Char),
  492.                                              ByVal allowedChars As IEnumerable(Of Char)) As Boolean
  493.  
  494.        Return characters.All(Function(c As Char)
  495.                                  Return allowedChars.Contains(c, Nothing)
  496.                              End Function)
  497.  
  498.    End Function
  499.  
  500. #End Region
  501.  
  502. End Class

Saludos.
6040  Foros Generales / Sugerencias y dudas sobre el Foro / Re: Que pasa últimamente? Soy solo yo? en: 2 Febrero 2015, 04:58 am
mmmm son latinos   :¬¬  buen dato Elecktro es que soy curiosos.
jaja, Flamer tu me entiendes, a lo que me refiero es por ejemplo como si los Españoles prefiriesen hacer corridas de Toros allá que acá... sería algo raro, porque no es su ambiente, pues los latinos prefieren boicotear una web española.

Hay muchas más páginas de temática hacking que elhacker.net, pero siempre parece estar en el punto de mira fija de gente extranjera proviniente de esas zonas latinas (muchisimo más que de todos los Españoles que conozcan esta web, según mis conclusiones),
aunque eso nos demuestra también algo positivo, y es lo difundida que está esta página en todos los continentes :) (o casi xD).


Y nose si me entiendas elecktro pero de que sirve dejar un foro offline 1 o 2 horas de nada
Ya... cuesta aceptarlo pero simplemente hay gente que se divierte así (como quien encuentra diversión en maltratar animales), o que ridiculamente se sienten superior al penetrar en un server, o quizás quieren demostrar que son alguien explotando vulnerabilidades ajenas (que error tan irracional), o tal vez solo hacen appuestas con sus amigos a ver quien consigue tumbar una web (típica mentalidad infantil para ver quien tiene el rabo más grande),
por desgracia esa gente sigue existiendo y atacando este maravilloso foro.
En fin, sé que no he dicho nada que nadie sepa ya, porque todos sabemos que hay gente de todo tipo a nivel de estupidez humana.


Saludos!
Páginas: 1 ... 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 [604] 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 ... 1253
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines