Guest User

Untitled

a guest
Oct 16th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. while True:
  2.     try:
  3.         readSocks = poller.poll()
  4.     except select.error:
  5.         continue
  6.  
  7.     for fheve in readSocks:
  8.         fh = fheve[0]
  9.         if fh == ms.fileno():
  10.             (ns, addr) = ms.accept()
  11.             if addr[0] in conf['white']:
  12.                 dic = {}
  13.                 #dic["hostname"]    = getHostname()
  14.                 dic["ps"]   = getPS()
  15.                 #dic["who"] = getWho()
  16.                 dic["uplo"] = getUptime()
  17.                 dic["ram"]  = getRAM()
  18.                 #dic["ips"] = getIPs()
  19.                 dic["disk"] = getDisk()
  20.                 if conf['pretty'] == "Y":
  21.                     put(ns, json.dumps(dic, indent=4))
  22.                 else:
  23.                     put(ns, json.dumps(dic))
  24.             else:
  25.                 put(ns, json.dumps({'error': "Unauthorized"}))
  26.             try:
  27.                 ns.shutdown(socket.SHUT_RDWR)
  28.                 ns.close()
  29.             except socket.error: pass
Add Comment
Please, Sign In to add comment