Beispiel #1
0
  def run(self):

    self.pword = self.get_pass()

    socket = SocketThread(self)
    socket.connect()
    socket.start()

    time.sleep(1)
    print ''
    BufferThread(self).start()

    try:
      while not self.event_close.is_set():
        time.sleep(0.1)
    except (KeyboardInterrupt,SystemExit):
      pass
    except BaseException:
      print traceback.format_exc(e)

    self.event_close.set()
    if socket.is_alive():
      socket.join()
Beispiel #2
0
  def run(self):

    self.pword = self.get_pass()

    socket = SocketThread(self)
    socket.connect()
    socket.start()

    time.sleep(1)
    print('')
    BufferThread(self).start()

    try:
      while not self.event_close.is_set():
        time.sleep(0.1)
    except (KeyboardInterrupt,SystemExit):
      pass
    except BaseException:
      print(traceback.format_exc())

    self.event_close.set()
    if socket.is_alive():
      socket.join()
Beispiel #3
0
  def run(self):

    socket = SocketThread(self)
    socket.connect()
    socket.start()

    cmd = self.args.execute or sys.stdin.read()
    self.send_queue.put(cmd)
    self.send_queue.put('echo '+self.delim)
    start = time.time()

    try:
      while (not self.response
          or self.delim not in [x[1] for x in self.response]):
        if time.time()-start>self.args.timeout:
          raise TimeoutError
        time.sleep(0.1)
    except TimeoutError:
      self.error('Timed out waiting for response.')
    except KeyboardInterrupt:
      pass
    except BaseException as e:
      print traceback.format_exc(e)

    self.event_close.set()
    if socket.is_alive():
      socket.join()

    for (err,s) in self.response:
      if err:
        sys.stderr.write(s+'\n')
        sys.stderr.flush()
      elif s!=self.delim:
        print s

    if self.errors:
      sys.exit(1)
Beispiel #4
0
  def run(self):

    socket = SocketThread(self)
    socket.connect()
    socket.start()

    cmd = self.args.execute or sys.stdin.read()
    self.send_queue.put(cmd)
    self.send_queue.put('echo '+self.delim)
    start = time.time()

    try:
      while (not self.response
          or self.delim not in [x[1] for x in self.response]):
        if time.time()-start>self.args.timeout:
          raise TimeoutError
        time.sleep(0.1)
    except TimeoutError:
      self.error('Timed out waiting for response.')
    except KeyboardInterrupt:
      pass
    except BaseException as e:
      print(traceback.format_exc(e))

    self.event_close.set()
    if socket.is_alive():
      socket.join()

    for (err,s) in self.response:
      if err:
        sys.stderr.write(s+'\n')
        sys.stderr.flush()
      elif s!=self.delim:
        print(s)

    if self.errors:
      sys.exit(1)