Skip to content

serpulga/python-accounts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Accounts

Access login and session information directly from Python.

Usage

  1. accounts.get_sessions: Get information about each current active session:

    • "user": User owner of the session

    • "date_created" : Date when the session was created

    • "host": Host of the session

    • "pid": PID of the session

    • "id": ID of the session

    • "line": Line of the session ["tty1", "tty2", ...]

    • "session_type": Type of the session:

      "EMPTY" "RUN_LVL" "BOOT_TIME" "NEW_TIME" "OLD_TIME"

      "INIT_PR" "LOGIN_PR" "USER_PR" "DEAD_PR"

  2. accounts.get_lastlogin: Get last login of the user given in the argument.

import accounts

sessions = accounts.get_sessions()
lastlogin = accounts.get_lastlogin('theuser')

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published