Pages

Adsense

Friday, January 6, 2012

Simplest way of setting up your own Spire proxy

How This Works

The way that this all works is quite simple. You will be using something called “SiriAuth”, which is basically your server. For this to work, you’ll need to grab the Siri authorization keys from a 4S which will need to be done every 24 hours. Beyond that, people can connect to the server through your IP address or, what’s more recommended, a DynDNS sort of solution (for example, FreeDNS). The DNS route takes your home IP address and masks it to a domain name for ease of use so that, should your home IP address change, the people with your URL will still be able to connect to it without worrying about IP address changes.










Requirements

    Experience with command-line options/Terminal - You’ll be running various commands. You must know what cd, sudo, ruby, etc. do.
    Linux – As mentioned above, you’ll need Linux, although you might be able to be used with Mac OS X, so please test this for us.
    Port 443 & 53 forwarded – This is to be done with your router. Click here for port forwarding information. Other ports can be used by modifying siriAuth.rb.
    An iPhone 4S – This is used to grab the Siri authorization keys. The person with the 4S doesn’t actually have to be near you. You can use any 4S over the Internet. These keys will need to be re-grabbed every 24 hours.
    A jailbroken iOS 5.0.1 device – This is used for Spire .
    Spire – Install this on the iOS 5.0.1 device that you want Siri to be used on.
    Up to an hour worth of time – Depending on your skill level and problems that you may run into, you’ll need maybe an hour of time.
    Patience – And the willingness to at least attempt to diagnose your own errors.

Downloads

SiriAuth -  The Siri server
AuthGrabber - The script that’s used to grab the Siri auth keys from a 4S, whether it be locally on your network or remotely

Get ready now to get into action! Follow the Step-By-Step guide below to create your own Siri Proxy Server!!
Step 1:

If you’re attempting to execute a .sh file, and Terminal is saying that the command is not found, then you’ll need to run the following:

sudo chmod +x [name_of_.sh_file]

After that, you should be able to run the .sh.
Step 2 : Getting the 4S Keys

Assuming you have an iPhone 4S, ports 53 & 443 forwarded, and Linux, all you have to do is run the follow command (after using cd to change the directory to where the AuthGrabber files are located)

./dependencies.sh

This will make sure that all of the other required bits of software are installed.

Next, you’ll need to generated the certificate file that has to be installed onto the iPhone 4S. To do this, run the following:

sudo ./certs.sh

Follow the on-screen prompts to generate your certificate. The information doesn’t have to be accurate, and can basically be whatever you want.

Note: This certificate is only required to be installed onto the device whenever the 4S auth keys are required. After they’re grabbed, you can remove the certificate, or just leave it installed as it causes no harm.

Next up, you’ll need to setup a small DNS server that’s used in Python. Refer to this link here. Copy and paste everything there into a blank plain-text file. Search for “555.555.555.555″. Replace this with the IP address of the machine (if you’re doing it locally), or your actually Internet IP address (if the 4S is remote). Save this file as “dns.py” to the same directory as the other AuthGrabber files.

To run the DNS server, run this command:

sudo python dns.py

After that, you should see something like this:

Fake DNS Server:: dom.query. 60 IN A 555.555.555.555

If you get an error that says an address is already in use, then run the following, and then try the Python command again. But, if this doesn’t work, then something else is using port 53, and you’ll need to figure out what process is using it:

sudo killall dnsmasq

Before you start the server, you’re going to need a few more files. Download the following ZIP file from here, and extract the two files within to your AuthGrabber directory.

While the server is running, open up a new Terminal window, change the directory back to the AuthGrabber folder, and run the following:

sudo ruby authGrabber.rb > OUTPUT.txt

This will start authGrabber.rb, and will output the grabbed keys into OUTPUT.txt. Both the DNS server and authGrabber server are running. On the 4S, you’ll need to change its Wi-Fi DNS to your IP address, whether it be local or remote. This can be done in Settings>Wi-Fi>[blue arrow for your Wi-Fi network]>DNS. Make sure to go back a menu and exit out of Settings for it to work.

Lastly, on the 4S, try and bring up Siri. As soon as this is done, you’ll see text fly by in your Terminal window. Open up OUTPUT.txt to see if anything is inside. If you see various keys and whatnot, then you’re done. You can now kill the DNS server by CTRL+C’ing the appropriate Terminal window.

If you need to grab the keys, just start the DNS server, start the authGrabber server, give the 4S your certificate, and give it your IP address for them to change their Wi-Fi DNS to.
Step 3 : Starting Your Siri Proxy Server

Starting the Siri proxy server is similar to starting the authGrabber server above.

After changing Terminal’s directory to the SiriAuth folder, run the following command:

./dependencies.sh

This makes sure that all the required bits of software are all installed.

Next, you’ll need to generated the certificate file that has to be installed onto the jailbroken Spire device. To do this, run the following:

sudo ./certs.sh

Follow the on-screen prompts to generate your certificate. The information doesn’t have to be accurate, and can basically be whatever you want. The only part that needs real information is when it asks you for the IP address of your server, whether it be a local IP, your Internet IP, or a URL of a DynDNS sort of thing.

Note: This certificate is required to use Siri, and will not work if it’s removed.

Next, you’ll need to edit siriAuth.rb with the keys that were grabbed earlier. Open the file with a text editor (most likely gedit), as well as the OUTPUT.txt file that was made earlier. There are 4 things that need to be copied:

    XAceHostKey
    ValidationDataKey (the large batch of data)
    AssistantIDKey
    SpeechIDKey

From OUTPUT.txt, copy the appropriate key into siriAuth.key. The place to copy them to is near the beginning of the file. Make sure to copy the key between the quotes, and paste them between the quotes, respectively. Save the file when done.

To start the server (the fun part), simply run the following:

sudo ruby start.rb

It’ll say the following if the server has been successfully started:

Server started
Selected X-Ace Host: [redacted]
Selected assistantId: [redacted]
Selected speechId: [redacted]
Selected ValidationData: [redacted]

Step 4 : Setting Up Spire

This part is simple.

Go into Settings, and then Spire. In the box, enter in the URL or IP address of your server, after http://. You may need to add https:// for it to work.  After it’s set, go back to the main menu in Settings, and go to General > Siri. Make sure that you turn it on. After it’s been turned on, respring your device.

Test to see that this is working by bringing up Siri (or Siri’s dictation feature). If it is, you’ll see a lot of text scrolling through the Terminal window for siriAuth.

You are Done!!!

That’s all there is to do! If everything went correctly, your server should be working!

No comments:

Post a Comment