Skip to content

Commit 518b2bc

Browse files
committed
v1.0
Initial files
1 parent afac764 commit 518b2bc

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

invisible.vbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

start.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
wscript.exe ".\invisible.vbs" "yubicheck.bat"

yubicheck.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import re
2+
import subprocess
3+
import sys
4+
import ctypes
5+
from subprocess import check_output
6+
from time import sleep
7+
yubiSerial="XXXXXXX"
8+
first=True
9+
startupinfo = subprocess.STARTUPINFO()
10+
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
11+
12+
while(1):
13+
p = subprocess.Popen("ykneomgr.exe -s", stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=startupinfo)
14+
yubiRead, _ = p.communicate()
15+
if "error" in str(yubiRead):
16+
yubiRead="ERROR"
17+
else:
18+
yubiRead = re.sub('[^0-9]','', str(yubiRead))
19+
print (yubiRead)
20+
21+
if(yubiRead!=yubiSerial):
22+
if(first):
23+
sys.exit(0)
24+
print ("locking")
25+
ctypes.windll.user32.LockWorkStation()
26+
else:
27+
print ("Yubikey found")
28+
first=False
29+
sleep(10)

0 commit comments

Comments
 (0)