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

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


  Mostrar Mensajes
Páginas: 1 ... 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 [980] 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 ... 1236
9791  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets (ACTUALIZADO 12/01/2013) Posteen aquí sus snippets!! en: 12 Enero 2013, 23:30 pm
Set_PC_State

Código
  1.    ' // By Elektro H@cker
  2.  
  3.    ' USAGE:
  4.    '
  5.    ' Set_PC_State(RESET)
  6.    ' Set_PC_State(SUSPEND, 30, "I'm suspending your system.")
  7.    ' Set_PC_State(LOG_OFF)
  8.    ' Set_PC_State(HIBERN)
  9.    ' Set_PC_State(ABORT)
  10.  
  11. #Region " Set PC State "
  12.  
  13.    Const RESET As String = " -R "
  14.    Const SUSPEND As String = " -S "
  15.    Const LOG_OFF As String = " -L "
  16.    Const HIBERN As String = " -H "
  17.    Const ABORT As String = " -A "
  18.  
  19.    Private Function Set_PC_State(ByVal PowerState_Action As String, Optional ByVal TimeOut As Integer = 1, Optional ByVal COMMENT As String = "")
  20.  
  21.        Dim Shutdown_Command As New ProcessStartInfo
  22.        Shutdown_Command.FileName = "Shutdown.exe"
  23.  
  24.        Try
  25.            If PowerState_Action = ABORT Or PowerState_Action = HIBERN Or PowerState_Action = LOG_OFF Then
  26.                Shutdown_Command.Arguments = PowerState_Action ' Windows don't allow TimeOut or Comment options for HIBERN, LOG_OFF or ABORT actions.
  27.            ElseIf PowerState_Action = RESET Or PowerState_Action = SUSPEND Then
  28.                If Not COMMENT = "" Then
  29.                    If COMMENT.Length > 512 Then COMMENT = COMMENT.Substring(0, 512) ' Only 512 chars are allowed for comment
  30.                    Shutdown_Command.Arguments = PowerState_Action & " -T " & TimeOut & " /C " & COMMENT
  31.                Else
  32.                    Shutdown_Command.Arguments = PowerState_Action & " -T " & TimeOut
  33.                End If
  34.                Shutdown_Command.WindowStyle = ProcessWindowStyle.Hidden
  35.                Process.Start(Shutdown_Command)
  36.                Return True
  37.            End If
  38.        Catch ex As Exception
  39.            Return ex.Message
  40.        End Try
  41.  
  42.        Return Nothing ' Invalid argument
  43.    End Function
  44.  
  45. #End Region





Día local:

Código
  1. Dim Today as string = My.Computer.Clock.LocalTime.DayOfWeek ' In English language
  2.  
  3. Dim Today as string = System.Globalization.DateTimeFormatInfo.CurrentInfo.GetDayName(Date.Today.DayOfWeek) ' In system language




String is URL?

Código
  1.    ' USAGE:
  2.    '
  3.    ' If String_Is_URL("http://google.com") Then MsgBox("Valid url!") Else MsgBox("Invalid url!")
  4.  
  5. #Region " String Is URL Function "
  6.  
  7.    Private Function String_Is_URL(ByVal STR As String)
  8.        Dim URL_Pattern As String = "^(http|https):/{2}[a-zA-Z./&\d_-]+"
  9.        Dim URL_RegEx As New System.Text.RegularExpressions.Regex(URL_Pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.ExplicitCapture)
  10.        If URL_RegEx.IsMatch(STR) Then Return True Else Return False
  11.    End Function
  12.  
  13. #End Region




G-Mail Sender (Envía emails)

Código
  1.    ' USAGE:
  2.    '
  3.    ' GMail_Sender("Your_Email@Gmail.com", "Your_Password", "Email Subject", "Message Body", "Destiny@Email.com")
  4.  
  5. #Region " GMail Sender function "
  6.  
  7.    Private Function GMail_Sender(ByVal Gmail_Username As String, ByVal Gmail_Password As String, ByVal Email_Subject As String, ByVal Email_Body As String, ByVal Email_Destiny As String)
  8.        Try
  9.            Dim MailSetup As New System.Net.Mail.MailMessage
  10.            MailSetup.Subject = Email_Subject
  11.            MailSetup.To.Add(Email_Destiny)
  12.            MailSetup.From = New System.Net.Mail.MailAddress(Gmail_Username)
  13.            MailSetup.Body = Email_Body
  14.            Dim SMTP As New System.Net.Mail.SmtpClient("smtp.gmail.com")
  15.            SMTP.Port = 587
  16.            SMTP.EnableSsl = True
  17.            SMTP.Credentials = New Net.NetworkCredential(Gmail_Username, Gmail_Password)
  18.            SMTP.Send(MailSetup)
  19.            Return True ' Email is sended OK
  20.        Catch ex As Exception
  21.            Return ex.Message ' Email can't be sended
  22.        End Try
  23.    End Function
  24.  
  25. #End Region

