Usa tu Pen-drive como llave de tu PC o programa
Publicado: 06 Mar 2009, 04:01
Cada vez que ejecutas este programa te engancha con el PEN (u otra unidad) y graba un fichero llave, que obliga a que esté el PEN, para que siga sin bloquearse el teclado y ratón.
3 usos de esta utilidad para bloquear el PC teniendo en cuenta que se encuentra una letra de unidad de disco (Pen, discos externos, discos internos)
1.-Este programa usa el Pen-drive com llave para bloquear el PC,
2.-Se puede usar tipo dongle para controlar ligado a un programa con el pen insertado.(Hay que incorporar en el arranque junto al programa, para que arranque cada vez el USBlock)
3.-Para no olvidarse LLEVARTE el PEN-Drive, que se queda frecuentemente olvidado, porque al sacar el PEN te pregunta si quieres apagar el PC. O sea no apagar el PC normalmente sino al SACAR EL PEN.
Observaciones:
-Tiene un sistema básico de bloquear el PC (teclado, ratón) alternativo al uso de entrada de usuario y contraseña del SISTEMA, no usar para seguridad extrema (habría que modificar alguna parte del código).
-No toca ni se incorpora al registro, arranque. O sea que si quieres tenerlo activado cada vez que se use el pc introducelo en el mismo Inicio. (Bajo propia responsabilidad) Ahora mismo, por precaución, si reinicias el PC desaparece el programa.
-Usar juiciosa y positivamente para con otras personas, Por favor!!. Sobran explicaciones.
Poner en el mismo directorio las librerias que adjunto:
GUIConstants.au3
String.au3
=>>MD5.au3 (Frez Systems Limited - converted to Au3 by SvenP)
=>>Mytoast.au3
Autor de Md5.au3 http://www.autoitscript.com/forum/index ... =10590&hl=
Versión con modificación para apagar el PC para no olvidar Pen, y traducida al Spanish. Créditos de USBLock original para crashdemons
Enlace del Autor http://www.autoitscript.com/forum/index ... opic=71505
3 usos de esta utilidad para bloquear el PC teniendo en cuenta que se encuentra una letra de unidad de disco (Pen, discos externos, discos internos)
1.-Este programa usa el Pen-drive com llave para bloquear el PC,
2.-Se puede usar tipo dongle para controlar ligado a un programa con el pen insertado.(Hay que incorporar en el arranque junto al programa, para que arranque cada vez el USBlock)
3.-Para no olvidarse LLEVARTE el PEN-Drive, que se queda frecuentemente olvidado, porque al sacar el PEN te pregunta si quieres apagar el PC. O sea no apagar el PC normalmente sino al SACAR EL PEN.
Observaciones:
-Tiene un sistema básico de bloquear el PC (teclado, ratón) alternativo al uso de entrada de usuario y contraseña del SISTEMA, no usar para seguridad extrema (habría que modificar alguna parte del código).
-No toca ni se incorpora al registro, arranque. O sea que si quieres tenerlo activado cada vez que se use el pc introducelo en el mismo Inicio. (Bajo propia responsabilidad) Ahora mismo, por precaución, si reinicias el PC desaparece el programa.
-Usar juiciosa y positivamente para con otras personas, Por favor!!. Sobran explicaciones.
Poner en el mismo directorio las librerias que adjunto:
GUIConstants.au3
String.au3
=>>MD5.au3 (Frez Systems Limited - converted to Au3 by SvenP)
=>>Mytoast.au3
Autor de Md5.au3 http://www.autoitscript.com/forum/index ... =10590&hl=
Versión con modificación para apagar el PC para no olvidar Pen, y traducida al Spanish. Créditos de USBLock original para crashdemons
Código: Seleccionar todo
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=lock.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=USBLock
#AutoIt3Wrapper_Res_Description=USBLock
#AutoIt3Wrapper_Res_Fileversion=1.1.0.18
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=Crash Daemonicus
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt("GUIOnEventMode", 1)
#include <GUIConstants.au3>
#include <String.au3>
#include <MD5.au3>
#include <myToast.au3>
Global $Locked=False
Global $Ready=False
Global $DebugMode=False
;If @Compiled Then $DebugMode=False ; for debugging without BlockInput()
Global $Drive
Global $KeyFilel=@ScriptDir&'\USBLock.key'
Global $KeyFile='USBLock.key'
Global $ini=@ScriptDir&'\USBLock.ini'
Global $cmd=StringLen($CmdLineRaw)
$Toast=ToastWin_Create('AYBABTU',@DesktopWidth-100,@DesktopHeight,100,100)
GUICtrlSetOnEvent($temp_ToastBox,"ToastWin_DisposeAuto2")
ToastWin_Show($Toast)
If $cmd And @Compiled Then
$Ready=True
$Drive="NonexistantDrive"
Else
While $Ready==False
NotifyOn("Introduzca la letra de unidad a Proteger.")
$Drive=InputBox("USBLock","Por favor introduzca la letra de unidad que se va a usar como llave para su PC.",$Drive)
$Toast_StopSleep=False
NotifyOff()
If @error Or $Drive=='' Then Exit
$Drive&=':\'
If FileExists($Drive)=0 Or StringLower($Drive)=='a:\' Or StringLower($Drive)=='b:\' Or StringLower($Drive)=='c:\' Then
NotifyOn(" Unidad de disco no encontrada."&@CRLF&" Por favor, Intentelo de nuevo")
ToastWin_Sleep($Toast,2000)
NotifyOff()
ContinueLoop
EndIf
$Ready=True
WEnd
$key=_GetNewKey()
FW($KeyFilel,MD5($key))
FW($Drive&$KeyFile,$key)
$key='';Clear original key from variables
EndIf
While 1
WaitRemoveDrive($Drive)
IF MsgBox(4100, "Opción de Apagar", "¿Desea apagar su PC?", 10)=6 Then
Shutdown(13)
EndIf
if InputBox("Sacó la llave"," Quiere apagar su PC",
;Lock Screen here
_BlockInput(1)
$Locked=True
$Drive=CheckForKey()
If $Locked Then ; makes sure you aren't hassled if the USB is already in!
NotifyOn("USBLock ha protegido este PC."&@CRLF&@CRLF&"Reconecte la Unidad para desbloquear.")
ToastWin_Sleep($Toast,3000)
NotifyOff()
While $Locked
Sleep(300)
$Drive=CheckForKey()
Sleep(100)
_SecurityHandler()
WENd
EndIf
_BlockInput(0)
;Unlock Screen here
NotifyOn("Unidad de disco USBLock reconocida."&@CRLF&@CRLF&" PC desbloqueado.")
ToastWin_Sleep($Toast,2000)
NotifyOff()
$key=_GetNewKey()
FW($KeyFilel,MD5($key))
FW($Drive&$KeyFile,$key)
$key=''
WEnd
Func NotifySecureWait($sleep)
$t=TimerInit()
While TimerDiff($t)<$sleep
_SecurityHandler()
Sleep(300)
WEnd
EndFunc
Func NotifyOn($text)
Global $Toast,$temp_ToastBox
GUICtrlSetData($temp_ToastBox,$text)
ToastWin_Size($Toast,2)
ToastWin_SlideDown($Toast,@DesktopHeight,@DesktopHeight-200)
ToastWin_OpenOut($Toast,2,100)
EndFunc
Func NotifyOff()
Global $Toast,$temp_ToastBox
ToastWin_OpenOut($Toast,100,2)
ToastWin_SlideDown($Toast,@DesktopHeight-200,@DesktopHeight)
ToastWin_Size($Toast,2)
GUICtrlSetData($temp_ToastBox,'')
EndFunc
Func _SecurityHandler()
Global $SecurityTimer
$Secure=True
If TimerDiff($SecurityTimer)>1000 Then
;Because CTRL+ALT+DEL and other apps can change whether BlockInput is on.
$SecurityTimer=TimerInit()
_BlockInput(1)
EndIf
$tskmgr_pid=ProcessExists("taskmgr.exe")
If $tskmgr_pid<>0 Then
WinClose("Windows Task Manager")
WinKill("Windows Task Manager")
ProcessClose($tskmgr_pid,1)
_BlockInput(1)
$Secure=False
EndIf
If $Secure=False Then
;Security Evasion detected
NotifyOn("USBLock ha bloqueado un intento de salir de la seguridad.")
NotifySecureWait(2000)
NotifyOff()
EndIf
EndFunc
Func _BlockInput($i)
Global $DebugMode
If $DebugMode Then Return 0
BlockInput($i)
EndFunc
Func _GetNewKey()
$key=''
For $i=1 To 300
$key&=Chr(Random(0x20,0x7E,1))
Next
Return $key
EndFunc
Func WaitRemoveDrive($drv)
If FileExists($drv)=0 Then Return 0
NotifyOn("USBLock va a esperar hasta que quite la unidad para bloquear su PC.")
ToastWin_Sleep($Toast,3000)
NotifyOff()
While FileExists($drv)
Sleep(300)
WEnd
EndFunc
Func CheckForKey()
Global $KeyFilel,$KeyFile,$Locked
$var = DriveGetDrive( "all" )
If NOT @error Then
For $i = 1 to $var[0]
$drv=$var[$i]
If $drv=='a:' Or $drv=='b:' Or $drv=='c:' Then ContinueLoop
If FileExists($drv&$KeyFile) Then
$key=FR($KeyFilel)
$key2=FR($drv&$KeyFile)
If $key2=="~X@CD_USBLock_Author[Crash Daemonicus]::280f5a5a7cf59c589328841c9beb9532" Then
BlockInput(0)
NotifyOn("Unidad de USBLock reconocida."&@CRLF&@CRLF&"Bienvenido.")
ToastWin_Sleep($Toast,2000)
NotifyOff()
Exit
EndIf
If MD5($key2)==$key Then
$Locked=False
Return $drv&'\'
Else
;Invalid Key actions
FileDelete($drv&$KeyFile)
NotifyOn("Esta unidad de USBLock no es válida."&@CRLF&" la llave de seguridad invalida se ha borrado.")
NotifySecureWait(4000)
NotifyOff()
EndIf
EndIf
Next
Return $Locked
Else
Exit
EndIf
EndFunc
Func ToastWin_DisposeAuto2()
;just here for the fake-close event ;)
Global $temp_ToastForm
$Toast_StopSleep=True
EndFunc
Func FR($file)
$fh = FileOpen($file, 16)
$d = BinaryToString(FileRead($fh))
FileClose($fh)
Return $d
EndFunc ;==>FileReadFull
Func FW($file, $data)
$fh = FileOpen($file, 2 + 16)
$d = FileWrite($fh, StringToBinary($data))
FileClose($fh)
Return $d
EndFunc ;==>FileOverwrite