Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Dev branch merge

-Adding support for running as an alternate user (makes things more secure -- experimental)
-Adding support for alternate DNS servers (defaults to Google's DNS); this should solve lots of problems
-Fixed some messaging to make it less scary
  • Loading branch information...
commit 2b313e4496d1211be123eb1f28dd96b5523945bc 1 parent 9c7ca9d
Pete authored
2  README.md
View
@@ -48,7 +48,7 @@ The commands used in the video can be found at [https://gist.github.com/1428474]
**Set up DNS**
-Before you can use SiriProxy, you must set up a DNS server on your network to forward requests for guzzoni.apple.com to the computer running the proxy (make sure that computer is not using your DNS server!). I recommend dnsmasq for this purpose. It's easy to get running and can easily handle this sort of behavior. ([http://www.youtube.com/watch?v=a9gO4L0U59s](http://www.youtube.com/watch?v=a9gO4L0U59s))
+Before you can use SiriProxy, you must set up a DNS server on your network to forward requests for guzzoni.apple.com to the computer running the proxy (siriproxy uses Google's public DNS servers to resolve guzzoni.apple.com, so it may use your forwarding DNS server). I recommend dnsmasq for this purpose. It's easy to get running and can easily handle this sort of behavior. ([http://www.youtube.com/watch?v=a9gO4L0U59s](http://www.youtube.com/watch?v=a9gO4L0U59s))
**Set up RVM and Ruby 1.9.3**
6 lib/siriproxy.rb
View
@@ -17,8 +17,8 @@ def initialize()
begin
listen_addr = $APP_CONFIG.listen || "0.0.0.0"
puts "Starting SiriProxy on #{listen_addr}:#{$APP_CONFIG.port}.."
- EventMachine::start_server(listen_addr, $APP_CONFIG.port, SiriProxy::Connection::Iphone) { |conn|
- $stderr.puts "start conn #{conn.inspect}"
+ EventMachine::start_server(listen_addr, $APP_CONFIG.port, SiriProxy::Connection::Iphone, $APP_CONFIG.upstream_dns) { |conn|
+ puts "[Info - Guzzoni] Starting conneciton #{conn.inspect}" if $LOG_LEVEL < 1
conn.plugin_manager = SiriProxy::PluginManager.new()
conn.plugin_manager.iphone_conn = conn
}
@@ -30,6 +30,8 @@ def initialize()
raise
end
end
+
+ EventMachine.set_effective_user($APP_CONFIG.user) if $APP_CONFIG.user
end
end
end
10 lib/siriproxy/command_line.rb
View
@@ -141,6 +141,10 @@ def usage
def parse_options
$APP_CONFIG = OpenStruct.new(YAML.load_file(File.expand_path('~/.siriproxy/config.yml')))
+
+ # Google Public DNS servers
+ $APP_CONFIG.upstream_dns ||= %w[8.8.8.8 8.8.4.4]
+
@branch = nil
@option_parser = OptionParser.new do |opts|
opts.on('-L', '--listen ADDRESS', '[server] address to listen on (central or node)') do |listen|
@@ -152,6 +156,12 @@ def parse_options
opts.on('-l', '--log LOG_LEVEL', '[server] The level of debug information displayed (higher is more)') do |log_level|
$APP_CONFIG.log_level = log_level
end
+ opts.on( '--upstream-dns SERVERS', Array, '[server] List of upstream DNS servers to query for the real guzzoni.apple.com. Defaults to Google DNS servers') do |servers|
+ $APP_CONFIG.upstream_dns = servers
+ end
+ opts.on('-u', '--user USER', '[server] The user to run as after launch') do |user|
+ $APP_CONFIG.user = user
+ end
opts.on('-b', '--branch BRANCH', '[update] Choose the branch to update from (default: master)') do |branch|
@branch = branch
end
25 lib/siriproxy/connection/iphone.rb
View
@@ -1,11 +1,14 @@
+require 'resolv'
+
#####
# This is the connection to the iPhone
#####
class SiriProxy::Connection::Iphone < SiriProxy::Connection
- def initialize
+ def initialize upstream_dns
puts "Create server for iPhone connection"
- super
+ super()
self.name = "iPhone"
+ @upstream_dns = upstream_dns
end
def post_init
@@ -15,9 +18,25 @@ def post_init
:verify_peer => false)
end
+ # Resolves guzzoni.apple.com using the Google DNS servers. This allows the
+ # machine running siriproxy to use the DNS server returning fake records for
+ # guzzoni.apple.com.
+
+ def resolve_guzzoni
+ addresses = Resolv::DNS.open(nameserver: @upstream_dns) do |dns|
+ res = dns.getresources('guzzoni.apple.com', Resolv::DNS::Resource::IN::A)
+
+ res.map { |r| r.address }
+ end
+
+ addresses.map do |address|
+ address.address.unpack('C*').join('.')
+ end.sample
+ end
+
def ssl_handshake_completed
super
- self.other_connection = EventMachine.connect('guzzoni.apple.com', 443, SiriProxy::Connection::Guzzoni)
+ self.other_connection = EventMachine.connect(resolve_guzzoni, 443, SiriProxy::Connection::Guzzoni)
self.plugin_manager.guzzoni_conn = self.other_connection
other_connection.other_connection = self #hehe
other_connection.plugin_manager = plugin_manager
Please sign in to comment.
Something went wrong with that request. Please try again.