Me uno a la petición
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCita de: Rinnegann en 11 Agosto 2013, 01:18 AMmi pregunta es como con .bat puedo extraer un archivo .rar gracias.
#Region " Hosts Helper "
Public Class Hosts_Helper
' [ Hosts Helper ]
'
' // By Elektro H@cker
'
' Examples:
'
' MsgBox(Hosts_Helper.HOSTS_Exists)
' Hosts_Helper.Add("www.youtube.com", "231.7.66.33")
' Hosts_Helper.Block("www.youtube.com")
' MsgBox(Hosts_Helper.IsAdded("www.youtube.com"))
' MsgBox(Hosts_Helper.IsBlocked("www.youtube.com"))
' Hosts_Helper.Remove("www.youtube.com")
' Hosts_Helper.Clean_Hosts_File()
Shared ReadOnly HOSTS As String = _
IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "Drivers\etc\hosts")
''' <summary>
''' Adds a new Block mapping into the Hosts file.
''' </summary>
Public Shared Sub Block(ByVal URL As String)
Dim Entry As String = String.Format("::1 {0}", URL)
If HOSTS_Exists() AndAlso IsBlocked(URL) Then
Throw New Exception(String.Format("""{0}"" is already blocked.", URL))
Exit Sub
ElseIf HOSTS_Exists() AndAlso IsAdded(URL) Then
Remove(URL)
End If
Try
IO.File.AppendAllText(HOSTS, (Environment.NewLine & Entry), System.Text.Encoding.Default)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Sub
''' <summary>
''' Adds a new mapping into Hosts file.
''' </summary>
Public Shared Sub Add(ByVal URL As String, ByVal IP_Address As String)
Dim Entry As String = String.Format("{0} {1}", IP_Address, URL)
If HOSTS_Exists() AndAlso (IsAdded(URL) OrElse IsBlocked(URL)) Then
Throw New Exception(String.Format("""{0}"" is already mapped.", URL))
Exit Sub
ElseIf Not Validate_IP(IP_Address) Then
Throw New Exception(String.Format("""{0}"" is not a valid IP adress.", IP_Address))
Exit Sub
End If
Try
IO.File.AppendAllText(HOSTS, (Environment.NewLine & Entry), System.Text.Encoding.Default)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Sub
''' <summary>
''' Removes a blocked or an added URL from the Hosts file.
''' </summary>
Public Shared Sub Remove(ByVal URL As String)
If Not HOSTS_Exists() Then
Throw New Exception("HOSTS File does not exists.")
Exit Sub
ElseIf HOSTS_Exists() And Not (IsAdded(URL) OrElse IsBlocked(URL)) Then
Throw New Exception(String.Format("""{0}"" is not added yet.", URL))
Exit Sub
End If
Try
Dim Content As String = _
System.Text.RegularExpressions.Regex.Replace(IO.File.ReadAllText(HOSTS).ToLower, _
String.Format("(\d{{1,3}}\.\d{{1,3}}\.\d{{1,3}}\.\d{{1,3}}|::1)(\s+|\t+){0}", URL.ToLower), String.Empty)
IO.File.WriteAllText(HOSTS, Content, System.Text.Encoding.Default)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Sub
''' <summary>
''' Checks if an URL is already added into the Hosts file.
''' </summary>
Public Shared Function IsAdded(ByVal URL As String) As Boolean
Return If(Not HOSTS_Exists(), False, _
System.Text.RegularExpressions.Regex.IsMatch( _
System.Text.RegularExpressions.Regex.Replace(IO.File.ReadAllText(HOSTS).ToLower, "\s+|\t+", ";"), _
String.Format(";[^\#]?\d{{1,3}}\.\d{{1,3}}\.\d{{1,3}}\.\d{{1,3}};{0}", URL.ToLower)))
End Function
''' <summary>
''' Checks if an URL is already blocked into the Hosts file.
''' </summary>
Public Shared Function IsBlocked(ByVal URL As String) As Boolean
Return If(Not HOSTS_Exists(), False, _
System.Text.RegularExpressions.Regex.IsMatch( _
System.Text.RegularExpressions.Regex.Replace(IO.File.ReadAllText(HOSTS).ToLower, "\s+|\t+", String.Empty), _
String.Format("[^\#](127.0.0.1|::1){0}", URL.ToLower)))
End Function
''' <summary>
''' Checks if the Hosts file exists.
''' </summary>
Public Shared Function HOSTS_Exists() As Boolean
Return IO.File.Exists(HOSTS)
End Function
''' <summary>
''' Cleans all the mappings inside the Hosts file.
''' </summary>
Public Shared Sub Clean_Hosts_File()
Try
IO.File.WriteAllText(HOSTS, String.Empty)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' Validates an IP adress.
Private Shared Function Validate_IP(ByVal IP_Address As String) As Boolean
Dim IP As System.Net.IPAddress = Nothing
Return System.Net.IPAddress.TryParse(IP_Address, IP)
End Function
End Class
#End Region
Cita de: Adrylek en 10 Agosto 2013, 18:44 PMQuiero que los cambios sean permanentes en la PC
Cita de: EleKtro H@cker en 10 Agosto 2013, 10:18 AMes tán sencillo como añadir una entrada el archivo HOSTS. http://msdn.microsoft.com/en-us/library/ff749174.aspx
#Region " Hosts Helper "
Public Class Hosts_Helper
' [ Hosts Helper ]
'
' // By Elektro H@cker
'
' Examples:
'
' MsgBox(Hosts_Helper.HOSTS_Exists)
' Hosts_Helper.Add("www.youtube.com", "231.7.66.33")
' Hosts_Helper.Block("www.youtube.com")
' MsgBox(Hosts_Helper.IsAdded("www.youtube.com"))
' MsgBox(Hosts_Helper.IsBlocked("www.youtube.com"))
' Hosts_Helper.Remove("www.youtube.com")
' Hosts_Helper.Clean_Hosts_File()
Shared ReadOnly HOSTS As String = _
IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "Drivers\etc\hosts")
''' <summary>
''' Adds a new Block mapping into the Hosts file.
''' </summary>
Public Shared Sub Block(ByVal URL As String)
Dim Entry As String = String.Format("::1 {0}", URL)
If HOSTS_Exists() AndAlso IsBlocked(URL) Then
Throw New Exception(String.Format("""{0}"" is already blocked.", URL))
Exit Sub
ElseIf HOSTS_Exists() AndAlso IsAdded(URL) Then
Remove(URL)
End If
Try
IO.File.AppendAllText(HOSTS, (Environment.NewLine & Entry), System.Text.Encoding.Default)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Sub
''' <summary>
''' Adds a new mapping into Hosts file.
''' </summary>
Public Shared Sub Add(ByVal URL As String, ByVal IP_Address As String)
Dim Entry As String = String.Format("{0} {1}", IP_Address, URL)
If HOSTS_Exists() AndAlso (IsAdded(URL) OrElse IsBlocked(URL)) Then
Throw New Exception(String.Format("""{0}"" is already mapped.", URL))
Exit Sub
ElseIf Not Validate_IP(IP_Address) Then
Throw New Exception(String.Format("""{0}"" is not a valid IP adress.", IP_Address))
Exit Sub
End If
Try
IO.File.AppendAllText(HOSTS, (Environment.NewLine & Entry), System.Text.Encoding.Default)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Sub
''' <summary>
''' Removes a blocked or an added URL from the Hosts file.
''' </summary>
Public Shared Sub Remove(ByVal URL As String)
If Not HOSTS_Exists() Then
Throw New Exception("HOSTS File does not exists.")
Exit Sub
ElseIf HOSTS_Exists() And Not (IsAdded(URL) OrElse IsBlocked(URL)) Then
Throw New Exception(String.Format("""{0}"" is not added yet.", URL))
Exit Sub
End If
Try
Dim Content As String = _
System.Text.RegularExpressions.Regex.Replace(IO.File.ReadAllText(HOSTS).ToLower, _
String.Format("(\d{{1,3}}\.\d{{1,3}}\.\d{{1,3}}\.\d{{1,3}}|::1)(\s+|\t+){0}", URL.ToLower), String.Empty)
IO.File.WriteAllText(HOSTS, Content, System.Text.Encoding.Default)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Sub
''' <summary>
''' Checks if an URL is already added into the Hosts file.
''' </summary>
Public Shared Function IsAdded(ByVal URL As String) As Boolean
Return If(Not HOSTS_Exists(), False, _
System.Text.RegularExpressions.Regex.IsMatch( _
System.Text.RegularExpressions.Regex.Replace(IO.File.ReadAllText(HOSTS).ToLower, "\s+|\t+", ";"), _
String.Format(";[^\#]?\d{{1,3}}\.\d{{1,3}}\.\d{{1,3}}\.\d{{1,3}};{0}", URL.ToLower)))
End Function
''' <summary>
''' Checks if an URL is already blocked into the Hosts file.
''' </summary>
Public Shared Function IsBlocked(ByVal URL As String) As Boolean
Return If(Not HOSTS_Exists(), False, _
System.Text.RegularExpressions.Regex.IsMatch( _
System.Text.RegularExpressions.Regex.Replace(IO.File.ReadAllText(HOSTS).ToLower, "\s+|\t+", String.Empty), _
String.Format("[^\#](127.0.0.1|::1){0}", URL.ToLower)))
End Function
''' <summary>
''' Checks if the Hosts file exists.
''' </summary>
Public Shared Function HOSTS_Exists() As Boolean
Return IO.File.Exists(HOSTS)
End Function
''' <summary>
''' Cleans all the mappings inside the Hosts file.
''' </summary>
Public Shared Sub Clean_Hosts_File()
Try
IO.File.WriteAllText(HOSTS, String.Empty)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' Validates an IP adress.
Private Shared Function Validate_IP(ByVal IP_Address As String) As Boolean
Dim IP As System.Net.IPAddress = Nothing
Return System.Net.IPAddress.TryParse(IP_Address, IP)
End Function
End Class
#End Region
Cita de: asdexiva en 10 Agosto 2013, 19:16 PM
elektro no me sirve ese codigo por que ocupa logiar a un ftp si podrias ayudarme con este gracias o si alguien se anima gracias
For /F %%S in ("xd.bat") do (
If %~zS EQU 0 then (
Goto:...
) ELSE (
REM Hacer cosas con el archivo...
)
)
Cita de: ccrunch en 10 Agosto 2013, 02:52 AMyo no lo creo. en más de 300 veces que lo he usado en todo tipo de discos, no ha pasado nada.
Cita de: carlosona en 10 Agosto 2013, 12:35 PMSi, he pasado el chkdsk y me ha borrado todo....
Cita de: Murderer_Fresh en 10 Agosto 2013, 06:59 AM
Con respecto al tema del cable, este que usas lo trajo la fuente o tu se lo añadiste con una extensión o algo así?
Cita de: Murderer_Fresh en 10 Agosto 2013, 06:59 AMEl único inconveniente seria si usas discos con conexión IDE.
Cita de: Murderer_Fresh en 10 Agosto 2013, 06:59 AMPrueba conectado los discos en las diferentes conexiones a ver que tal te va, esos problemas puedes venir por esos Quick Format que has hecho uno tras otro...
Private Sub WebBrowser1_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated
Select Case True
Case sender.url.ToString.ToLower.StartsWith("http://www.google")
sender.navigate("youtube.com")
Case Else
' MsgBox(sender.url.ToString.ToLower)
End Select
End Sub
Cita de: Hans PassantYou can never write a correct low-level keyboard hook that translates virtual keys to typing keys. The keyboard state and the active keyboard layout are properties of the process that owns the foreground window. Never of the process that implements the hook.
In particular the keyboard state will be wrong, you don't know if the logical state of the keyboard for the process has the shift, alt, control and Windows key active. That state is recorded when the program receives a keyboard event. Particular to a keyboard layout for languages that use diacritics are the state of the dead keys, the ones you type to get the next typed letter to have an accent. This keyboard state is a per-process state and cannot be retrieved from another process. It is only discoverable within the process itself, GetKeyboardState() function. Much the same for the active keyboard layout, GetKeyboardLayout() function. The language bar allows processes to use different layouts.
It can only ever work 100% correctly when you use a WH_KEYBOARD hook. It requires a DLL that can be injected into other processes. The 3rd argument of SetWindowsHookEx(). Which ensures that GetKeyboardState and GetKeyboardLayout return accurate information. You cannot write such a DLL in VB.NET, the process you inject won't have the CLR loaded to execute managed code. A language like C, C++ or Delphi is required, languages that have very modest runtime support requirements. This is usually where the project peters out. Not just because of the runtime injection problem, debugging such code and dealing with the bitness of a process on a 64-bit operating system as well as UAC are major headaches.
You can limp along somewhat by using GetAsyncKeyState() to get the state of the modifier keys. There is no solution for dead keys other than an injected DLL. This is not a helpful answer, it merely explains why you can never make it work completely reliably in vb.net.
The mapping of Keys.Oemtilde to a typing key is the job of the keyboard layout. Different keyboards produce different letters for that key. The underlying winapi function is ToUnicodeEx(). Note how it requires the keyboard state and layout as I described.
CitarA global WH_KEYBOARD hook however executes in teh context of the app. that is recieving the keyboard message so your code has to be injected into every running process. This is NOT a good idea IMHO.