Skip to content
Snippets Groups Projects
  1. Jun 01, 2014
  2. May 31, 2014
    • Damian Johnson's avatar
      Adding tarfile support to stem.descriptor.parse_file() · a5596873
      Damian Johnson authored
      A while back Karsten tried to hand a tarfile to our parse_file() method and had
      confusing results...
      
        https://trac.torproject.org/projects/tor/ticket/10977
      
      Expanding our parse_file() function so it'll happily handle tarfiles and tar
      paths.
      
      Note that the DescriptorReader, which already had tar support, is keeping its
      own separate implementation. This is because using the parse_file()'s tar
      support has a couple drawbacks...
      
        1. The reader then couldn't stop in the middle of handling tarballs.
      
        2. If a tarball contains both descriptor and non-descriptor content then the
           DescriptorReader can handle that. parse_file(), however, raises an
           exception.
      a5596873
    • Damian Johnson's avatar
      Added missing versionadded tags · bbaa4c85
      Damian Johnson authored
      We were missing a handful of versionadded tags for things being added in 1.2.0.
      bbaa4c85
    • Damian Johnson's avatar
      Close stdout/stderr after the tor process initializes · fcf49ad8
      Damian Johnson authored
      We use tor's stdout and stderr to determine two things...
      
        * at what stage it has bootstrapped to
        * errors if tor fails to start
      
      After startup, however, we stop listing to stdout which can cause Tor to lock
      up if it's registering a lot of NOTICE level messages...
      
        https://trac.torproject.org/projects/tor/ticket/9862
      
      Tested by the following script. Before this fix tor hung after ~3 seconds. With
      it things happily chug along...
      
        import time
      
        import stem.process
      
        from stem.control import EventType, Controller
      
        tor_process = stem.process.launch_tor_with_config(
          config = {
            'ControlPort': '9051',
            'Log': 'DEBUG stdout',
          },
          take_ownership = True,
        )
      
        with Controller.from_port() as controller:
          controller.authenticate()
      
          def heartbeat(event):
            print "%s - %s / %s" % (time.time(), event.read, event.written)
      
          controller.add_event_listener(heartbeat, EventType.BW)
      
          print "Press any key to quit..."
          raw_input()
      fcf49ad8
    • Damian Johnson's avatar
      Vending the test_tools and tor_tools utility modules · 29f2a1cd
      Damian Johnson authored
      On reflection both are very well written and tested. I've found these useful in
      my projects and there's little reason so keep 'em to ourselves so sharing the
      wealth.
      29f2a1cd
  3. May 29, 2014
  4. May 28, 2014
  5. May 27, 2014
  6. May 26, 2014
  7. May 25, 2014
    • Damian Johnson's avatar
      Expanding /info output · cec8c1f0
      Damian Johnson authored
      Greatly enriching our /info output to include all relay information the user is
      likely to find helpful. This revises the summary a bit, but more importantly
      now includes the relay's hostname and all descriptor content (server,
      extrainfo, microdescriptor, and router status entry).
      
      Fetching both the hostname and descriptor content involves active lookups, but
      while this was a no-go for arm it's perfectly fine for an interactive
      interpreter like this.
      cec8c1f0
    • Damian Johnson's avatar
      Fix interaction of color prompt with readline · d699f816
      Damian Johnson authored
      For a long while we've had an issue where readline history would break with
      long inputs. For instance, entering...
      
        >>> the quick brown fox jumped over the very nice fence and ran around in pretty fields
      
      ... then pressing 'up' to autocomplete history then 'down' to go back to an
      empty prompt would leave a fragment of this mingled with the prompt.
      
      This turned out to be an issue with how readline calculates column width.
      Readline included the formatting sequences when determining our prompts width,
      which can be corrected by wrapping all encodings with RL_PROMPT_START_IGNORE
      and RL_PROMPT_END_IGNORE sequences...
      
        https://stackoverflow.com/questions/9468435/look-how-to-fix-column-calculation-in-python-readline-if-use-color-prompt
      
      Many thanks to Yawning for pointing this out!
      d699f816
    • Damian Johnson's avatar
      Changing prompt's events builtin to be a function · 00903e75
      Damian Johnson authored
      Changing 'events' from being a variable to a function. Presently this provides
      a single optional argument to filter the event types it returns (a very, very
      common thing to want). This also makes it easier for us to expand in the future
      as more use cases crop up.
      00903e75
  8. May 24, 2014
    • Damian Johnson's avatar
      Correcting setup.py for tor-prompt · fb2734b0
      Damian Johnson authored
      Patch from Yawning that corrects two things...
      
      * Doesn't hardcode tor-prompt to install to /usr/bin so the user can customize it.
      * Installs the prompt's settings.cfg (without which it won't run).
      fb2734b0
    • Damian Johnson's avatar
      'Down the Rabbit Hole' tutorial · b4da7f83
      Damian Johnson authored
      Adding a tutorial for our new interpreter, giving an overview of both how to
      run it and what it can do. Think this might be my favorite tutorial yet...
      b4da7f83
    • Damian Johnson's avatar
      Supporting '/events clear' · 732ecff7
      Damian Johnson authored
      Adding a command to clear the backlog of events we've received.
      732ecff7
  9. May 23, 2014
  10. May 12, 2014
    • Damian Johnson's avatar
      Only doing raw controller requests via the prompt · 32b9f758
      Damian Johnson authored
      I was using our Controller's high level methods (get_info(), get_conf(),
      add_event_listeners()) for a couple reasons. First they provide caching and
      second because they yeild more succinct output. But on refection those are both
      terrible reasons. Caching is worthless with such a low call volume, and it's
      actually *better* if we print raw Tor responses. This is supposed to provide
      raw controller accesss, right? :)
      
      If users want the behavior of the high level methods then they can now call
      those easy enough.
      32b9f758
  11. May 11, 2014
    • Damian Johnson's avatar
      Providing an option to disable colorized prompt output · 87aecce5
      Damian Johnson authored
      Not everyone will probably want highly colorized output so providing an option
      to disable it.
      
      I dislike this approach of using a global in the stem.util.term module. I'm
      explicitely not vending this to others since I'm sure there's a more graceful
      way of toggling this.
      87aecce5
    • Damian Johnson's avatar
      Colorizing header banner · 1e56973e
      Damian Johnson authored
      Colorizing our prompt's initial output, with bolding to better emphasize the
      examples.
      1e56973e
    • Damian Johnson's avatar
      Integrating python prompt into interpretor · 51160196
      Damian Johnson authored
      Our prompt provided two modes: a python prompt or raw controller prompt. But
      why not combine the two?
      
      We now provide a python interpretor (like IDLE), but with the following...
      
      * A connection to Tor is available via our 'controller' variable.
      
      * Events we've received via SETEVENTS is available via our 'events' variable.
      
      * Controller commands we recognized are passed directly to Tor (like our prior
        prompt).
      
      * Python support can be toggled via '/python'. If it's disabled this is
        effectively our prior prompt.
      
      * Starting tor without prompting if it isn't running. Tor only takes a fraction
        of a second to bootstrap to a state we can use, so asking the user is more of
        a hassle than help.
      51160196
    • Damian Johnson's avatar
      Standardizing single vs double quotes · 3650c608
      Damian Johnson authored
      PEP8 doesn't have any advice on when to opt for one quote type or the other, so
      I'm settling on the following:
      
        Single quotes unless it's either block quotes (""") or has single quotes in
        the content ("he said 'hello'").
      3650c608
    • Damian Johnson's avatar
      Revising prompt --help output · 7f63b5a5
      Damian Johnson authored
      Just a few minor tweaks. Dropping the examples from the end since we have
      better example usage earlier now.
      7f63b5a5
    • Damian Johnson's avatar
      Dropping the old prompt · 29e7524d
      Damian Johnson authored
      Our new prompt does everything the old one does and much more. Dropping the old
      prompt command.
      29e7524d
    • Damian Johnson's avatar
      Offer to start tor when running prompt · 8c3ada01
      Damian Johnson authored
      If tor isn't running then offering to start an instance for our prompt to
      connect to. This only lasts for the duration of the interpretor session.
      8c3ada01
  12. May 10, 2014
    • Damian Johnson's avatar
      Python interpretor when running the prompt · dcf08521
      Damian Johnson authored
      Support for providing the user with a python interpretor when they include the
      '--python' argument. This is what our old 'prompt' command once provided, and
      is handy when you'd like to get a quick and easy Controller to interact with.
      dcf08521
  13. May 07, 2014
  14. May 06, 2014
Loading