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 2 3 4 5 6 7 [8] 9
71  Programación / Programación Visual Basic / Re: Formularios e nvb(si, yo de neuvo...) en: 17 Julio 2005, 20:05 pm
Hola M@rT1n, para comprobar si un OptionBox o un CheckBox están activados, simplemente haz una comparación a la propiedad value. Ejemplo:
Código:
If Check1.value = 1 Then
    ' comandos
Else
    ' comandos
End If

Si no quieres usar la propiedad _click del control, puedes utilizar un timer que te haga esa comprobación y activar los elementos de la lista. Siguiendo el ejemplo anterior sería:
Código:
Private Sub Timer1_Timer()
    If Check1.Value = 1 Then
        Command1.Enabled = True
        Text1.Enabled = True
    Else
        Command1.Enabled = False
        Text1.Enabled = False
    End If
End Sub

Saludos!!
72  Programación / Programación Visual Basic / Re: Ayuda para GUARDAR y ABRIR textos *.txt en una TextBox. en: 17 Julio 2005, 15:06 pm
Si, también vale para los RichTextBox.

Saludos!!
73  Programación / Programación Visual Basic / Re: Otra Pregunta Tonta en: 17 Julio 2005, 10:48 am
Ahhh... ya se lo que quieres. Pues puede utilizar el Microsoft Script Control, que sirve para hacer scripts en varios lenguajes relacionados con visual basic y se pueden ejecutar en tiempo de ejecución.
74  Programación / Programación Visual Basic / Re: Ayuda para GUARDAR y ABRIR textos *.txt en una TextBox. en: 17 Julio 2005, 10:34 am
Pero lo que ha posteado sorcerer sólo sirve utilizando RichTextBox. Para los TextBox sería:

