Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 #!/usr/bin/env python
3 # Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 """
8 A clone of 'who' command; print information about users who are
9 currently logged in.
10 """
12 import sys
13 from datetime import datetime
15 import psutil
16 from psutil._compat import print_
19 def main():
20 users = psutil.get_users()
21 for user in users:
22 print_("%-15s %-15s %s (%s)" % \
23 (user.name,
24 user.terminal or '-',
25 datetime.fromtimestamp(user.started).strftime("%Y-%m-%d %H:%M"),
26 user.host)
27 )
29 if __name__ == '__main__':
30 main()