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

 

 


Tema destacado:


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  [ASM+VB6][ANTI] IsVirtualPC - Saber si estamos en un VPC!
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [ASM+VB6][ANTI] IsVirtualPC - Saber si estamos en un VPC!  (Leído 1,648 veces)
Karcrack


Desconectado Desconectado

Mensajes: 2.416


Se siente observado ¬¬'


Ver Perfil
[ASM+VB6][ANTI] IsVirtualPC - Saber si estamos en un VPC!
« en: 10 Febrero 2010, 18:04 pm »

Código
  1. Option Explicit
  2.  
  3. '---------------------------------------------------------------------------------------
  4. ' Module    : mAntiVirtualPC
  5. ' Author    : Karcrack
  6. ' Now$      : 06/09/2009  17:35
  7. ' Used for? : Known if being Virtualized inside M$ Virtual PC
  8. ' Thanks    : Kiash > He tested on Virtual PC
  9. ' Original C source:
  10. '    BOOL IsVirtualPC(void){
  11. '        __try{
  12. '            __asm{
  13. '                mov eax, 1
  14. '                _emit 0x0F
  15. '                _emit 0x3F
  16. '                _emit 0x07
  17. '                _emit 0x0B
  18. '                _emit 0xC7
  19. '                _emit 0x45
  20. '                _emit 0xFC
  21. '                _emit 0xFF
  22. '                _emit 0xFF
  23. '                _emit 0xFF
  24. '                _emit 0xFF
  25. '            }
  26. '        }__except(1){
  27. '            return FALSE;
  28. '        }
  29. '        return TRUE;
  30. '    }
  31. '---------------------------------------------------------------------------------------
  32.  
  33. 'KERNEL32
  34. Private Declare Function SetUnhandledExceptionFilter Lib "KERNEL32" (ByVal lpTopLevelExceptionFilter As Long) As Long
  35. 'USER32
  36. Private Declare Function CallWindowProc Lib "USER32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  37. 'MSVBVM60
  38. Private Declare Sub PutMem8 Lib "MSVBVM60" (inDst As Any, ByVal inSrc As Currency)
  39.  
  40. Private Const THUNK_ANTI1       As Currency = -104917872100.9905@           'db 0x0F, 0x3F,0x07,0x0B,0xC7,0x45,0xFC,0xFF
  41. Private Const THUNK_ANTI2       As Currency = -802975918416356.9665@        'db 0xFF,0xFF,0xFF + RET + NOP + NOP + NOP + NOP
  42.  
  43. Private m_bFlag                 As Boolean
  44.  
  45. Public Function IsVirtualPC() As Boolean
  46.    On Error Resume Next
  47.    Dim bvASM(&HF)              As Byte
  48.    Dim lOldSEH                 As Long
  49.  
  50.    m_bFlag = True
  51.    lOldSEH = SetUnhandledExceptionFilter(AddressOf ExceptionHandler)
  52.  
  53.    Call PutMem8(ByVal VarPtr(bvASM(0)), THUNK_ANTI1)
  54.    Call PutMem8(ByVal VarPtr(bvASM(0)) + 8, THUNK_ANTI2)
  55.  
  56.    Call CallWindowProc(VarPtr(bvASM(0)), 0&, 0&, 0&, 0&)
  57.  
  58.    Call SetUnhandledExceptionFilter(lOldSEH)
  59.    IsVirtualPC = m_bFlag
  60. End Function
  61.  
  62. Public Function ExceptionHandler(ByRef uException As Long) As Long
  63.    m_bFlag = False: ExceptionHandler = -1
  64.    ' VB Will process our error :P
  65.    Call Mid$(vbNullString, 0)
  66. End Function

Como siempre, cualquier duda... preguntar! :D

Este es un codigo que detecta si estamos siendo ejecutados en un M$ Virtual PC, simplemente pase el codigo de C a VB ;)

Saludos ::)


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines