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 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [31] 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 ... 128
301  Programación / Programación Visual Basic / Re: [RETO] Obtener nombre de archivo en: 14 Febrero 2011, 02:45 am
En primer lugar gracias a todos por participar! :D
En segundo lugar perdón por haber puesto códigos que no funcionaban, andaba con prisa... :¬¬
Este es mi último código:

Código
  1. Public Static Function MrFrogGetFileFast(ByRef sPath As String) As String
  2. Dim L                                               As Long
  3. Dim lngPos                                          As Long
  4.  
  5.    L = LenB(sPath) \ 2
  6.    lngPos = L - InStrRev(sPath, "\", L, vbBinaryCompare)
  7.    MrFrogGetFileFast = RightB$(sPath, lngPos + lngPos)
  8. End Function

Test:
Código:
Option Explicit

Private cFC As New cFrogContest

Private Declare Sub PathStripPath Lib "shlwapi.dll" Alias "PathStripPathA" (ByVal pszPath As String)
Private Declare Function GetFileTitle Lib "comdlg32.dll" Alias "GetFileTitleA" (ByVal lpszFile As String, ByVal lpszTitle As String, ByVal cbBuf As Integer) As Integer

Public Static Function MrFrogGetFileFast(ByRef sPath As String) As String
Dim L                                               As Long
Dim lngPos                                          As Long
   
    L = LenB(sPath) \ 2
    lngPos = L - InStrRev(sPath, "\", L, vbBinaryCompare)
    MrFrogGetFileFast = RightB$(sPath, lngPos + lngPos)
End Function

Public Function SacarFilenameE_Cv2(ByRef sPath As String) As String
    SacarFilenameE_Cv2 = Right$(sPath, Len(sPath) - InStrRev(sPath, "\", Len(sPath), vbBinaryCompare))
End Function

Public Function SacarFilenameE_C(ByRef sPath As String) As String
SacarFilenameE_C = StrReverse$(Left$(StrReverse$(sPath), InStr(1, StrReverse(sPath), "\", vbBinaryCompare) - 1))
End Function

Public Function getFileNameIgnorante(ByVal path As String) As String
    Dim cM As Integer
    cM = InStrRev(path, "\") + 1
    If cM = 0 Then Exit Function
    getFileNameIgnorante = Mid(path, cM)
End Function

Public Function StripPathSeba(ByVal sPath As String) As String
   Call PathStripPath(sPath)
   StripPathSeba = sPath
End Function

Public Function getFileNameIgnoranteMODSeba(ByVal path As String) As String
    getFileNameIgnoranteMODSeba = Mid$(path, InStrRev(path, "\") + 1)
End Function

Public Function nombre_archivoGrester(ByVal Ruta As String) As String
Dim partes() As String
partes = Split(Ruta, "\")
nombre_archivoGrester = partes(UBound(partes))
End Function

Public Function Fn7913(ByVal sPath As String) As String
    Dim Buffer As String
    Buffer = String(255, 0)
    GetFileTitle sPath, Buffer, Len(Buffer)
    Fn7913 = Left$(Buffer, InStr(1, Buffer, Chr$(0)) - 1)
 End Function
 
Public Function GetFileName123(ByRef vPath As String) As String
    GetFileName123 = Right$(vPath, Len(vPath) - InStrRev(vPath, "\"))
End Function

Private Sub Form_Load()
    With cFC
        .ContestName = "ObtenerNombreArchivo"
        .Explanation = "Mas claro, hechale agua"
        .SaveDirectory = App.path
        .ReplaceFile = True
        .Functions "Fn7913,MrFrogGetFileFast,GetFilename123,getFileNameIgnorante,getFileNameIgnoranteMODSeba,nombre_archivoGrester,SacarFilenameE_C,SacarFilenameE_Cv2,StripPathSeba"
        .Arguments "C:\Documents and Settings\Llamazares\Mis documentos\Downloads\SexoDeRanas.avi"
        .NumberOfLoops = 10000
        .Result = "SexoDeRanas.avi"
        .SetObject Me
        .TestIt
        .ShowTest
    End With
   
    End
End Sub

Resultado :
Código:
================================================================================
º Contest Name : ObtenerNombreArchivo
º Explanation  : Mas claro, hechale agua
º Arguments    : C:\Documents and Settings\Llamazares\Mis documentos\Downloads\SexoDeRanas.avi
º Loops        : 10000
º Date & Hour  : 02-14-2011 <-> 02:54:08
================================================================================
Results [compiled] :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.- MrFrogGetFileFast                                   -> 66,783268 msec
2.- SacarFilenameE_Cv2                                  -> 70,190216 msec
3.- MrFrogGetFileFast                                   -> 74,492314 msec
4.- SacarFilenameE_C                                    -> 78,365336 msec
5.- getFileNameIgnorante                                -> 79,100052 msec
6.- getFileNameIgnoranteMODSeba                         -> 88,191208 msec
7.- GetFilename123                                      -> 91,506807 msec
8.- nombre_archivoGrester                               -> 129,792677 msec
9.- Fn7913                                -> 2159,992821 msec
================================================================================
º The following functions returns incorrect results :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.- StripPathSeba
================================================================================
>>> Test made by cFrogContest.cls <-> Visit foro.elhacker.net <<<
================================================================================

Pd: Me alegra ver que usais mi clase :-*

DoEvents! :P
302  Programación / Programación Visual Basic / Re: [RETO] Obtener nombre de archivo en: 13 Febrero 2011, 22:32 pm
Código
  1. Public Static Function GetFileMrFrog(ByRef sFile As String) As String
  2.    GetFileMrFrog = RightB$(sFile, InStrRev(sFile, "\") * 2 - 2)
  3. End Function

Esta si! :P
Despues testeo ahora no tengo tiempo.
@Seba123neo
Jajajaj hice la clase precisamente para ahorrarte el trabajo! :xD

DoEvents! :P
303  Programación / Programación Visual Basic / Re: [RETO] Obtener nombre de archivo en: 13 Febrero 2011, 21:10 pm
La mía:
Código
  1. Public Static Function GetFileMrFrog(ByRef sFile As String) As String
  2.    GetFileMrFrog = RightB$(sFile, LenB(sFile) - InStrB(sFile, "\") - 1)
  3. End Function

@ignorantev1.1
http://foro.elhacker.net/programacion_visual_basic/src_cfrogcontestcls_by_mr_frog_copy-t318871.0.html

DoEvents! :P
304  Programación / Programación Visual Basic / [RETO] Obtener nombre de archivo en: 13 Febrero 2011, 19:54 pm
Un reto fácil, en el que creo que puede participar mucha gente. :)
Consiste en obtener el nombre de archivo a partir de una ruta, así:

Código:
C:\Documents and Settings\Llamazares\Mis documentos\Downloads\SexoDeRanas.avi
Deberia devolver la función:
Código:
SexoDeRanas.avi

Quien sea más rápido, gana. ;)
Se testeará con cFrogContest.cls :P

DoEvents! :P
305  Programación / Programación Visual Basic / Re: Command$ extraer archivos. en: 13 Febrero 2011, 19:47 pm
que yo sepa un nombre de archivo no puede tener comillas dobles...
Oops :-X
Fallo mio... :xD
No me di cuenta, aún así mi manera es correcta :silbar:
Lo que queria decir es que si haces Split() para sacar los nombres usando " " como delimitador, te cortará el la ruta en trozos suponiendo que este lleve espacios dentro. :)

DoEvents! :P
306  Programación / Programación Visual Basic / Re: Command$ extraer archivos. en: 13 Febrero 2011, 19:35 pm
Ya seba123neo, pero si el archivo lleva comillas? :rolleyes:
A mi se me ocurre algo así:

Código
  1. Public Function GetFiles(ByVal strText As String) As Collection
  2. Dim cTemp                       As New Collection
  3. Dim oRegExp                     As Object
  4. Dim oMatch                      As Object
  5. Dim oMatches                    As Object
  6.  
  7.    Set oRegExp = CreateObject("VBScript.RegExp") 'Evitamos la referencia
  8.  
  9.    With oRegExp
  10.        '// Sería similar a esta, lo único modificar los [\w\s\.] para que acepten algunos símbolos más... xP
  11.        .Pattern = "\s?([\w\s\.]+\:\\([\w\s\.]+\\?)[\w\s\.]+(\.\w{1,})?)\s?"    '// No incluye verificación de ruta (pero... ¿no hace falta no?)
  12.        .Global = True
  13.        .IgnoreCase = True
  14.    End With
  15.  
  16.    Set oMatches = oRegExp.Execute(strText)
  17.  
  18.    For Each oMatch In oMatches
  19.        cTemp.Add oMatch.SubMatches(0)
  20.    Next
  21.  
  22.    Set GetFiles = cTemp
  23. End Function
  24.  
  25. Private Sub Form_Load()
  26. Dim vItem                       As Variant
  27. Const S                         As String = "C:\Frog\Proyecto1.exe ""C:\reto 123.exe"" C:\imagen.png"
  28.    For Each vItem In GetFiles(S)
  29.        MsgBox vItem
  30.    Next
  31. End Sub

Ojalá te sirva ;)

DoEvents! :P
307  Programación / Programación Visual Basic / Re: Alguien me ayuda con un tema de logica en: 13 Febrero 2011, 16:33 pm
Aquí tienes un ejemplo usando la función más rápida del minireto. :rolleyes:
http://goo.gl/soolr

Código
  1. '-------------------------------------------------
  2. 'Añade 2 ListBox (List1 y List2)
  3. '-------------------------------------------------
  4. Option Explicit
  5. Private Declare Function GetFileAttributesW Lib "KERNEL32" (ByVal lpFileName As Long) As Long
  6.  
  7. 'LeandroA mod Karcrack mod Raul338 mod Mr.Frog
  8. Public Static Function DoFileExistsRII(ByRef sPath As String) As Boolean
  9.    DoFileExistsRII = (GetFileAttributesW(StrPtr(sPath)) > -1)
  10. End Function
  11.  
  12. Private Sub Form_Load()
  13. Dim lngCount                    As Long
  14. Dim strTmp                      As String
  15. Dim Q                           As Long
  16.  
  17.    With List1
  18.        .AddItem "c:\hola.txt"
  19.        .AddItem "c:\Text\34543554.jpg"
  20.        .AddItem "c:\La reproducción de las ranas.mpeg"
  21.  
  22.        lngCount = .ListCount - 1           '// Cantidad de Items
  23.  
  24.        '// Guardaré en el List2 sólo los archivos que existen xP
  25.        For Q = 0 To lngCount
  26.            strTmp = .List(Q)               '// El Item actual
  27.            If DoFileExistsRII(strTmp) Then '// Si existe... (¿Aquí estaba el fallo de lógica? xD)
  28.                List2.AddItem strTmp        '// Lo añado a List2
  29.            End If
  30.        Next Q
  31.    End With
  32. End Sub

Resultado en el 2º ListBox (List2):
Código:
c:\hola.txt
c:\La reproducción de las ranas.mpeg

DoEvents! :P
308  Programación / Programación Visual Basic / Re: Obtener informacion? en: 13 Febrero 2011, 13:41 pm
http://goo.gl/ZTPXS

DoEvents! :P
309  Programación / Programación Visual Basic / Re: [SRC] cFrogContest.cls [by Mr. Frog ©] en: 12 Febrero 2011, 22:29 pm
Codigo actualizado, corregido y mejorado... :)

DoEvents! :P
310  Programación / Programación Visual Basic / Re: [SRC] cFrogContest.cls [Beta] en: 12 Febrero 2011, 18:05 pm
@BlackZer0x
* Las propiedades deberias bloquearlas si es que ya se llamo a el proceso TestIt()
¿Por qué?

DoEvents! :P
Páginas: 1 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [31] 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 ... 128
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines