C
C
Chik-2019-12-03 14:21:00
Python
Chik-, 2019-12-03 14:21:00

Is it possible somehow to unlock a windows profile programmatically from python?

I need to unlock my profile in windows programmatically for some event. How can I even do this? As far as I understood, windows doesn't provide such an api, but is there any workaround or way?
The password itself is known.
tried like this, but something doesn't work

import ctypes,time,keyboard
dll = ctypes.WinDLL('user32.dll')
dll.LockWorkStation()
time.sleep(5)
keyboard.send('enter')
time.sleep(2)
keyboard.send('p,a,s,s')
keyboard.send('enter')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-12-03
@NeiroNx

You need a virtual keyboard driver, because after dll.LockWorkStation() another context starts to work, in which keyboard.send('enter') will never get - for security reasons. And if you use a driver, then it will be visible to the system as a keyboard, and not as sending commands to the current user context.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question