9792  Programación / .NET (C#, VB.NET, ASP) / Re: My.Computer.Clock.LocalTime.DayOfWeek en: 12 Enero 2013, 22:28 pm
Gracias ^^, sabía que habría que utilizar lo del cultureinfo pero no sabía como xD.
9793  Programación / .NET (C#, VB.NET, ASP) / Re: Como simular el método "performclick" de un botón? en: 12 Enero 2013, 21:44 pm
nah ya está, el autor me ha dicho que el método ".click" en este control es ".clickbuttonarea"

xD

Saludos
9794  Programación / .NET (C#, VB.NET, ASP) / [SOLUCIONADO] My.Computer.Clock.LocalTime.DayOfWeek en: 12 Enero 2013, 20:45 pm
¿Se puede obtener este dato en el idioma instalado del equipo?

Código:
My.Computer.Clock.LocalTime.DayOfWeek
9795  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets (ACTUALIZADO 12/01/2013) Posteen aquí sus snippets!! en: 12 Enero 2013, 20:36 pm
Otro convertidor, en esta ocasión un convertidor de tiempo, ms, segundos, minutos, horas.


Código
  1. #Region " Convert Time Function"
  2.  
  3.    ' // By Elektro H@cker
  4.    '
  5.    ' MsgBox(Convert_Time(1, "h", "m"))
  6.    ' MsgBox(Convert_Time(1, "h", "s"))
  7.    ' MsgBox(Convert_Time(1, "h", "ms"))
  8.    ' MsgBox(Convert_Time(6000, "milliseconds", "seconds"))
  9.    ' MsgBox(Convert_Time(6000, "seconds", "minutes"))
  10.    ' MsgBox(Convert_Time(6000, "minutes", "hours"))
  11.  
  12.    Private Function Convert_Time(ByVal Time As Int64, ByVal Input_Time_Format As String, ByVal Output_Time_Format As String)
  13.        Dim Time_Span As New TimeSpan
  14.        If Input_Time_Format.ToUpper = "MS" Or Output_Time_Format.ToUpper = "MILLISECONDS" Then Time_Span = New TimeSpan(TimeSpan.TicksPerMillisecond * Time)
  15.        If Input_Time_Format.ToUpper = "S" Or Output_Time_Format.ToUpper = "SECONDS" Then Time_Span = New TimeSpan(TimeSpan.TicksPerSecond * Time)
  16.        If Input_Time_Format.ToUpper = "M" Or Output_Time_Format.ToUpper = "MINUTES" Then Time_Span = New TimeSpan(TimeSpan.TicksPerMinute * Time)
  17.        If Input_Time_Format.ToUpper = "H" Or Output_Time_Format.ToUpper = "HOURS" Then Time_Span = New TimeSpan(TimeSpan.TicksPerHour * Time)
  18.        If Output_Time_Format.ToUpper = "MS" Or Output_Time_Format.ToUpper = "MILLISECONDS" Then Return Time_Span.TotalMilliseconds
  19.        If Output_Time_Format.ToUpper = "S" Or Output_Time_Format.ToUpper = "SECONDS" Then Return Time_Span.TotalSeconds
  20.        If Output_Time_Format.ToUpper = "M" Or Output_Time_Format.ToUpper = "MINUTES" Then Return Time_Span.TotalMinutes
  21.        If Output_Time_Format.ToUpper = "H" Or Output_Time_Format.ToUpper = "HOURS" Then Return Time_Span.TotalHours
  22.        Return False ' Returns false if argument is in incorrect format
  23.    End Function
  24.  
  25. #End Region
  26.  
9796  Programación / .NET (C#, VB.NET, ASP) / Re: Como aplicar cambios al registro y refrescar el sistema sin tener que reiniciar? en: 12 Enero 2013, 18:44 pm
Sigo sin saber nada xD.

9797  Programación / .NET (C#, VB.NET, ASP) / Re: El proyecto no me reconoce las imagenes que incluyo en: 12 Enero 2013, 18:43 pm
La solución era agregarlos desde el menú de propiedades de la aplicación, y en la sección adecuada imagenes en la sección "Images", archivos de texto en la sección "Texts", etc...

Sigo sin saber porque si arrastro los recursos directamente nos e reconocen, pero bueno, pa que hacer las cosas mal...

Saludos.
9798  Programación / .NET (C#, VB.NET, ASP) / [solucionado] Como simular el método "performclick" de un botón? en: 12 Enero 2013, 18:17 pm
Hola,

Estoy usando un botón extendido que no dispone del método "performclick"

Esto no puedo hacerlo:
Código
  1. If "a" = "a" then Button1.performclick()
Puedo escribir el método y no me salta excepción, pero no sucede nada, y he leido el mismo tipo de problema en la página del autor, en CodeProject.

La pregunta es... ¿Puedo simularlo de alguna manera? (Que no séa clickando el botón por coordenadas...  :xD)

Dispongo del source del botón, por si saben como implementar el método...

Gracias por leer.
9799  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets (ACTUALIZADO 12/01/2013) Posteen aquí sus snippets!! en: 12 Enero 2013, 18:00 pm
He actualizado el pack de Snippets en el post principal (Antes eran 76, ahora 114)

Si alguien quiere que incluya un pack con sus snippets en el post principal porfavor que me pase los snippets en formato de snippet (Archivo.snippet).

Y añado este snippet, un delimitador de strings, es parecido al método "Split", pero bajo mi opinión lo he mejorado bastante!

· Acepta 1 o 2 delimitadores,
· Opción de IgnoreCase
· Delimitar de izquierda a derecha o de derecha a izquierda.

Saludos!

Código
  1. #Region " Delimit_String Function "
  2.  
  3.    ' // By Elektro H@ker
  4.    '
  5.    ' USAGE:
  6.    '
  7.    ' MsgBox(Delimit_String("Welcome to my new house", "to")) ' my new house
  8.    ' MsgBox(Delimit_String("Welcome to my new house", "to", "house")) ' my new
  9.    ' MsgBox(Delimit_String("Welcome to my new house", "TO", "HoUSe", True)) ' my new
  10.    ' MsgBox(Delimit_String("Welcome to my new house", "house", "to", , "Left")) ' my new
  11.    ' MsgBox(Delimit_String("Welcome to my new house", "TO", "HoUSe", False)) ' False
  12.    ' MsgBox(Delimit_String("Welcome to my new house", "to", "to", , "Left")) ' Index was outside bounds of the array
  13.  
  14.    Private Function Delimit_String(ByVal STR As String, ByVal Delimiter_A As String, Optional ByVal Delimiter_B As String = "", Optional ByVal Ignore_Case As Boolean = False, Optional ByVal Left_Or_Right As String = "Right")
  15.        Dim Compare_Method As Integer = 0 ' Don't ignore case
  16.        If Ignore_Case = True Then Compare_Method = 1 ' Ignore Case
  17.  
  18.        If Not Left_Or_Right.ToUpper = "LEFT" And Not Left_Or_Right.ToUpper = "RIGHT" _
  19.            Then Return False ' Returns false if the Left_Or_Right argument is in incorrect format
  20.  
  21.        If Compare_Method = 0 Then
  22.            If Not STR.Contains(Delimiter_A) Or Not STR.Contains(Delimiter_B) _
  23.                Then Return False ' Returns false if one of the delimiters in NormalCase can 't be found
  24.        Else
  25.            If Not STR.ToUpper.Contains(Delimiter_A.ToUpper) Or Not STR.ToUpper.Contains(Delimiter_B.ToUpper) _
  26.            Then Return False ' Returns false if one of the delimiters in IgnoreCase can 't be found
  27.        End If
  28.  
  29.        Try
  30.            If Left_Or_Right.ToUpper = "LEFT" Then STR = Split(STR, Delimiter_A, , Compare_Method)(0) _
  31.                Else If Left_Or_Right.ToUpper = "RIGHT" Then STR = Split(STR, Delimiter_A, , Compare_Method)(1)
  32.  
  33.            If Delimiter_B IsNot Nothing Then
  34.                If Left_Or_Right.ToUpper = "LEFT" Then STR = Split(STR, Delimiter_B, , Compare_Method)(1) _
  35.                 Else If Left_Or_Right.ToUpper = "RIGHT" Then STR = Split(STR, Delimiter_B, , Compare_Method)(0)
  36.            End If
  37.  
  38.            Return STR ' Returns the splitted string
  39.        Catch ex As Exception
  40.            Return ex.Message ' Returns exception if index is out of range
  41.        End Try
  42.    End Function
  43.  
  44. #End Region

9800  Seguridad Informática / Hacking Wireless / Re: el handshake puede ser clave en wifislay ? en: 12 Enero 2013, 16:52 pm
Hay muchas utilidades para generar diccionarios,

Una forma lenta (Pero muy buena y diversa) es esta: [Batch] Ice Gen 1.0 (Generador de Wordlist,Combolist,WEP,WPA,Serial,Cookies,IP)

Saludos
Páginas: 1 ... 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 [980] 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines