Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while True:
- try:
- readSocks = poller.poll()
- except select.error:
- continue
- for fheve in readSocks:
- fh = fheve[0]
- if fh == ms.fileno():
- (ns, addr) = ms.accept()
- if addr[0] in conf['white']:
- dic = {}
- #dic["hostname"] = getHostname()
- dic["ps"] = getPS()
- #dic["who"] = getWho()
- dic["uplo"] = getUptime()
- dic["ram"] = getRAM()
- #dic["ips"] = getIPs()
- dic["disk"] = getDisk()
- if conf['pretty'] == "Y":
- put(ns, json.dumps(dic, indent=4))
- else:
- put(ns, json.dumps(dic))
- else:
- put(ns, json.dumps({'error': "Unauthorized"}))
- try:
- ns.shutdown(socket.SHUT_RDWR)
- ns.close()
- except socket.error: pass
Add Comment
Please, Sign In to add comment