siriproxy 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +7 -29
 - data/lib/siriproxy.rb +1 -1
 - data/lib/siriproxy/connection.rb +5 -0
 - data/lib/siriproxy/dns.rb +1 -1
 - data/lib/siriproxy/interpret_siri.rb +1 -1
 - data/lib/siriproxy/plugin_manager.rb +2 -2
 - data/lib/siriproxy/version.rb +1 -1
 - data/siriproxy.gemspec +1 -1
 - metadata +6 -6
 
    
        data/README.md
    CHANGED
    
    | 
         @@ -58,6 +58,7 @@ If you don't already have Ruby 2.0.0 (or at least 1.9.3) installed through RVM, 
     | 
|
| 
       58 
58 
     | 
    
         
             
            		`echo 'export PATH=$HOME/.rvm/bin:$PATH' >> ~/.bashrc`  
         
     | 
| 
       59 
59 
     | 
    
         
             
            	* Activate changes:  
         
     | 
| 
       60 
60 
     | 
    
         
             
            		`. ~/.bashrc`   
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
       61 
62 
     | 
    
         
             
            3. Install Ruby 2.0.0 (if you don't have it already):   
         
     | 
| 
       62 
63 
     | 
    
         | 
| 
       63 
64 
     | 
    
         
             
            	`rvm install 2.0.0`  
         
     | 
| 
         @@ -91,7 +92,7 @@ If you don't already have Ruby 2.0.0 (or at least 1.9.3) installed through RVM, 
     | 
|
| 
       91 
92 
     | 
    
         
             
            FAQ
         
     | 
| 
       92 
93 
     | 
    
         
             
            ---
         
     | 
| 
       93 
94 
     | 
    
         | 
| 
       94 
     | 
    
         
            -
            **Will this let me run Siri on my iPhone 4, iPod Touch, iPhone 3G, Microwave, etc?**
         
     | 
| 
      
 95 
     | 
    
         
            +
            **Will this let me run Siri on my none Siri devices (eg. iPhone 4, iPod Touch, iPhone 3G, Microwave, etc)?**
         
     | 
| 
       95 
96 
     | 
    
         | 
| 
       96 
97 
     | 
    
         
             
            No. Please stop asking. 
         
     | 
| 
       97 
98 
     | 
    
         | 
| 
         @@ -119,7 +120,7 @@ No. Don't even ask. 
     | 
|
| 
       119 
120 
     | 
    
         | 
| 
       120 
121 
     | 
    
         
             
            **I'm getting a bunch of "[Info - Guzzoni] Object: SessionValidationFailed" messages. What's wrong?!**
         
     | 
| 
       121 
122 
     | 
    
         | 
| 
       122 
     | 
    
         
            -
            You're probably  
     | 
| 
      
 123 
     | 
    
         
            +
            You're probably using a device without an official Siri. You need to be using an official Siri device (or have a UDID you can sub in) in order to make use of SiriProxy. Sorry, this is not designed to be a way around that limitation. (Thanks to [@brownie545](http://www.twitter.com/brownie545) for providing information on what happens when you use a unofficial Siri-devices)
         
     | 
| 
       123 
124 
     | 
    
         | 
| 
       124 
125 
     | 
    
         
             
            **How do I remove the certificate from my iPhone when I'm done?**
         
     | 
| 
       125 
126 
     | 
    
         | 
| 
         @@ -151,36 +152,13 @@ Your network setup may be different. This is THE most complex part of setting up 
     | 
|
| 
       151 
152 
     | 
    
         
             
            Running SiriProxy as an unprivileged user
         
     | 
| 
       152 
153 
     | 
    
         
             
            -----------------------------------------
         
     | 
| 
       153 
154 
     | 
    
         | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
            The only trick is that Siri expects the server to be running on port 443, and only privileged users can open ports below 1024 on *NIX operating systems. So I work around this by running SiriProxy on port 2000 and redirecting traffic to that port using iptables.
         
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
       158 
     | 
    
         
            -
            **Step 1: Set up an account**
         
     | 
| 
       159 
     | 
    
         
            -
             
     | 
| 
       160 
     | 
    
         
            -
            I just set up an account called "siriproxy". I made sure it wasn't a "sudoer" (on my computer, that means keep it out of the "sudo" group). I also think it's a good idea to refrain from giving it login privileges. But do as I say on that one, not as I do.
         
     | 
| 
       161 
     | 
    
         
            -
             
     | 
| 
       162 
     | 
    
         
            -
            **Step 2: Set up iptables/ufw**
         
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
       164 
     | 
    
         
            -
            I run UFW on my machine, which is pretty much a wrapper on iptables. I tossed in the following at the top of my `/etc/ufw/before.rules`:
         
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
            	*nat
         
     | 
| 
       167 
     | 
    
         
            -
            	:PREROUTING ACCEPT [0:0]
         
     | 
| 
       168 
     | 
    
         
            -
            	-A PREROUTING --dst 10.0.0.3 -p tcp --dport 443 -j REDIRECT --to-port 2000
         
     | 
| 
       169 
     | 
    
         
            -
            	COMMIT
         
     | 
| 
       170 
     | 
    
         
            -
             
     | 
| 
       171 
     | 
    
         
            -
            The IP referenced (10.0.0.3) is the IP of the computer running SiriProxy. Since this computer is being used as a wireless AP, it's important to only redirect traffic targeted directly at the server, otherwise all traffic to 443/tcp on my wifi network would be incorrectly redirected.
         
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
            I also made sure to open up 2000/tcp to allow traffic:
         
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
                sudo ufw allow 2000/tcp
         
     | 
| 
       176 
     | 
    
         
            -
                
         
     | 
| 
       177 
     | 
    
         
            -
            **Step 3: Set up upstart script**
         
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
            The full explanation of this is shown below. It's a handy thing to do by itself. It allows me to have SiriProxy start on boot and also allows me to easily control it using commands like `start siriproxy` and `stop siriproxy`.
         
     | 
| 
      
 155 
     | 
    
         
            +
            This used to be really hard. Now it's very easy. Just run `rvmsudo siriproxy server -u USER` and SiriProxy will set it's userid to `USER`'s userid.
         
     | 
| 
       180 
156 
     | 
    
         | 
| 
       181 
157 
     | 
    
         
             
            Running SiriProxy via Upstart
         
     | 
| 
       182 
158 
     | 
    
         
             
            -----------------------------
         
     | 
| 
       183 
159 
     | 
    
         | 
| 
      
 160 
     | 
    
         
            +
            **NOTE: This section needs to be updated.** It was written before some of the newer features for SiriProxy. It should be much simpler now.
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
       184 
162 
     | 
    
         
             
            Here's the upstart script I created for my home SiriProxy server. It respawns on a crash because SiriProxy is delicate and likes to crash. My server is running BackTrack 5 (a derivative of Ubuntu 10.04, I believe) and I use it as my wireless access point, making it an obvious location for SiriProxy:
         
     | 
| 
       185 
163 
     | 
    
         | 
| 
       186 
164 
     | 
    
         
             
            	description	"SiriProxy server"
         
     | 
| 
         @@ -193,7 +171,7 @@ Here's the upstart script I created for my home SiriProxy server. It respawns on 
     | 
|
| 
       193 
171 
     | 
    
         | 
| 
       194 
172 
     | 
    
         
             
            	respawn
         
     | 
| 
       195 
173 
     | 
    
         | 
| 
       196 
     | 
    
         
            -
            	exec start-stop-daemon --start -- 
     | 
| 
      
 174 
     | 
    
         
            +
            	exec start-stop-daemon --start --exec /home/siriproxy/src/SiriProxy/siriproxy2000.sh
         
     | 
| 
       197 
175 
     | 
    
         | 
| 
       198 
176 
     | 
    
         
             
            Here are the contents of `siriproxy2000.sh` (as referenced above):
         
     | 
| 
       199 
177 
     | 
    
         | 
    
        data/lib/siriproxy.rb
    CHANGED
    
    | 
         @@ -33,7 +33,7 @@ class SiriProxy 
     | 
|
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                    retries = 0
         
     | 
| 
       35 
35 
     | 
    
         
             
                    while $APP_CONFIG.server_ip && !$SP_DNS_STARTED && retries <= 5
         
     | 
| 
       36 
     | 
    
         
            -
                      puts "[Info - Server] DNS server is not running yet, waiting #{2**retries} second#{'s' if retries >  
     | 
| 
      
 36 
     | 
    
         
            +
                      puts "[Info - Server] DNS server is not running yet, waiting #{2**retries} second#{'s' if retries > 1}..."
         
     | 
| 
       37 
37 
     | 
    
         
             
                      sleep 2**retries
         
     | 
| 
       38 
38 
     | 
    
         
             
                      retries += 1
         
     | 
| 
       39 
39 
     | 
    
         
             
                    end
         
     | 
    
        data/lib/siriproxy/connection.rb
    CHANGED
    
    | 
         @@ -175,6 +175,11 @@ class SiriProxy::Connection < EventMachine::Connection 
     | 
|
| 
       175 
175 
     | 
    
         
             
              end
         
     | 
| 
       176 
176 
     | 
    
         | 
| 
       177 
177 
     | 
    
         
             
              def prep_received_object(object)
         
     | 
| 
      
 178 
     | 
    
         
            +
                #workaround for #143
         
     | 
| 
      
 179 
     | 
    
         
            +
                if object["class"] == "FinishSpeech" or object["class"] == "SpeechRecognized"
         
     | 
| 
      
 180 
     | 
    
         
            +
                  @block_rest_of_session = false
         
     | 
| 
      
 181 
     | 
    
         
            +
                end
         
     | 
| 
      
 182 
     | 
    
         
            +
                
         
     | 
| 
       178 
183 
     | 
    
         
             
                if object["refId"] == self.last_ref_id && @block_rest_of_session
         
     | 
| 
       179 
184 
     | 
    
         
             
                  puts "[Info - Dropping Object from Guzzoni] #{object["class"]}" if $LOG_LEVEL > 1
         
     | 
| 
       180 
185 
     | 
    
         
             
                  pp object if $LOG_LEVEL > 3
         
     | 
    
        data/lib/siriproxy/dns.rb
    CHANGED
    
    | 
         @@ -53,7 +53,7 @@ class SiriProxy::Dns 
     | 
|
| 
       53 
53 
     | 
    
         
             
                  RubyDNS::run_server(:listen => @interfaces) do
         
     | 
| 
       54 
54 
     | 
    
         
             
                    @logger.level = log_level
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
                    match(/guzzoni.apple.com/, Resolv::DNS::Resource::IN::A) do | 
     | 
| 
      
 56 
     | 
    
         
            +
                    match(/guzzoni.apple.com/, Resolv::DNS::Resource::IN::A) do |transaction|
         
     | 
| 
       57 
57 
     | 
    
         
             
                      transaction.respond!(server_ip)
         
     | 
| 
       58 
58 
     | 
    
         
             
                    end
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
         @@ -25,9 +25,9 @@ class SiriProxy::PluginManager < Cora 
     | 
|
| 
       25 
25 
     | 
    
         
             
                        plugin.plugin_name = className
         
     | 
| 
       26 
26 
     | 
    
         
             
                        plugin.manager = self
         
     | 
| 
       27 
27 
     | 
    
         
             
                        @plugins << plugin
         
     | 
| 
       28 
     | 
    
         
            -
                      rescue
         
     | 
| 
      
 28 
     | 
    
         
            +
                      rescue Exception=>e
         
     | 
| 
       29 
29 
     | 
    
         
             
                        if pluginConfig['name']
         
     | 
| 
       30 
     | 
    
         
            -
                          puts "[Error] Failed to load plugin: #{pluginConfig['name']}"
         
     | 
| 
      
 30 
     | 
    
         
            +
                          puts "[Error] Failed to load plugin: #{pluginConfig['name']} reason: #{e.message}"
         
     | 
| 
       31 
31 
     | 
    
         
             
                        else
         
     | 
| 
       32 
32 
     | 
    
         
             
                          puts "[Error] Failed to load a plugin that has no name, check your config.yml"
         
     | 
| 
       33 
33 
     | 
    
         
             
                        end 
         
     | 
    
        data/lib/siriproxy/version.rb
    CHANGED
    
    
    
        data/siriproxy.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: siriproxy
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.4
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -11,7 +11,7 @@ authors: 
     | 
|
| 
       11 
11 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       13 
13 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       14 
     | 
    
         
            -
            date: 2013- 
     | 
| 
      
 14 
     | 
    
         
            +
            date: 2013-04-18 00:00:00.000000000 Z
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies:
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       17 
17 
     | 
    
         
             
              name: CFPropertyList
         
     | 
| 
         @@ -114,17 +114,17 @@ dependencies: 
     | 
|
| 
       114 
114 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       115 
115 
     | 
    
         
             
                none: false
         
     | 
| 
       116 
116 
     | 
    
         
             
                requirements:
         
     | 
| 
       117 
     | 
    
         
            -
                - -  
     | 
| 
      
 117 
     | 
    
         
            +
                - - ~>
         
     | 
| 
       118 
118 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       119 
     | 
    
         
            -
                    version:  
     | 
| 
      
 119 
     | 
    
         
            +
                    version: 0.6.0
         
     | 
| 
       120 
120 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       121 
121 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       122 
122 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       123 
123 
     | 
    
         
             
                none: false
         
     | 
| 
       124 
124 
     | 
    
         
             
                requirements:
         
     | 
| 
       125 
     | 
    
         
            -
                - -  
     | 
| 
      
 125 
     | 
    
         
            +
                - - ~>
         
     | 
| 
       126 
126 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       127 
     | 
    
         
            -
                    version:  
     | 
| 
      
 127 
     | 
    
         
            +
                    version: 0.6.0
         
     | 
| 
       128 
128 
     | 
    
         
             
            description: Siri Proxy is a proxy server for Apple's Siri "assistant." The idea is
         
     | 
| 
       129 
129 
     | 
    
         
             
              to allow for the creation of custom handlers for different actions. This can allow
         
     | 
| 
       130 
130 
     | 
    
         
             
              developers to easily add functionality to Siri.
         
     |