예제 #1
0
파일: torsh.py 프로젝트: chiiph/TorSH
  def do_save_conf(self, line):
    """
      Issues a SAVECONF.

      Usage:
        save_conf
    """

    try:
      print(formatter.format_reply(self._connection.save_conf()))
    except Exception as e:
      print(e)
예제 #2
0
파일: torsh.py 프로젝트: chiiph/TorSH
  def do_reset_options(self, keys):
    """
      Issues a RESETCONF for the given keys.

      Usage:
        reset_conf key1 key2
    """

    try:
      output = self._connection.reset_options(keys.split(" "))
      print(formatter.format_reply(output[0]))
    except Exception as e:
      print(e[0])
예제 #3
0
파일: torsh.py 프로젝트: chiiph/TorSH
  def do_signal(self, line):
    """
      Sends a signal to Tor.

      Usage:
        signal HUP
        signal INT
    """

    try:
      if len(line.strip()) > 0:
        print(formatter.format_reply(self._connection.send_signal(line.strip().split(" ")[0])))
    except Exception as e:
      print(e)
예제 #4
0
파일: torsh.py 프로젝트: chiiph/TorSH
  def do_map_address(self, kvlist):
    """
      Issues a MAPADRRES with the give kvlist.

      Usage:
        map_address 0.0.0.0=torproject.org 1.2.3.4=tor.freehaven.net
    """

    try:
      if len(kvlist.strip()) > 0:
        kvs = kvlist.split(" ")
        final = []
        for kv in kvs:
          tup = kv.split("=")
          final.append((tup[0], tup[1]))
        print(formatter.format_reply(self._connection.map_address(final)[0]))
    except Exception as e:
      print(e)
예제 #5
0
파일: torsh.py 프로젝트: chiiph/TorSH
  def do_set_options(self, keyvalues):
    """
      Issues a SETCONF command.

      Usage:
        set_options key1=val1 key2=val2 ...
    """

    keyvalue_list = keyvalues.split(" ")
    final_list = []
    for keyvalue in keyvalue_list:
      pair = keyvalue.split("=")
      final_list.append((pair[0], pair[1]))

    try:
      output = self._connection.set_options(final_list)
      print(formatter.format_reply(output[0]))
    except Exception as e:
      print(e[0])