Skip to content

Installation (Version 1.0.x)

Robin Meis edited this page Jan 26, 2015 · 6 revisions

This version is not iOS8 compatible. You can find a iOS8 compatible version here: https://github.com/HcDevel/SiriAPI8


Attention: SiriAPI does not work on iOS 8


Siri-API is a tool which opens Siri for your own wishes WITHOUT the requirement of a Jailbreak. Basically it is like GoogolPlex but it is much more flexible since you can host it on your own computer. You need a Linux running computer (i.e. Raspberry Pi) and a Squid Proxy version compiled with SSL support. These versions aren't available from official package sources, so you have to compile it by yourself. You can follow the instructions below. You can watch the demo video on YouTube to see what is possible with Siri-API. I use the program for my home automation system but any other usage is possible. You just have to write your own rules and commands in Python 3. With the easy to use API it is just a game. I also provide a working squid.conf configuration file for usage with the API. If you're already running Squid Proxy for other services you HAVE to change it so, that Squid still works in your environment. I tested Siri-API on an iPhone 5S with iOS 7 but it should also work with other iDevices supporting Siri and older iOS versions.

###System requirements

  • Linux PC (i.e. Raspberry Pi), also might work on Windows or Mac OS but I never tried
  • Squid Proxy with SSL support (see instructions below)
  • Python3 interpreter to run the API's server (see instructions below)

##Installation of Squid Proxy Since you will need to compile Squid Proxy on your own, you need to install the following packages. On Debian (based) systems you can use the following commands:

sudo apt-get install build-essential
sudo apt-get install libssl-dev

After that you need to install Squid Proxy. You can download the latest version from http://www.squid-cache.org/Versions/. I suggest to use Version 3.4.4 because I've done my sample setup with it. If you use another version you might have to change the configuration file. If you got it running with another version (with and without modifying the sample configuration file), please inform me by open an Issue on GitHub (https://github.com/HcDevel/Siri-API/issues). Then I will add this version of Squid to the supported versions. In the following instructions I emanate you have downloaded version 3.4.4. If not, you have to change the paths in the instructions. This isn't too complicated.

  1. Download Squid (I would suggest to do this in your home directory)
    wget http://www.squid-cache.org/Versions/v3/3.4/squid-3.4.4.tar.gz

  2. Extract Squid at the same place
    tar -xvzf squid-3.4.4.tar.gz

  3. Change into the extracted directory of squid
    cd squid-3.4.4/

  4. Compile Squid. Just copy the commands, they are ready to compile Squid with SSL support. Compiling might take a long time. On my Raspberry Pi it took about 5 hours
    sudo ./configure --prefix=/usr/local/squid --enable-icap-client --enable-ssl --enable-ssl-crtd --with-default-user=squid
    sudo make all
    sudo make install

  5. Create permissions. We compiled squid with default user squid, so we have to add the required user and permissions
    sudo useradd squid
    sudo chown -R squid:squid /usr/local/squid/var/logs/

  6. Now you should create the swap directories. This can be done by running
    sudo /usr/local/squid/sbin/squid -z

  7. Next you have to generate the SSL certificate. I won't explain every command, so just copy it!
    cd /usr/local/squid
    sudo mkdir ssl_cert
    cd ssl_cert
    sudo openssl req -new -newkey rsa:1024 -days 3065 -nodes -x509 -keyout siri-api.pem -out siri-api.pem
    sudo chown -R squid:squid /usr/local/squid/ssl_cert

  8. To continue, you need to download the Siri-API files. I suggest to change to the home directory and doing the following
    If git is not installed run: sudo apt-get install git (Again, apt only works on Debian based systems)
    git clone https://github.com/HcDevel/Siri-API
    cd Siri-API
    sudo mv /usr/local/squid/etc/squid.conf /usr/local/squid/etc/squid.conf-before-siri-api #Make a backup of the original config file
    sudo cp squid.conf /usr/local/squid/etc/squid.conf
    sudo nano /usr/local/squid/etc/squid.conf # Change configuration parts with comments to match with your network

  9. Enable IP forwarding
    sudo echo "1" > /proc/sys/net/ipv4/ip_forward

  10. Modifiy IP tables. Please make shure to set the right interface name instead of eth0. You can get it by running ifconfig
    sudo iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3128
    sudo iptables -I INPUT -p tcp -m tcp --dport 3128 -j ACCEPT

  11. Create directory for the dynamically generated certificates
    sudo mkdir /usr/local/squid/var/lib
    sudo /usr/local/squid/libexec/ssl_crtd -c -s /usr/local/squid/var/lib/ssl_db -M 4MB
    sudo chown -R squid:squid /usr/local/squid/var/lib/ssl_db/

  12. Start Squid Proxy
    You can start Squid Proxy in the background or in debug mode. For first tests it is recommendend to start it in Debug mode. If it isn't able to start, try to start it as root or better as user squid.
    Debug mode: /usr/local/squid/sbin/squid -NCd9
    Background: /usr/local/squid/sbin/squid

##Installation of Siri-API

  1. To run Siri-API you need to install the Python3 interpreter.
    On Debian (based) systems you can do this with running sudo apt-get install python3

  2. Go back to the directory where you downloaded Siri-API

  3. Edit the file server.py. Change the information in the configuration area depending from your wishes.
    squid_hostname: hostname of the server squid is running on. Normally it is the hostname / ip of the current computer. Do not use local ip 127.0.0.1
    squid_port: port of Squid Server. If you didn't change the configuration file you don't have to change it
    google_domain: the domain of google which iOS uses in your language version. See remarks below
    keyword: the keyword which redirects the google search request to Siri API. See remarks below

  4. Start Siri API python3 server.py Please note that you also have to start Squid Proxy if not already done

##Setup your iDevice

  1. Open preferences
  2. Open Wi-Fi settings
  3. Click on your network
  4. Set HTTP PROXY to Auto
  5. Insert http://your_hostname:3030/proxy.pac in the URL input box