27 lines
654 B
Python
27 lines
654 B
Python
|
from DocXMLRPCServer import DocXMLRPCServer
|
||
|
import traceback
|
||
|
import pwd
|
||
|
|
||
|
class TestService:
|
||
|
def listUsers(self):
|
||
|
"""Lists all system users."""
|
||
|
entries = [":".join((item[0], str(item[2]), str(item[3]), item[4])) for item in pwd.getpwall() if item[0].find("usr")==0]
|
||
|
|
||
|
return "\n".join(entries)
|
||
|
|
||
|
def startRPCServer():
|
||
|
server = DocXMLRPCServer(("localhost", 8080))
|
||
|
server.register_introspection_functions()
|
||
|
server.register_instance(TestService())
|
||
|
|
||
|
try:
|
||
|
server.serve_forever()
|
||
|
except KeyboardInterrupt:
|
||
|
server.server_close()
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
service = TestService()
|
||
|
print service.listUsers()
|
||
|
|
||
|
startRPCServer()
|