You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
360 B
21 lines
360 B
#!/usr/bin/python
|
|
|
|
import os
|
|
import pwd
|
|
import grp
|
|
|
|
pw = pwd.getpwuid(os.getuid())
|
|
gr = grp.getgrgid(pw.pw_gid)
|
|
groups = [g.gr_gid for g in grp.getgrall() if pw.pw_name in g.gr_mem]
|
|
priv_esc = True
|
|
try:
|
|
os.seteuid(0)
|
|
except OSError:
|
|
priv_esc = False
|
|
|
|
print """Running as:
|
|
|
|
uid = {0}
|
|
gid = {1}
|
|
groups = {2}""".format(pw.pw_uid, gr.gr_gid, str(groups))
|
|
|
|
|