File size: 848 Bytes
36bec3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import stat

def check_uinput():
    path = "/dev/uinput"
    print(f"--- Checking {path} ---")
    
    if not os.path.exists(path):
        print(f"❌ {path} does not exist.")
        return

    # Check stats
    st = os.stat(path)
    print(f"Mode: {oct(st.st_mode)}")
    print(f"Owner UID: {st.st_uid}")
    print(f"Group GID: {st.st_gid}")
    
    # Check current user/groups
    print(f"\nCurrent User UID: {os.getuid()}")
    print(f"Current Groups GIDs: {os.getgroups()}")
    
    # Try opening for writing
    try:
        with open(path, 'w') as f:
            print(f"✅ Successfully opened {path} for writing.")
    except PermissionError:
        print(f"❌ Permission Denied: Cannot open {path} for writing.")
    except Exception as e:
        print(f"❌ Error: {e}")

if __name__ == "__main__":
    check_uinput()