Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
759 B
0
Indexable
Never
import win32security
import win32con
import win32api
import ctypes, os

    
def get_login():
    return win32api.GetUserName()

def log_in(login, password):
    user = win32security.LogonUser(
        login, 
        '', 
        password, 
        win32con.LOGON32_LOGON_INTERACTIVE,
        win32con.LOGON32_PROVIDER_DEFAULT
    )
    
    win32security.ImpersonateLoggedOnUser(user)
    
def is_admin():
    try:
        open('C:\\Users\\sllnsl\\Desktop\\file3.txt', 'r')
        return True
    except Exception:
        return False

    
login = get_login()
password = "" 

print("username: ", get_login(), "is_admin:", is_admin())

log_in("User9_1", "1320")

print("username: ", get_login(), "is_admin:", is_admin())
Leave a Comment