RobinMeis / Siri-API

Siri-API is a tool which opens Apples Siri for your own wishes WITHOUT the requirement of a Jailbreak. You can predefine keywords which execute your own python code when they are found in a request.
use Python 3ws of Apples Siri. It should woww.blog.smartnoob.de
87 stars 23 forks source link

google normally appears #2

Closed Doriginal closed 10 years ago

Doriginal commented 10 years ago

i'have start the server, I see lines in the terminal but it is google that normally appears

root@ubuntu:~/Siri-API# python3 server.py Starting Server... Server listening on port 3030... Press enter to exit/proxy.pac 192.168.0.3 - - [26/Apr/2014 04:33:07] "GET /proxy.pac HTTP/1.1" 200 - /proxy.pac 192.168.0.3 - - [26/Apr/2014 04:33:09] "GET /proxy.pac HTTP/1.1" 200 - /proxy.pac 192.168.0.3 - - [26/Apr/2014 04:34:05] "GET /proxy.pac HTTP/1.1" 200 - /proxy.pac 192.168.0.3 - - [26/Apr/2014 04:34:07] "GET /proxy.pac HTTP/1.1" 200 - /proxy.pac 192.168.0.3 - - [26/Apr/2014 04:34:48] "GET /proxy.pac HTTP/1.1" 200 - /proxy.pac 192.168.0.3 - - [26/Apr/2014 04:34:48] "GET /proxy.pac HTTP/1.1" 200 - /proxy.pac 192.168.0.3 - - [26/Apr/2014 04:35:37] "GET /proxy.pac HTTP/1.1" 200 - /proxy.pac 192.168.0.3 - - [26/Apr/2014 04:35:38] "GET /proxy.pac HTTP/1.1" 200 - /proxy.pac 192.168.0.3 - - [26/Apr/2014 04:36:28] "GET /proxy.pac HTTP/1.1" 200 -

RobinMeis commented 10 years ago

That means that the proxy rule was downloaded. Did you already start Squid Proxy? Note that you also have to say the keyword (Siri by default)

Did you change the configuration section in the server.py and the squid.conf?

Doriginal commented 10 years ago

Yes I said "google siri"

squid looks started

root@ubuntu:/usr/local/squid# /usr/local/squid/sbin/squid -NCd9 2014/04/26 04:55:58| aclIpParseIpData: WARNING: Netmask masks away part of the specified IP in '192.168.0.1/25' 2014/04/26 04:55:58| SECURITY NOTICE: auto-converting deprecated "ssl_bump allow " to "ssl_bump client-first " which is usually inferior to the newer server-first bumping mode. Update your ssl_bump rules. 2014/04/26 04:55:58| WARNING: auto-converting deprecated "ssl_bump deny " to "ssl_bump none ". Update your ssl_bump rules. 2014/04/26 04:55:58| Squid is already running! Process ID 58632

RobinMeis commented 10 years ago

Okay, which language is currently activated on your iPhone?

Doriginal commented 10 years ago

french. I put google.fr in the config

RobinMeis commented 10 years ago

You have to make a dot in front of the domain. It has to look like .google.fr . Did you already change the hostnames in squid.conf and server.py? Finally try to restart you iPhone.

Doriginal commented 10 years ago

I have. google.fr but still nothing google that normally appears

RobinMeis commented 10 years ago

Can you post the configuration section of server.py and your modified squid.conf please?

Doriginal commented 10 years ago

yes, thank for your help.

######################

Configuration area

######################

squid_hostname = "192.168.0.8" # Hostname or IP address of the server which is running squid proxy squid_port = 3128 # Port of squid (change only if you changed it in squid configuration) google_domain = ".google.fr" # Domain of "the" Google which is opened from your language. Consult readme for more information keyword = "Siri" # By default this is siri. You can change this to any other (well recognized) keyword, CASE SENSITIVE!!!

#####################

SQUID:

strip_query_terms off acl allcomputers src 192.168.0.1/25 # Change to your local networks IP range http_access allow allcomputers http_access allow localhost

acl Blocksites dstdomain .google.fr # Change to the domain depending on your language (consult readme) deny_info http://192.168.0.8:3030%R allcomputers # Enter the hostname of the computer running Siri API http_reply_access deny Blocksites allcomputers

acl CONNECT method CONNECT

acl google dstdomain .google.fr # Change to the domain depending on your language (consult readme)

RobinMeis commented 10 years ago

I read the whole output of the Squid Proxy startup progres you posted. The problem might be at the acl allcomputers part. Please calculate the right CIDR Notation for your network configuration here: http://www.subnet-calculator.com/cidr.php and replace 192.168.0.1/25 with it.

After that reboot the computer Squid is running on and start server.py and squid again. Check if the warning "Netmask masks away part of the specified IP in '192.168.0.1/25" still appears.

After that close all apps on your iPhone and reboot it. After that make shure to be connected to the wifi network and try it again.

If this still not work try to set host 192.168.0.8 and port 3128 in your desktop browsers proxy configuration (I recommend Firefox for this) and try to access google.fr. If Squid is running as expected, you should get an certificate error. Don't try to accept this certificate on Firefox, it won't work. But anyway, we could find the problem if we know where the problem is.

Doriginal commented 10 years ago

in Firefox i have this:

capture

RobinMeis commented 10 years ago

That's strange. What happens, when you diable the Proxy settings again and you access http://192.168.0.8:3030/proxy.pac ? Please post the content of the pac file. You can open it in any text editor after downloading.

Doriginal commented 10 years ago

I think I have solved the problem with your site CIDR http://www.subnet-calculator.com/cidr.php

now in the console i:

root@ubuntu:~# /usr/local/squid/sbin/squid 2014/04/26 09:23:26| SECURITY NOTICE: auto-converting deprecated "ssl_bump allow " to "ssl_bump client-first " which is usually inferior to the newer server-first bumping mode. Update your ssl_bump rules. 2014/04/26 09:23:26| WARNING: auto-converting deprecated "ssl_bump deny " t o "ssl_bump none ". Update your ssl_bump rules.

Doriginal commented 10 years ago

The content of the pac file is:

Content-type: x-ns-proxy-autoconfig HTTP/1.0 200 OK Server: SimpleHTTP/0.6 Python/3.3.1 Date: Sat, 26 Apr 2014 18:13:49 GMT

function FindProxyForURL(url, host) { var keyword = url.toLowerCase().indexOf("siri"); if (dnsDomainIs(host, ".google.fr") && (keyword >= 0) && url.toLowerCase().indexOf("search?q=") >= 0) { return "PROXY 192.168.0.8:3128"; } return "DIRECT"; }

Doriginal commented 10 years ago

in firefox now i:

capture

RobinMeis commented 10 years ago

So you eliminated the error but now it seems that squid blocks your connection because your IP address doesn't match with the defined IP range. Maybe you find more information in the access.log in /usr/local/squid/var/logs . If not, just change it back to 192.168.0.1/25 . It is not clean but it was definitive better than now. We can care later for it. I will fix the first error you got by Squid. It seems I didn't catch the problem. But this won't solve your problem. (fixed) Where the header information also stored in the .pac file or did you just add them? If they were stored in the pac file this might be the reason for your problems.

Doriginal commented 10 years ago

I calculated the CIDR because I was mistaken in the Netmask. On iphone google always appears normally but in firefox now I have this

capture

Doriginal commented 10 years ago

and if i put a command (www.google.fr/search?q=bonjour) i have this

capture

RobinMeis commented 10 years ago

It was an update which ensures that you don't get an empty response. As I told you it won't fix the problem. But the screenshot helped me to believe that there is going something wrong. The headers are shown on the output and aren't handled as headers. So the HTML can't properly displayed. Also the PAC file becomes invalid during to this problem and the redirection to Squid doesn't work. I think it is a problem with Python. Are you able to update to the latest version? I will try to fix it but I'm currently not shure how.

Doriginal commented 10 years ago

yes I am willing to upgrade python, how can I do?

RobinMeis commented 10 years ago

This depends on how you have installed python. When you installed it with the package management of your system (Which system are you using), it is a bit complicated because you will have to remove it first and then reinstalling with a package of Python or you will have to compile it manually.

If you use a Debian based system you can use the following ppa to install it as package: https://launchpad.net/~fkrull/+archive/deadsnakes. If you have to compile the sources by yourself you can get some information here: http://askubuntu.com/questions/244544/how-do-i-install-python-3-3

Doriginal commented 10 years ago

I am python 3.3 should I upgrade anyway?

Shutting down server ... root@ubuntu:~/Siri-API# python3 --version Python 3.3.1

RobinMeis commented 10 years ago

I'm not shure but I think there is a bug in your Python version. I'm using Python 3.2 but of course I won't recommend a downgrade. The latest bug fix release for Python 3.3.x is 3.3.5. I would recommend to upgrade at least to 3.3.5. Read next commend please

I also opened a topic at stack overflow to ask if there is a known Python bug or if I have some parts in my code which might be deprecated. You can find it here: http://stackoverflow.com/questions/23321887/python-3-http-server-sends-headers-as-output

RobinMeis commented 10 years ago

I found a possible workaround by reading the documentaion. I found out that with Python 3.3. the function flush_headers() was introduced. I published a workaround in the Issue 2 branch.

You can download it with git clone https://github.com/HcDevel/Siri-API.git -b Issue-#2

After starting the server.py, please try to open www.google.fr/search?q=bonjour on your computer again and post both, the HTML output in your browser and the output from the terminal here.

Doriginal commented 10 years ago

same problem and I can not upgrade python, I'm still in 3.3.1 but in internet explorer it works 3 screenshot: firefox, ie and terminal capture capture2 capture3

RobinMeis commented 10 years ago

So the fix I added ran. You can see this at Headers flushed. It might be possible that the firefox has stored the site in it's cache. Try to hit Crtl + F5 or to clear it in the history cleanup dialog.

Can you try to access http://192.168.0.8:3030/?q=bonjour and http://192.168.0.8:3030/proxy.pac on your iPhone?

Doriginal commented 10 years ago

on my iPhone and ipad the code appear like firefox

Doriginal commented 10 years ago

which system makes you work siri-api? (debian, ubuntu ..) and what version?

Doriginal commented 10 years ago

I'll try with an older ubuntu and I told you

RobinMeis commented 10 years ago

You don't need the older ubuntu ;) I just found the problem. Please clone again the issue branch with git clone https://github.com/HcDevel/Siri-API.git -b Issue-#2

I sent the status code after the first header. It seems that it has to be send before the first header since Python 3.3. So I fixed it.

Thank you for your patience and sorry for the inconveniences

By the way: I got it running on Ubuntu 12.04 LTS and on a Raspberry Pi with the latest Raspian.

Doriginal commented 10 years ago

wow you're great :) thank you to you for your patience and for your responsiveness

in Firefox i have :) capture

I now tested with iphone and siri

Doriginal commented 10 years ago

it works perfectly now with siri thank you very much for your help. Now we will try to create some nice plugins :)

Secita commented 9 years ago

Hi Robin. I have followed your Installation instructions for RPi and everything looked fine. Now I try Siri on iPad and I get no response. How do I determined whether the connections are working. When I enter http://10.0.0.4:3030/proxy.pac? in Chrome on my Mac I get: function FindProxyForURL(url, host) { var keyword = url.toLowerCase().indexOf("siri"); if (dnsDomainIs(host, ".google.co.za") && (keyword >= 0) && url.toLowerCase().indexOf("search?q=") >= 0) { return "PROXY 10.0.0.4:3128"; } return "DIRECT"; }

What does this mean and what else can I do to test functionality. Thanks in advance!

purceno commented 9 years ago

Hello Secita This API is not working with iOS 8. It seems they've implemented something in this new version... It works for me with Google HTTP, but Siri redirects to Google HTTPS, which does not work in iOS 8

Secita commented 9 years ago

OK - thanks for the heads up. That is a pain - trust Apple! How do you use Google HTTP?

purceno commented 9 years ago

Haha! You can just type in Safari: http://www.google.com/search?q=Siri You'll be redirected to your proxy then (if it's working properly) But if you try HTTPS (https://www.google.com/search?q=Siri), it will not

Secita commented 9 years ago

Thanks!

What are my options for doing voice commands through the python3 server and squid proxy on the Pi? The concept and design are great!

On Tue, Nov 11, 2014 at 8:10 PM, purceno notifications@github.com wrote:

Hello Secita This API is not working with iOS 8. It seems they've implemented something in this new version... It works for me with Google HTTP, but Siri redirects to Google HTTPS, which does not work in iOS 8

— Reply to this email directly or view it on GitHub https://github.com/HcDevel/Siri-API/issues/2#issuecomment-62590364.

purceno commented 9 years ago

There are some other options... See this link: http://diyhacking.com/best-voice-recognition-software-for-raspberry-pi/ I've tested one (the one that they explaing how to install), and it works just fine... but there is no interaction with Siri. Anyway, is an option ;)

Secita commented 9 years ago

I do want to use an iDevice or Android and take advantage of the accurate voice recognition that those vendors provide.

On Tue, Nov 11, 2014 at 8:31 PM, purceno notifications@github.com wrote:

There are some other options... See this link: http://diyhacking.com/best-voice-recognition-software-for-raspberry-pi/ I've tested one (the one that they explaing how to install), and it work just fine... but there is no interaction with Siri. Anyway, is an option ;)

— Reply to this email directly or view it on GitHub https://github.com/HcDevel/Siri-API/issues/2#issuecomment-62593542.

Secita commented 9 years ago

That produces a response on the server.py terminal window: 10.0.0.11 - - [11/Nov/2014 20:36:58] "GET /proxy.pac HTTP/1.1" 200 - The config seems to work!?

purceno commented 9 years ago

This message is shown in server.py terminal when you open the browser (configured with the proxy file). When you try to open Google HTTP it should display another message like this, slightly different

Secita commented 9 years ago

does the Googolplex workaround work? Maybe not because its still HTTP not HTTPS. I appreciate your help on this!

purceno commented 9 years ago

Actually no =/ Googolplex does not work in iOS 8 either... Let me know if you find anything new, I tried many things, but none of them worked in Siri

Secita commented 9 years ago

I will! This is perplexing, no pun intended.

Secita commented 9 years ago

Apple don't want their precious Siri used for anything other than what they intend - I guess.

purceno commented 9 years ago

That's true.... =/

Secita commented 9 years ago

I installed Dragon Go! "Voice Commands 1.3" on my iPhone 4 (IOS 7.1 - not jailbreakable) and it seems to work quite well. However, still getting 10.0.0.20 - - [11/Nov/2014 22:25:30] "GET /proxy.pac HTTP/1.1" 200 - /proxy.pac in the server.py terminal. Its a start!

Secita commented 9 years ago

Any idea how to stop squid easily

Secita commented 9 years ago

Is there a way to troubleshoot this environment via debugging techniques, log files, or terminal output, etc? My iPad in running IOS 8.1 and therefor is no longer supported. I downloaded Dragon Go! (creators of Siri) Voice Command on a iPhone 4 and that does much the same thing. I changed the Key word from "Siri" to "plex" and start requests with "Google plex ...". It has the same effect as Google HTTP. I get a message on the python3 server terminal window (as in two comments above). No entries in access.log though. What connections are being made and what are not and how to I tell? Thanks in advance.

Secita commented 9 years ago

Hi Purceno The good news is that the Pi environment with squid and Siri-API works via http in safari on iPhone - switches lights on and off via commands.py code as it should. Voice Command does convert voice to text well though it uses the Google search window rather than the URL window. I just need to fix that last issue to get the whole show rocking and rolling!

purceno commented 9 years ago

Hi Secita, good news! Yes, it works for me via Google HTTP in Safari too. The problem is with HTTPS, as Siri redirects Safari to Google HTTPS when any search is requested