Para abrir:
Código:
    Dim foo As Integer
   
    foo = FreeFile
    Open "C:\Archivo.txt" For Input As #foo
        Text1.Text = Input(LOF(foo), #foo)
    Close #foo

Para guardar:
Código:
    Dim foo As Integer
   
    foo = FreeFile
    Open "C:\Archivo.txt" For Output As #foo
        Print #foo, Text1.Text
    Close #foo

Ese método sería el más sencillo, aunque se puede hacer de muchísimas formas.

Saludos!!
75  Programación / Programación Visual Basic / Re: Menu contextual y Botones XP en: 17 Julio 2005, 00:07 am
Me refería a personalizar el menú al decir como el del word, como ponerle iconos, sombras, etc... Vamos, un estilo totalmente diferente al del visual basic.

Un saludo.
76  Programación / Programación Visual Basic / Re: Menu contextual y Botones XP en: 16 Julio 2005, 23:54 pm
Para ver los formularios del visual basic 6 al estilo del windows xp, dentro del sistema operativo, tienes que incluir un .manifest a tu proyecto. Aquí hay un ejemplo:
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=28444&lngWId=1
Si quieres más controles para tu proyecto, pásate por ésta página que hay bastantes ejemplos y controles para usarlos:
http://www.planetsourcecode.com

En cuanto a lo del menú contextual, es programación muy avanzada si quieres hacerlo como el word, porque básicamente se realiza con llamadas a api's. También hay bastantes ejemplos de como hacerlo en esa página.

Un Saludo.
77  Programación / Programación Visual Basic / Re: Unas Dudillas en: 16 Julio 2005, 23:46 pm
Gargo89, te contestaré a la primera pregunta.
Para poner los puntos como PasswordChar, tienes que seleccionar la fuente "Symbol" desde la propiedad font del cuadro de texto. Luego como passwordchar, pones el carácter "·".

Para la segunda pregunta de cómo abrir una web desde el visual basic, se puede hacer con el comando shell():
Código:
Shell ("explorer.exe http://www.google.es")
78  Programación / Programación Visual Basic / Re: Otra Pregunta Tonta en: 16 Julio 2005, 23:35 pm
He encontrado los errores que has provocado:
De la forma que te dije yo, en el código tu escribes esto

Código:
Comando = Split(txtLog.Text, " ")

Mientras que según lo que he visto, tu no quieres sacar el comando del txtLog, sino del txtCommand. Por tanto será:

Código:
Comando = Split(txtCommand.Text, " ")

Para la forma que dijo Anhur, me equivoqué con lo de las variables globales, porque creía que lo utilizabas de otra manera. El error está en:

Código:
frmClientMain.txtLog.Text = iPort
frmClientMain.txtLog.Text = sIp
frmClientMain.txtLog.Text = sPass

Tendrías que poner:
Código:
frmClientMain.txtLog.Text = frmClientMain.txtLog.Text & iPort & vbCrLf
frmClientMain.txtLog.Text = frmClientMain.txtLog.Text & sIP & vbCrLf
frmClientMain.txtLog.Text = frmClientMain.txtLog.Text & sPass & vbCrLf
Para no borrar el contenido del cuadro de texto.
Por tanto, ahí están los dos errores.

Para alwar, si quieres ejecutar el comando MsgBox cuando lo escribes en tiempo de ejecución en un cuadro de texto, lo que tendrías que hacer, por ejemplo, sería:

Código:
Private Sub Command1_Click()
If LCase(Left$(text1.Text, Len("msgbox "))) = "msgbox " Then
    If Len(text1.Text) <> Len("msgbox ") Then
        MsgBox Right$(text1.Text, Len(text1.Text) - Len("msgbox "))
    End If
End If

text1.Text = ""
End Sub

79  Programación / Programación Visual Basic / Re: Otra Pregunta Tonta en: 16 Julio 2005, 03:13 am
Simplemente declara las variables iPort%, sIp$, sPass$ como globales.
Si tienes visual basic 6, puedes hacerlo también de esta manera:

Código:
Option Explicit

'Variables globales
Dim sIp As String
Dim sPuerto As Integer
Dim sPassword As String

Private Sub Command1_Click()
Dim Comando() As String
Dim i As Integer
Comando = Split(Text1.Text, " ")

For i = 0 To UBound(Comando)
    Select Case LCase(Comando(i))
        Case "-ip"
            sIp = Comando(i + 1)
       
        Case "-port"
            sPuerto = Comando(i + 1)
       
        Case "-password"
            sPassword = Comando(i + 1)
           
    End Select
Next i

Text1.Text = sIp & vbCrLf & sPuerto & vbCrLf & sPassword
End Sub

Mas que nada, si tienes una versión inferior del Visual Basic 6, el comando "split()" no está, por tanto te toca hacerlo por método de búsqueda con el InStr y Mid como bien dijo Anhur.

Un Saludo.
80  Seguridad Informática / Hacking / Re: Pekeña aplicacion para instalar netcat en otro pc, hecho x mi. NetCaTroyan. en: 14 Julio 2005, 14:07 pm
Para guardar las variables en el propio servidor es muy sencillo.
Te paso unas funciones que programé cuando hice un troyano en visual basic:

NOTA: Utilizo otro mod para hacer un cambio de base 16 a base 10, aunque todavía no se por qué lo hice así, porque se puede guardar facilmente el puerto sin hacer cambios de base. Pero bueno, eso no es lo importante.

Ahí van las funciones, siento no tenerlas comentadas pero es muy fácil de entender y con un poco de habilidad se pueden adaptar a tu programa.

Función para guardar las variables en el ejecutable.
Código:
Private Function GuardarVariables(sArchivo As String, sPuerto As String, sIP As String, ModoEscucha As Byte)
    Dim SeparandoIp() As String
    Dim GuardandoIP As Byte
    Dim GuardandoPuerto As String
    Dim SeparandoPuerto As Byte
    Dim foo As Integer
    Dim i As Integer
   
    foo = FreeFile
   
    Open sArchivo For Binary As #foo
   
    GuardandoPuerto = VeryLongConvert(sPuerto, 10, 16)
    SeparandoPuerto = VeryLongConvert(Mid$(GuardandoPuerto, 3, 2), 16, 10)
    Put #foo, LOF(foo) + 1, SeparandoPuerto
   
    SeparandoPuerto = VeryLongConvert(Mid$(GuardandoPuerto, 1, 2), 16, 10)
    Put #foo, LOF(foo) + 1, SeparandoPuerto
   
    SeparandoIp = Split(sIP, ".")
   
    For i = 0 To UBound(SeparandoIp)
        GuardandoIP = SeparandoIp(i)
        Put #foo, LOF(foo) + 1, GuardandoIP
    Next i
   
    Put #foo, LOF(foo) + 1, ModoEscucha
   
    Close #foo
End Function

Función para cargar las variables del ejecutable.
Código:
Public Function CargaVariables(sArchivo As String, sCargar As OpcionesCarga) As String
    Dim foo As Integer
    Dim PuertoServer As Byte
    Dim Convirtiendo As String
    Dim ObteniendoDatos As String
    Dim i As Integer
   
    foo = FreeFile
   
    Open sArchivo For Binary As #foo
   
    If LOF(foo) = 0 Then
        Exit Function
    End If
   
    Select Case sCargar
        Case 0
            Get #foo, LOF(foo) - 5, PuertoServer
            ObteniendoDatos = PuertoServer
            Convirtiendo = VeryLongConvert(ObteniendoDatos, 10, 16)
            If Len(VeryLongConvert(ObteniendoDatos, 10, 16)) = 1 Then: Convirtiendo = "0" & Convirtiendo
           
            Get #foo, LOF(foo) - 6, PuertoServer
            ObteniendoDatos = PuertoServer
            If Len(VeryLongConvert(ObteniendoDatos, 10, 16)) = 1 Then
                Convirtiendo = Convirtiendo & "0" & VeryLongConvert(ObteniendoDatos, 10, 16)
            Else
                Convirtiendo = Convirtiendo & VeryLongConvert(ObteniendoDatos, 10, 16)
            End If
            Convirtiendo = VeryLongConvert(Convirtiendo, 16, 10)
           
            CargaVariables = Convirtiendo
           
        Case 1
            For i = 4 To 1 Step -1
                Get #foo, LOF(foo) - i, PuertoServer
                ObteniendoDatos = PuertoServer
                If i = 4 Then
                    Convirtiendo = Convirtiendo & ObteniendoDatos
                Else
                    Convirtiendo = Convirtiendo & "." & ObteniendoDatos
                End If
            Next i
            CargaVariables = Convirtiendo
       
        Case 2
            Get #foo, LOF(foo), PuertoServer
            CargaVariables = PuertoServer
    End Select
   
    Close #foo

End Function

Módulo para hacer cambios de base

Código:
Option Compare Text

'Most used bases
Public Const B_BIN As Integer = 2
Public Const B_OCT As Integer = 8
Public Const B_DEC As Integer = 10
Public Const B_HEX As Integer = 16
'Some separators
Public Const DEFAULT_SEPARATOR As String = "."
Public Const COMMA_SEPARATOR As String = ","

Private Digits(0 To 35) As String 'Bases digits
Private INum() As Integer 'Input number
Private ONum() As Integer 'Output number
Private IBase As Integer 'Input base
Private OBase As Integer 'Output base

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'VeryLongConvert : function that converts a huge number as string from a base to
'                  another one
'
'                  Version : 1.01
'                  Author:  Guillaume GIFFARD
'                  Date : 01/03/2002
'                  Mail : Guiland@mail.com
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'INPUTS :  * Word As String : the huge number to convert
'
'          * FromBase As Integer : the base in witch Word is written
'
'          * ToBase As Integer : the base in witch Word is to convert
'
'          * Separator As String : this Optional variable is the decimal separator,
'          usely the point
'
'          FromBase and ToBase are integers from 2 to 36
'
'OUTPUTS : * the function returns the huge number value converted from FromBase to
'          ToBase as string. It returns "" if Word is empty or if FromBase or
'          ToBase is not between 2 and 36
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function VeryLongConvert(Word As String, FromBase As Integer, ToBase As Integer, Optional Separator As String = DEFAULT_SEPARATOR) As String
    If Word = "" Or FromBase < 2 Or FromBase > 36 Or ToBase < 2 Or ToBase > 36 Then Exit Function
    If Digits(35) <> "Z" Then InitDigits
    Call StringToArray(Word, FromBase, Separator)
    Convert (ToBase)
    VeryLongConvert = DeleteZeros(ArrayToString(Separator), Separator)
End Function

'Saves the bases digits in an array
Private Sub InitDigits()
    For i = 0 To 9
        Digits(i) = i
    Next i
    For i = 10 To 35
        Digits(i) = Chr(i + 55)
    Next i
End Sub
 
'Saves a number as string in an array of integers
'Each cell of the array in one digit of the number
Private Sub StringToArray(Word As String, Base As Integer, Optional Separator As String = DEFAULT_SEPARATOR)
    If Word = "" Or Base < 2 Or Base > 36 Then Exit Sub
    Dim Point As Integer, Min As Integer, Max As Integer, NoPoint As Integer
    IBase = Base
    Point = InStr(1, Word, Separator, vbTextCompare)
    If Point = 0 Then
        Max = Len(Word) - 1
        Min = 0
    Else
        Max = Point - 2
        Min = Point - Len(Word) + Len(Separator) - 1
    End If
    ReDim INum(Min To Max)
    For i = 0 To Len(Word) - 1
        If i <= Len(Word) - Point And i >= Len(Word) - Point - Len(Separator) + 1 Then
            NoPoint = NoPoint - 1
        Else
            INum(Min + i + NoPoint) = Number(Left(Right(Word, i + 1), 1), IBase)
        End If
    Next i
End Sub

'Returns the number corresponding to a digit as string if the digit is allowed
'by the base. e.g. : C is allowed in hexadecimal but not in decimal or in octal
Private Function Number(Digit As String, Base As Integer) As Integer
    If Digit = "" Or Base < 2 Or Base > 36 Then Exit Function
    For i = 0 To 35
        If i = Base Then Exit Function
        If UCase(Digit) = Digits(i) Then Number = i
    Next i
End Function

'THE sub that converts INum to ONum with IBase and OBase
Private Sub Convert(Base As Integer)
    If Base < 2 Or Base > 36 Then Exit Sub
    Dim Max As Integer, Min As Integer
    Dim TmpNum() As Integer, Tmp2Num() As Integer

    OBase = Base
    Max = RoundOverInt(Int((UBound(INum, 1) + 1) * Log(IBase) / Log(OBase)))
    Min = Int(LBound(INum, 1) * Log(IBase) / Log(OBase))
    ReDim ONum(Min To Max)
    i = 0 'LBound(ONum, 1)
    Call DivideVeryLong(INum, OBase, TmpNum, ONum(i), IBase)
    i = i + 1
    Do Until i > UBound(ONum, 1)
        Call DivideVeryLong(TmpNum, OBase, Tmp2Num, ONum(i), IBase)
        ReDim TmpNum(LBound(Tmp2Num, 1) To UBound(Tmp2Num, 1))
        For j = LBound(Tmp2Num, 1) To UBound(Tmp2Num, 1)
            TmpNum(j) = Tmp2Num(j)
        Next j
        i = i + 1
    Loop
End Sub

'round numbers to the closest higher integer
'e.g. : 3.9 gives 4 ; 3.4 gives 4 ; 3 gives 3
Private Function RoundOverInt(Value As Double) As Double
    If Value = Int(Value) Then RoundOverInt = Value Else RoundOverInt = Int(Value) + 1
End Function

'Divides a huge number by an integer and returns the huge quotient and the remainder
Private Sub DivideVeryLong(Numerator() As Integer, Denominator As Integer, QuotientOut() As Integer, Remainder As Integer, Base As Integer)
    Dim Tmp As Long, Decal As Long
    ReDim QuotientOut(LBound(Numerator, 1) To UBound(Numerator, 1))
    Tmp = 0
    Decal = 0
    For i = UBound(Numerator, 1) To 0 Step -1 'LBound(Numerator, 1) Step -1
        Tmp = Tmp * Base + Numerator(i)
        QuotientOut(i - Decal) = Tmp \ Denominator
        'If QuotientOut(i - Decal) = 0 And Decal = i - 1 Then
        '    Decal = Decal - 1
        '    ReDim QuotientOut(LBound(Numerator, 1) To UBound(Numerator, 1) - Decal)
        'End If
        Tmp = Tmp - QuotientOut(i - Decal) * Denominator
    Next i
    Remainder = Tmp
End Sub

'Saves an array in a string
Private Function ArrayToString(Optional Separator As String = DEFAULT_SEPARATOR) As String
    For i = UBound(ONum, 1) To LBound(ONum, 1) Step -1
        If i = -1 Then ArrayToString = ArrayToString & Separator
        ArrayToString = ArrayToString & Digits(ONum(i))
    Next i
End Function

'Deletes zeros before and after the number as string and, if possible, deletes the
'separator
Private Function DeleteZeros(Word As String, Optional Separator As String = DEFAULT_SEPARATOR) As String
    Dim Point As Integer, WordTmp As String
    WordTmp = Word
    Do
        Point = InStr(1, WordTmp, "0", vbTextCompare)
        If Point = 1 Then WordTmp = Right(WordTmp, Len(WordTmp) - 1) Else Exit Do
    Loop
    If InStr(1, WordTmp, Separator, vbTextCompare) <> 0 Then
        Do
            Point = InStr(Len(WordTmp) - 1, WordTmp, "0", vbTextCompare)
            If Point = Len(WordTmp) - 1 Then WordTmp = Left(WordTmp, Len(WordTmp) - 1) Else Exit Do
        Loop
        Do
            Point = InStr(Len(WordTmp) - 1, WordTmp, "0", vbTextCompare)
            If Point = Len(WordTmp) Then WordTmp = Left(WordTmp, Len(WordTmp) - 1) Else Exit Do
        Loop
    End If
    If WordTmp = "" Then WordTmp = "0"
    If InStr(1, WordTmp, Separator, vbTextCompare) = Len(WordTmp) - Len(Separator) + 1 Then WordTmp = Left(WordTmp, Len(WordTmp) - Len(Separator))
    DeleteZeros = WordTmp
End Function


Un Saludo.
Páginas: 1 2 3 4 5 6 7 [8] 9
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines